|
@@ -121,7 +121,7 @@ class KMLoginWindowController: NSWindowController {
|
|
|
//verificationCodeView
|
|
|
//验证码界面点击取消按钮
|
|
|
self.verificationCodeView.cancelAction = { [unowned self] view in
|
|
|
- self.logType = .resetPassword
|
|
|
+ self.logType = view.inputType
|
|
|
}
|
|
|
|
|
|
//验证码界面点击完成按钮
|
|
@@ -137,13 +137,14 @@ class KMLoginWindowController: NSWindowController {
|
|
|
self.verificationCodeView.showAlert(result: result)
|
|
|
}
|
|
|
}
|
|
|
- } else if view.inputType == .resetPassword {
|
|
|
- KMRequestServerManager.manager.resetPassword(account: data.email, firstPassword: data.password, secondPassword: data.rePassword, verifyCode: data.verifyCode) {[unowned self] (success, result) in
|
|
|
+ } else if view.inputType == .loginInputPassword {
|
|
|
+ KMRequestServerManager.manager.verificationCode(account: data.email, verifyCode: data.verifyCode, verifyCodeType: .resetPassword) { success, result in
|
|
|
if success {
|
|
|
- self.model.email = data.email
|
|
|
- self.logType = .login
|
|
|
+ self.resetPasswordView.model.verifyCode = data.verifyCode
|
|
|
+ self.resetPasswordView.model.email = data.email
|
|
|
+ self.logType = .resetPassword
|
|
|
} else {
|
|
|
- self.verificationCodeView.showAlert(result: result!)
|
|
|
+ self.verificationCodeView.showAlert(result: result)
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -202,7 +203,16 @@ class KMLoginWindowController: NSWindowController {
|
|
|
|
|
|
//登录输入密码界面点击忘记密码按钮
|
|
|
self.loginInputPasswordView.forgotPasswordAction = { [unowned self] (view, data) in
|
|
|
- self.logType = .resetPassword
|
|
|
+ KMRequestServerManager.manager.getVerifyCode(verifyCodeType: .resetPassword, email: data.email) { success, result in
|
|
|
+ if success {
|
|
|
+ self.verificationCodeView.inputType = .loginInputPassword
|
|
|
+ self.verificationCodeView.model.email = data.email
|
|
|
+ self.verificationCodeView.beginTimer()
|
|
|
+ self.logType = .verificationCode
|
|
|
+ } else {
|
|
|
+ self.loginInputPasswordView.showAlert(result: result)
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
//登录输入密码界面点击调整邮箱按钮
|
|
@@ -213,16 +223,12 @@ class KMLoginWindowController: NSWindowController {
|
|
|
//resetPasswordView
|
|
|
//重置密码界面点击完成按钮
|
|
|
self.resetPasswordView.doneAction = { [unowned self] (view, data) in
|
|
|
- KMRequestServerManager.manager.getVerifyCode(verifyCodeType: .resetPassword, email: data.email) { success, result in
|
|
|
+ KMRequestServerManager.manager.resetPassword(account: data.email, firstPassword: data.password, secondPassword: data.rePassword, verifyCode: data.verifyCode) {[unowned self] (success, result) in
|
|
|
if success {
|
|
|
- self.verificationCodeView.inputType = .resetPassword
|
|
|
- self.verificationCodeView.model.email = data.email
|
|
|
- self.verificationCodeView.model.password = data.password
|
|
|
- self.verificationCodeView.model.rePassword = data.rePassword
|
|
|
- self.verificationCodeView.beginTimer()
|
|
|
- self.logType = .verificationCode
|
|
|
+ self.model.email = data.email
|
|
|
+ self.logType = .login
|
|
|
} else {
|
|
|
- self.resetPasswordView.showAlert(result: result)
|
|
|
+ self.verificationCodeView.showAlert(result: result!)
|
|
|
}
|
|
|
}
|
|
|
}
|