Browse Source

短信需要验证图形验证码

Steven 1 year ago
parent
commit
78060459f2

+ 2 - 1
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.h

@@ -220,10 +220,11 @@ NS_ASSUME_NONNULL_BEGIN
  @param post post
  @param mobile 手机号码
  @param type type    PASSWD  LOGIN BANK PHONE
+ @param code 图形验证码
  @param success 成功
  @param faliure 失败
  */
-+ (void)sendSmsRequest:(NSString *)post mobile:(NSString *)mobile type:(NSString *)type success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
++ (void)sendSmsRequest:(NSString *)post mobile:(NSString *)mobile type:(NSString *)type code:(NSString *)code success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure;
 
 // /api-student/code/verifyImageCode
 

+ 4 - 2
KulexiuForStudent/KulexiuForStudent/Common/Base/KSNetworkingManager.m

@@ -683,15 +683,17 @@
  
  @param post post
  @param mobile 手机号码
- @param type type
+ @param type type    PASSWD  LOGIN BANK PHONE
+ @param code 图形验证码
  @param success 成功
  @param faliure 失败
  */
-+ (void)sendSmsRequest:(NSString *)post mobile:(NSString *)mobile type:(NSString *)type success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
++ (void)sendSmsRequest:(NSString *)post mobile:(NSString *)mobile type:(NSString *)type code:(NSString *)code success:(void(^)(NSDictionary *dic))success faliure:(void(^)(NSError *error))faliure {
     [self configRequestMethodForm];
     NSMutableDictionary *parm = [NSMutableDictionary dictionary];
     [parm setValue:mobile forKey:@"mobile"];
     [parm setValue:type forKey:@"type"];
+    [parm setValue:code forKey:@"code"];
     NSString *url = [NSString stringWithFormat:@"%@%@",hostURL, @"/api-student/code/sendSmsCode"];
     [self request:post andWithUrl:url and:parm success:success faliure:faliure];
 }

+ 18 - 3
KulexiuForStudent/KulexiuForStudent/Module/Login/Controller/VefiCodeLoginController.m

@@ -10,6 +10,7 @@
 #import "FirstSettingViewController.h"
 #import "AppDelegate.h"
 #import "UserInfoManager.h"
+#import "VeriCheckView.h"
 
 @interface VefiCodeLoginController ()
 {
@@ -35,7 +36,6 @@
     if (![NSString isEmptyString:self.phoneNo]) {
         [self queryVefiCode];
     }
-    [_bodyView showKeyboard];
 }
 
 - (void)configUI {
@@ -71,7 +71,6 @@
         case VEFIACTION_VEFIACTION: // 发送验证码
         {
             [self queryVefiCode];
-            [self.bodyView showKeyboard];
         }
             break;
         case VEFIACTION_LOGIN: // 登录
@@ -84,11 +83,26 @@
     }
 }
 
+
+
 - (void)queryVefiCode {
+    NSString *phoneNo = self.phoneNo;
+    // 图形化验证
+    VeriCheckView *view = [VeriCheckView shareInstanceShowInView:[NSObject getKeyWindow]];
+    __weak typeof(view) weakView = view;
+    [view showViewCallback:^(NSDictionary * _Nonnull parm) {
+        [self veriImageCodeWithParm:parm checkView:weakView];
+    }];
+    [view disPlayImageWithPhone:phoneNo];
+}
+
+// 发送短信 校验图形验证码
+- (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
-    [KSNetworkingManager sendSmsRequest:KS_POST mobile:self.phoneNo type:@"LOGIN" success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"LOGIN" code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
         }
@@ -100,6 +114,7 @@
     }];
 }
 
+
 - (void)codeButtonCountDown {
     _bodyView.vefiButton.userInteractionEnabled = NO;
     [_bodyView.vefiButton setBackgroundColor:HexRGB(0xd5d5d5)];

+ 4 - 17
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/Controller/ModifyPhoneChangeController.m

@@ -104,27 +104,13 @@
     [view disPlayImageWithPhone:phoneNo];
 }
 
+// 发送短信 校验图形验证码
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
-    [KSNetworkingManager verifyLoginImageRequest:KS_POST phone:[parm ks_stringValueForKey:@"phone"] code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
-        if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
-            [checkView hiddView];
-            [self sendSMSRequestWithParm:parm];
-        }
-        else {
-            [LOADING_MANAGER removeHUD];
-            [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        [LOADING_MANAGER removeHUD];
-    }];
-}
-
-// 发送短信
-- (void)sendSMSRequestWithParm:(NSDictionary *)parm {
-    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"PHONE" success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"PHONE" code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
         }
@@ -136,6 +122,7 @@
     }];
 }
 
