@@ -56,13 +56,15 @@ - (void)sendVerificationCode:(id)sender {
5656 if (_emailImageView.highlighted ) {
5757 return ;
5858 }
59+ _sendButton.enabled = NO ;
5960 [manager POST: [InternetTool createUrl: @" api/user/verification_code" ]
6061 parameters: @{@" email" : _emailTextField.text }
6162 progress: nil
6263 success: ^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
6364 InternetResponse *response = [[InternetResponse alloc ] initWithResponseObject: responseObject];
6465 if ([response statusOK ]) {
6566 _emailTextField.enabled = NO ;
67+ _sendButton.enabled = YES ;
6668 [AlertTool showAlertWithTitle: NSLocalizedString(@" tip_name" , @" Tip" )
6769 andContent: NSLocalizedString(@" send_validation_code_success" , @" Verification code has sent to your email." )
6870 inViewController: self ];
@@ -71,6 +73,11 @@ - (void)sendVerificationCode:(id)sender {
7173 failure: ^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
7274 InternetResponse *response = [[InternetResponse alloc ] initWithError: error];
7375 switch ([response errorCode ]) {
76+ case ErrorCodeMailNotExist:
77+ [AlertTool showAlertWithTitle: NSLocalizedString(@" tip_name" , @" tip" )
78+ andContent: NSLocalizedString(@" mail_not_exsit" , @" The email you input is not exist." )
79+ inViewController: self ];
80+ break ;
7481 default :
7582 break ;
7683 }
@@ -83,8 +90,37 @@ - (IBAction)submitNewPassword:(id)sender {
8390 }
8491 _verificationCodeImageView.highlighted = [_verificationCodeTextField.text isEqualToString: @" " ];
8592 _passwordImageView.highlighted = [_passwordTextField.text isEqualToString: @" " ];
86- if (_emailImageView .highlighted && _passwordImageView.highlighted ) {
93+ if (_verificationCodeImageView .highlighted || _passwordImageView.highlighted ) {
8794 return ;
8895 }
96+ [_loadingActivityIndicatorView startAnimating ];
97+ [manager POST: [InternetTool createUrl: @" api/user/change_password" ]
98+ parameters: @{
99+ @" email" : _emailTextField.text ,
100+ @" password" : _passwordTextField.text ,
101+ @" vertificationCode" : _verificationCodeTextField.text
102+ }
103+ progress: nil
104+ success: ^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) {
105+ InternetResponse *repsonse = [[InternetResponse alloc ] initWithResponseObject: responseObject];
106+ if ([repsonse statusOK ]) {
107+ // Modified password scuessfully.
108+ _modifySuccessView.hidden = NO ;
109+ [_submitButton removeFromSuperview ];
110+ [_loadingActivityIndicatorView stopAnimating ];
111+ }
112+ }
113+ failure: ^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {
114+ InternetResponse *response = [[InternetResponse alloc ] initWithError: error];
115+ switch ([response errorCode ]) {
116+ case ErrorCodeMailNotExist:
117+ [AlertTool showAlertWithTitle: NSLocalizedString(@" tip_name" , @" tip" )
118+ andContent: NSLocalizedString(@" mail_not_exsit" , @" The email you input is not exist." )
119+ inViewController: self ];
120+ break ;
121+ default :
122+ break ;
123+ }
124+ }];
89125}
90126@end
0 commit comments