Skip to content

Commit

Permalink
hide refresh when on username/password window; move focus to blank pa…
Browse files Browse the repository at this point in the history
…ssword when not entered for username/password window
  • Loading branch information
twocanoes committed Dec 27, 2023
1 parent e9b1268 commit b54cf49
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 45 deletions.
3 changes: 0 additions & 3 deletions XCreds/TokenManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -325,11 +325,8 @@ class TokenManager: OIDCLiteDelegate,DSQueryable {
}
guard let tUsername = emailString.components(separatedBy: "@").first?.lowercased() else {
TCSLogErrorWithMark("email address invalid")
// throw ProcessTokenResult.error("The email address from the identity token is invalid.")

return .error("The email address from the identity token is invalid")
// mechanismDelegate.denyLogin(message:"The email address from the identity token is invalid")
// return

}

Expand Down
4 changes: 4 additions & 0 deletions XCredsLoginPlugIn/LoginWindow/ControlsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import Cocoa
class ControlsViewController: NSViewController {
var delegate: XCredsMechanismProtocol?

@IBOutlet weak var refreshGridColumn: NSGridColumn?
@IBOutlet weak var shutdownGridColumn: NSGridColumn?
@IBOutlet weak var restartGridColumn: NSGridColumn?

@IBOutlet weak var macLoginWindowGridColumn: NSGridColumn?
@IBOutlet weak var wifiGridColumn: NSGridColumn?
@IBOutlet weak var toolsView: NSView?
Expand Down
3 changes: 3 additions & 0 deletions XCredsLoginPlugIn/LoginWindow/ControlsViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
<customObject id="-2" userLabel="File's Owner" customClass="ControlsViewController" customModule="XCredsLoginPlugin">
<connections>
<outlet property="macLoginWindowGridColumn" destination="Qgw-6x-QRs" id="YHA-Qx-deF"/>
<outlet property="refreshGridColumn" destination="8Cw-21-fob" id="TAZ-uh-ulp"/>
<outlet property="restartGridColumn" destination="AiZ-fa-C1D" id="r8h-HG-Jsh"/>
<outlet property="shutdownGridColumn" destination="vSV-Ol-eHY" id="Mqo-KA-YRS"/>
<outlet property="toolsView" destination="4X8-WT-UyO" id="TTk-aU-6Vw"/>
<outlet property="trialVersionStatusTextField" destination="D8S-gh-gv5" id="yc8-WQ-xH8"/>
<outlet property="versionTextField" destination="p61-id-z2n" id="qZT-E7-l0T"/>
Expand Down
2 changes: 1 addition & 1 deletion XCredsLoginPlugIn/LoginWindow/LocalUsersViewController.xib
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<stackView distribution="fill" orientation="horizontal" alignment="top" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="TZJ-ht-zuy">
<rect key="frame" x="0.0" y="63" width="283" height="30"/>
<subviews>
<secureTextField focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="UJh-bj-CPX">
<secureTextField focusRingType="none" verticalHuggingPriority="750" tag="99" translatesAutoresizingMaskIntoConstraints="NO" id="UJh-bj-CPX">
<rect key="frame" x="0.0" y="0.0" width="250" height="30"/>
<constraints>
<constraint firstAttribute="width" constant="250" id="37q-P0-BRW"/>
Expand Down
44 changes: 12 additions & 32 deletions XCredsLoginPlugIn/LoginWindow/SignInWindowController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,14 @@ let checkADLog = OSLog(subsystem: "menu.nomad.login.ad", category: "CheckADMech"
TCSLogWithMark("No username entered")
return
}
TCSLogWithMark()
else if passString.isEmpty {
passwordTextField.shake(self)
view.window?.makeFirstResponder(passwordTextField)

TCSLogWithMark("No password entered")
return
}
TCSLogWithMark("passtring:\(passString)")
loginStartedUI()
TCSLogWithMark()
updateLoginWindowInfo()
Expand Down Expand Up @@ -303,35 +310,6 @@ let checkADLog = OSLog(subsystem: "menu.nomad.login.ad", category: "CheckADMech"
}


// @IBAction func ChangePassword(_ sender: Any) {
// guard newPassword.stringValue == newPasswordConfirmation.stringValue else {
// os_log("New passwords didn't match", log: uiLog, type: .error)
//// alertText.stringValue = "New passwords don't match"
// return
// }
//
// // set the passChanged flag
//
// passChanged = true
//
// //TODO: Terrible hack to be fixed once AD Framework is refactored
// password.stringValue = newPassword.stringValue
//
// session?.oldPass = oldPassword.stringValue
// session?.newPass = newPassword.stringValue
//
// os_log("Attempting password change for %{public}@", log: uiLog, type: .debug, shortName)
//
// // disable the fields
//
// oldPassword.isEnabled = false
// newPassword.isEnabled = false
// newPasswordConfirmation.isEnabled = false
//
// session?.changePassword()
// }


/// Format the user and domain from the login window depending on the mode the window is in.
///
/// I.e. are we picking a domain from a list, using a managed domain, or putting it on the user name with '@'.
Expand Down Expand Up @@ -896,9 +874,11 @@ extension SignInViewController: NoMADUserSessionDelegate {
//MARK: - NSTextField Delegate
extension SignInViewController: NSTextFieldDelegate {
public func controlTextDidChange(_ obj: Notification) {
TCSLogWithMark()
let passField = obj.object as! NSTextField
passString = passField.stringValue
if passField.tag == 99 {
TCSLogWithMark()
passString = passField.stringValue
}
}
}

Expand Down
10 changes: 9 additions & 1 deletion XCredsLoginPlugIn/Mechanisms/XCredsLoginMechanism.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import Network

case .cloud:
self.showLoginWindowType(loginWindowType: .usernamePassword)

case .usernamePassword:
self.showLoginWindowType(loginWindowType: .cloud)
}
Expand Down Expand Up @@ -69,9 +70,13 @@ import Network
if self.loginWindowType == .cloud {
TCSLogWithMark("reload in controller")
mainLoginWindowController.setupLoginWindowAppearance()

mainLoginWindowController.controlsViewController?.refreshGridColumn?.isHidden=false
loginWebViewController?.loadPage()
}
else {
mainLoginWindowController.controlsViewController?.refreshGridColumn?.isHidden=true

}
}
func useAutologin() -> Bool {

Expand Down Expand Up @@ -281,6 +286,7 @@ import Network

case .cloud:
self.loginWindowType = LoginWindowType.cloud
self.mainLoginWindowController.controlsViewController?.refreshGridColumn?.isHidden=false

if loginWebViewController==nil{
let bundle = Bundle.findBundleWithName(name: "XCreds")
Expand Down Expand Up @@ -330,6 +336,8 @@ import Network


case .usernamePassword:
self.mainLoginWindowController.controlsViewController?.refreshGridColumn?.isHidden=true

NetworkMonitor.shared.stopMonitoring()
self.loginWindowType = .usernamePassword

Expand Down
12 changes: 6 additions & 6 deletions xCreds.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1410,7 +1410,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6163;
CURRENT_PROJECT_VERSION = 6173;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1447,7 +1447,7 @@
buildSettings = {
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6163;
CURRENT_PROJECT_VERSION = 6173;
DEFINES_MODULE = YES;
DEVELOPMENT_TEAM = UXP6YEHSPW;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1568,7 +1568,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6163;
CURRENT_PROJECT_VERSION = 6173;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1605,7 +1605,7 @@
CODE_SIGN_ENTITLEMENTS = "XCreds Login Overlay/XCreds_Login_Overlay.entitlements";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6163;
CURRENT_PROJECT_VERSION = 6173;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1755,7 +1755,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6163;
CURRENT_PROJECT_VERSION = 6173;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down Expand Up @@ -1797,7 +1797,7 @@
CODE_SIGN_ENTITLEMENTS = XCreds/xCreds.entitlements;
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 6163;
CURRENT_PROJECT_VERSION = 6173;
DEVELOPMENT_TEAM = UXP6YEHSPW;
ENABLE_HARDENED_RUNTIME = YES;
FRAMEWORK_SEARCH_PATHS = (
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<key>auth_mech_fixup.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>7</integer>
<integer>8</integer>
</dict>
<key>authrights.xcscheme_^#shared#^_</key>
<dict>
Expand All @@ -42,7 +42,7 @@
<key>test.xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>8</integer>
<integer>7</integer>
</dict>
</dict>
<key>SuppressBuildableAutocreation</key>
Expand Down

0 comments on commit b54cf49

Please sign in to comment.