+
 - (void)codeButtonCountDown {
     _bodyView.codeButton.userInteractionEnabled = NO;
     [_bodyView.codeButton setTitleColor:HexRGB(0xe5e5e5) forState:UIControlStateNormal];

+ 4 - 17
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/Controller/ModifyViewController.m

@@ -97,27 +97,13 @@
     [view disPlayImageWithPhone:phoneNo];
 }
 
+// 发送短信 校验图形验证码
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
-    [KSNetworkingManager verifyLoginImageRequest:KS_POST phone:[parm ks_stringValueForKey:@"phone"] code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
-        if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
-            [checkView hiddView];
-            [self sendSMSRequestWithParm:parm];
-        }
-        else {
-            [LOADING_MANAGER removeHUD];
-            [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        [LOADING_MANAGER removeHUD];
-    }];
-}
-
-// 发送短信
-- (void)sendSMSRequestWithParm:(NSDictionary *)parm {
-    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"PASSWD" success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"PASSWD" code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
         }
@@ -129,6 +115,7 @@
     }];
 }
 
+
 - (void)codeButtonCountDown {
     _bodyView.codeButton.userInteractionEnabled = NO;
     [_bodyView.codeButton setTitleColor:HexRGB(0xe5e5e5) forState:UIControlStateNormal];

+ 4 - 17
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/Controller/PasswordModify/ForgetPasswordViewController.m

@@ -94,27 +94,13 @@
     [view disPlayImageWithPhone:phoneNo];
 }
 
+// 发送短信 校验图形验证码
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
-    [KSNetworkingManager verifyLoginImageRequest:KS_POST phone:[parm ks_stringValueForKey:@"phone"] code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
-        if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
-            [checkView hiddView];
-            [self sendSMSRequestWithParm:parm];
-        }
-        else {
-            [LOADING_MANAGER removeHUD];
-            [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        [LOADING_MANAGER removeHUD];
-    }];
-}
-
-// 发送短信
-- (void)sendSMSRequestWithParm:(NSDictionary *)parm {
-    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"PASSWD" success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"PASSWD" code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
         }
@@ -123,6 +109,7 @@
         }
     } faliure:^(NSError * _Nonnull error) {
         [LOADING_MANAGER removeHUD];
+
     }];
 }
 

+ 5 - 17
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/Controller/PasswordModify/NewPwdModifyViewController.m

@@ -93,27 +93,13 @@
     [view disPlayImageWithPhone:phoneNo];
 }
 
+// 发送短信 校验图形验证码
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
-    [KSNetworkingManager verifyLoginImageRequest:KS_POST phone:[parm ks_stringValueForKey:@"phone"] code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
-        if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
-            [checkView hiddView];
-            [self sendSMSRequestWithParm:parm];
-        }
-        else {
-            [LOADING_MANAGER removeHUD];
-            [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        [LOADING_MANAGER removeHUD];
-    }];
-}
-
-// 发送短信
-- (void)sendSMSRequestWithParm:(NSDictionary *)parm {
-    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"PASSWD" success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"PASSWD" code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
         }
@@ -122,9 +108,11 @@
         }
     } faliure:^(NSError * _Nonnull error) {
         [LOADING_MANAGER removeHUD];
+
     }];
 }
 
+
 - (void)codeButtonCountDown {
     _bodyView.codeButton.userInteractionEnabled = NO;
     [_bodyView.codeButton setTitleColor:HexRGB(0xe5e5e5) forState:UIControlStateNormal];

+ 5 - 17
KulexiuForStudent/KulexiuForStudent/Module/Mine/Setting/DeleteAccount/Controller/AccountDeleteViewController.m

@@ -110,27 +110,13 @@
     [view disPlayImageWithPhone:phoneNo];
 }
 
+// 发送短信 校验图形验证码
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
-    [KSNetworkingManager verifyLoginImageRequest:KS_POST phone:[parm ks_stringValueForKey:@"phone"] code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
-        if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
-            [checkView hiddView];
-            [self sendSMSRequestWithParm:parm];
-        }
-        else {
-            [LOADING_MANAGER removeHUD];
-            [LOADING_MANAGER MBShowAUTOHidingInWindow:MESSAGEKEY];
-        }
-    } faliure:^(NSError * _Nonnull error) {
-        [LOADING_MANAGER removeHUD];
-    }];
-}
-
-// 发送短信
-- (void)sendSMSRequestWithParm:(NSDictionary *)parm {
-    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"LOGOFF" success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"LOGOFF" code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
         }
@@ -139,9 +125,11 @@
         }
     } faliure:^(NSError * _Nonnull error) {
         [LOADING_MANAGER removeHUD];
+
     }];
 }
 
+
 - (void)codeButtonCountDown {
     _bodyView.codeButton.userInteractionEnabled = NO;
     [_bodyView.codeButton setTitleColor:HexRGB(0xe5e5e5) forState:UIControlStateNormal];