- (void) showAuthPrompt;
- (void) showEnterPassword;
- (void) showSAM;
-- (void) showChangePassword;
+- (void) showChangePassword: (NSWindow *) parentWindow;
- (void) showError;
- (IBAction) cancel: (id) sender;
- (IBAction) cancelTicketOptions: (id) sender;
- (IBAction) saveTicketOptions: (id) sender;
-- (void) sheetDidEnd: (NSWindow *) sheet
+- (void) changePasswordSheetDidEnd: (NSWindow *) sheet
+ returnCode: (int) returnCode
+ contextInfo: (void *) contextInfo;
+- (void) ticketOptionsSheetDidEnd: (NSWindow *) sheet
returnCode: (int) returnCode
contextInfo: (void *) contextInfo;
[[self window] makeFirstResponder:samPromptField];
}
-- (void) showChangePassword
+- (void) showChangePassword: (NSWindow *) parentWindow
{
NSString *key = ([glueController valueForKeyPath:password_expired_keypath]) ? ACAppPrincReqKey : ACPrincReqKey;
NSString *message = [NSString stringWithFormat:
[self hideSpinny];
[self swapView:changePasswordView];
-
- [self showWindow:nil];
+
+ // attach as sheet if given a parentWindow
+ if (parentWindow) {
+ [NSApp beginSheet:theWindow
+ modalForWindow:parentWindow
+ modalDelegate:self
+ didEndSelector:@selector(changePasswordSheetDidEnd:returnCode:contextInfo:)
+ contextInfo:NULL];
+ }
+ // else, display as normal
+ else {
+ [self showWindow:nil];
+ }
[theWindow makeFirstResponder:oldPasswordField];
}
[NSApp beginSheet:ticketOptionsSheet
modalForWindow:[self window]
modalDelegate:self
- didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:)
+ didEndSelector:@selector(ticketOptionsSheetDidEnd:returnCode:contextInfo:)
contextInfo:NULL];
}
[NSApp endSheet:ticketOptionsSheet];
}
-- (void) sheetDidEnd: (NSWindow *) sheet
- returnCode: (int) returnCode
- contextInfo: (void *) contextInfo
+- (void) changePasswordSheetDidEnd: (NSWindow *) sheet
+ returnCode: (int) returnCode
+ contextInfo: (void *) contextInfo
+{
+ [sheet orderOut:nil];
+}
+
+
+- (void) ticketOptionsSheetDidEnd: (NSWindow *) sheet
+ returnCode: (int) returnCode
+ contextInfo: (void *) contextInfo
{
if (returnCode == NSUserCancelledError) {
// discard new options
- (IBAction) cancel: (id) sender
{
+ [NSApp endSheet:[self window]];
[associatedClient didCancel];
}
[associatedClient didChangePassword:oldString
newPassword:newString
verifyPassword:verifyString];
+ [NSApp endSheet:[self window]];
}
- (IBAction) showedError: (id) sender
ipc_client_state_init,
ipc_client_state_enter,
ipc_client_state_select,
+ ipc_client_state_select_change_password,
ipc_client_state_auth_prompt,
ipc_client_state_change_password,
ipc_client_state_handle_error,
else if (self.state == ipc_client_state_auth_prompt) {
[KerberosAgentListener didPromptForAuth:self.currentInfo error:err];
}
- else if (self.state == ipc_client_state_change_password) {
+ else if (self.state == ipc_client_state_change_password ||
+ self.state == ipc_client_state_select_change_password) {
[KerberosAgentListener didChangePassword:self.currentInfo error:err];
}
- self.state = ipc_client_state_idle;
+
+ if (self.state == ipc_client_state_select_change_password) {
+ self.state = ipc_client_state_select;
+ }
+ else {
+ self.state = ipc_client_state_idle;
+ }
}
- (kim_error) selectIdentity: (NSDictionary *) info
[KerberosAgentListener didSelectIdentity:self.currentInfo error:0];
// clean up state
- self.state = ipc_client_state_idle;
+ if (!wantsChangePassword) {
+ self.state = ipc_client_state_idle;
+ }
}
- (kim_error) enterIdentity: (NSDictionary *) info
[self.currentInfo setObject:options forKey:@"options"];
[self.currentInfo setObject:[NSNumber numberWithBool:wantsChangePassword] forKey:@"wants_change_password"];
[KerberosAgentListener didEnterIdentity:self.currentInfo error:0];
+
+ if (self.state == ipc_client_state_select_change_password) {
+ self.state = ipc_client_state_select;
+ }
+ else {
+ self.state = ipc_client_state_idle;
+ }
}
- (kim_error) promptForAuth: (NSDictionary *) info
- (kim_error) changePassword: (NSDictionary *) info
{
+ NSWindow *parentWindow = nil;
+
[self.currentInfo addEntriesFromDictionary:info];
- self.state = ipc_client_state_change_password;
+
+ if (self.state == ipc_client_state_select) {
+ self.state = ipc_client_state_select_change_password;
+ parentWindow = [selectController window];
+ }
+ else {
+ self.state = ipc_client_state_change_password;
+ }
[self.authController setContent:self.currentInfo];
- [self.authController showChangePassword];
+ [self.authController showChangePassword:parentWindow];
return 0;
}