Skip to content

Commit

Permalink
another attempt at fixing #95
Browse files Browse the repository at this point in the history
  • Loading branch information
twocanoes committed Aug 11, 2023
1 parent 0703cd9 commit 819e9a0
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 41 deletions.
47 changes: 14 additions & 33 deletions NomadLogin/UI/SignInWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -406,38 +406,16 @@ class SignInWindowController: NSWindowController, DSQueryable {
/// 3. Create a `NoMADSession` and see if we can authenticate as the user.
@IBAction func signInClick(_ sender: Any) {
TCSLogWithMark("Sign In button clicked")
if username.stringValue.isEmpty {
let strippedUsername = username.stringValue.trimmingCharacters(in: CharacterSet.whitespaces)

if strippedUsername.isEmpty {
username.shake(self)
TCSLogWithMark("No username entered")
return
}
TCSLogWithMark()
loginStartedUI()
TCSLogWithMark()
// if getManagedPreference(key: .GuestUser) as? Bool ?? false {
//
// os_log("Checking for guest account", log: uiLog, type: .default)
//
// let guestUsers = getManagedPreference(key: .GuestUserAccounts) as? [String] ?? ["Guest", "guest"]
// if guestUsers.contains(username.stringValue) {
// os_log("Guest user engaging", log: uiLog, type: .default)
// delegate?.setHint(type: .guestUser, hint: "true")
// shortName = username.stringValue
// passString = UUID.init().uuidString
// delegate?.setHint(type: .noMADDomain, hint: "GUEST")
// delegate?.setHint(type: .firstName, hint: getManagedPreference(key: .GuestUserFirst) as? String ?? "Guest")
// delegate?.setHint(type: .lastName, hint: getManagedPreference(key: .GuestUserLast) as? String ?? "User")
// delegate?.setHint(type: .fullName, hint: (getManagedPreference(key: .GuestUserFirst) as? String ?? "Guest") + (getManagedPreference(key: .GuestUserLast) as? String ?? "User"))
// setRequiredHintsAndContext()
// completeLogin(authResult: .allow)
// return
// }
// }

// clear any alerts

// alertText.stringValue = ""
TCSLogWithMark()
prepareAccountStrings()
TCSLogWithMark()
if self.domainName.isEmpty==true || self.localOnlyCheckBox.state == .on{
Expand Down Expand Up @@ -523,13 +501,16 @@ class SignInWindowController: NSWindowController, DSQueryable {
TCSLogWithMark("Format user and domain strings")
TCSLogWithMark()
var providedDomainName = ""

shortName = username.stringValue

let strippedUsername = username.stringValue.trimmingCharacters(in: CharacterSet.whitespaces)
shortName = strippedUsername


TCSLogWithMark()
if username.stringValue.range(of:"@") != nil {
shortName = (username.stringValue.components(separatedBy: "@").first)!
if strippedUsername.range(of:"@") != nil {
shortName = (strippedUsername.components(separatedBy: "@").first)!

providedDomainName = username.stringValue.components(separatedBy: "@").last!.uppercased()
providedDomainName = strippedUsername.components(separatedBy: "@").last!.uppercased()
TCSLogWithMark(providedDomainName)
}
TCSLogWithMark()
Expand All @@ -539,11 +520,11 @@ class SignInWindowController: NSWindowController, DSQueryable {
// return
// }
TCSLogWithMark()
if username.stringValue.contains("\\") {
if strippedUsername.contains("\\") {
os_log("User entered an NT Domain name, doing lookup", log: uiLog, type: .default)
if let ntDomains = getManagedPreference(key: .NTtoADDomainMappings) as? [String:String],
let ntDomain = username.stringValue.components(separatedBy: "\\").first?.uppercased(),
let user = username.stringValue.components(separatedBy: "\\").last,
let ntDomain = strippedUsername.components(separatedBy: "\\").first?.uppercased(),
let user = strippedUsername.components(separatedBy: "\\").last,
let convertedDomain = ntDomains[ntDomain] {
shortName = user
providedDomainName = convertedDomain
Expand Down
4 changes: 2 additions & 2 deletions Profile Manifest/com.twocanoes.xcreds.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>pfm_app_url</key>
<string>https://github.com/twocanoes/xcreds</string>
<key>pfm_description</key>
<string>XCreds 3.1 (5084) OAuth Settings</string>
<string>XCreds 3.2 (5086) OAuth Settings</string>
<key>pfm_documentation_url</key>
<string>https://twocanoes.com/knowledge-base/xcreds-admin-guide/#preferences</string>
<key>pfm_domain</key>
Expand Down Expand Up @@ -859,6 +859,6 @@ changing “passwordID” to the correct element ID. If the value you typed into
<key>pfm_unique</key>
<false/>
<key>pfm_version</key>
<integer>5084</integer>
<integer>5086</integer>
</dict>
</plist>
12 changes: 6 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1229,7 +1229,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5084;
CURRENT_PROJECT_VERSION = 5086;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1267,7 +1267,7 @@
CLANG_ENABLE_MODULES = YES;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5084;
CURRENT_PROJECT_VERSION = 5086;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1387,7 +1387,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5084;
CURRENT_PROJECT_VERSION = 5086;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1424,7 +1424,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5084;
CURRENT_PROJECT_VERSION = 5086;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1574,7 +1574,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5084;
CURRENT_PROJECT_VERSION = 5086;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1611,7 +1611,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 5084;
CURRENT_PROJECT_VERSION = 5086;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Binary file not shown.

0 comments on commit 819e9a0

Please sign in to comment.