Просмотр исходного кода

发送验证码需要校验图形验证码

Steven 1 год назад
Родитель
Сommit
f19c15c097

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

@@ -220,10 +220,11 @@ NS_ASSUME_NONNULL_BEGIN
  @param post post
  @param post post
  @param mobile 手机号码
  @param mobile 手机号码
  @param type type    PASSWD  LOGIN BANK PHONE LOGOFF
  @param type type    PASSWD  LOGIN BANK PHONE LOGOFF
+ @param code 图形验证码
  @param success 成功
  @param success 成功
  @param faliure 失败
  @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-teacher/code/verifyImageCode
 // /api-teacher/code/verifyImageCode
 
 

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

@@ -607,15 +607,17 @@
  
  
  @param post post
  @param post post
  @param mobile 手机号码
  @param mobile 手机号码
- @param type type
+ @param type type    PASSWD  LOGIN BANK PHONE LOGOFF
+ @param code 图形验证码
  @param success 成功
  @param success 成功
  @param faliure 失败
  @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];
     [self configRequestMethodForm];
     NSMutableDictionary *parm = [NSMutableDictionary dictionary];
     NSMutableDictionary *parm = [NSMutableDictionary dictionary];
     [parm setValue:mobile forKey:@"mobile"];
     [parm setValue:mobile forKey:@"mobile"];
     [parm setValue:type forKey:@"type"];
     [parm setValue:type forKey:@"type"];
+    [parm setValue:code forKey:@"code"];
     NSString *url = [NSString stringWithFormat:@"%@%@",hostURL, @"/api-teacher/code/sendSmsCode"];
     NSString *url = [NSString stringWithFormat:@"%@%@",hostURL, @"/api-teacher/code/sendSmsCode"];
     [self request:post andWithUrl:url and:parm success:success faliure:faliure];
     [self request:post andWithUrl:url and:parm success:success faliure:faliure];
 }
 }

+ 1 - 0
KulexiuForTeacher/KulexiuForTeacher/Module/Chat/Controller/KSChatListViewController.m

@@ -35,6 +35,7 @@
     [super viewDidLoad];
     [super viewDidLoad];
     // Do any additional setup after loading the view.
     // Do any additional setup after loading the view.
     self.listVC = [[KSConversationListController alloc] init];
     self.listVC = [[KSConversationListController alloc] init];
+    self.listVC.isShowBanner = NO;
     // 把 TUIConversationListController 添加到自己的 ViewController
     // 把 TUIConversationListController 添加到自己的 ViewController
     [self addChildViewController:self.listVC];
     [self addChildViewController:self.listVC];
     self.listVC.delegate = self;
     self.listVC.delegate = self;

+ 15 - 2
KulexiuForTeacher/KulexiuForTeacher/Module/Login/Controller/VefiCodeLoginController.m

@@ -10,6 +10,7 @@
 #import "FirstSettingViewController.h"
 #import "FirstSettingViewController.h"
 #import "AppDelegate.h"
 #import "AppDelegate.h"
 #import "UserInfoManager.h"
 #import "UserInfoManager.h"
+#import "VeriCheckView.h"
 
 
 @interface VefiCodeLoginController ()
 @interface VefiCodeLoginController ()
 {
 {
@@ -79,10 +80,23 @@
 }
 }
 
 
 - (void)queryVefiCode {
 - (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];
     [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];
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
             [self codeButtonCountDown];
         }
         }
@@ -93,7 +107,6 @@
         [LOADING_MANAGER removeHUD];
         [LOADING_MANAGER removeHUD];
     }];
     }];
 }
 }
-
 - (void)codeButtonCountDown {
 - (void)codeButtonCountDown {
     _bodyView.vefiButton.userInteractionEnabled = NO;
     _bodyView.vefiButton.userInteractionEnabled = NO;
     [_bodyView.vefiButton setBackgroundColor:HexRGB(0xd5d5d5)];
     [_bodyView.vefiButton setBackgroundColor:HexRGB(0xd5d5d5)];

+ 3 - 17
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/Controller/ModifyPhoneChangeController.m

@@ -104,25 +104,10 @@
 
 
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
     [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];
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
             [self codeButtonCountDown];
         }
         }
@@ -134,6 +119,7 @@
     }];
     }];
 }
 }
 
 
+
 - (void)codeButtonCountDown {
 - (void)codeButtonCountDown {
     _bodyView.codeButton.userInteractionEnabled = NO;
     _bodyView.codeButton.userInteractionEnabled = NO;
     [_bodyView.codeButton setTitleColor:HexRGB(0xe5e5e5) forState:UIControlStateNormal];
     [_bodyView.codeButton setTitleColor:HexRGB(0xe5e5e5) forState:UIControlStateNormal];

+ 3 - 17
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/Controller/ModifyViewController.m

@@ -94,25 +94,10 @@
 
 
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
     [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];
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
             [self codeButtonCountDown];
         }
         }
@@ -124,6 +109,7 @@
     }];
     }];
 }
 }
 
 
+
 - (void)codeButtonCountDown {
 - (void)codeButtonCountDown {
     _bodyView.codeButton.userInteractionEnabled = NO;
     _bodyView.codeButton.userInteractionEnabled = NO;
     [_bodyView.codeButton setTitleColor:HexRGB(0xe5e5e5) forState:UIControlStateNormal];
     [_bodyView.codeButton setTitleColor:HexRGB(0xe5e5e5) forState:UIControlStateNormal];

+ 2 - 18
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/Controller/UnbindTenantViewController.m

@@ -150,26 +150,10 @@
 
 
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
     [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 {
-    NSString *type = @"SMS";
-    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:type success:^(NSDictionary * _Nonnull dic) {
+    [KSNetworkingManager sendSmsRequest:KS_POST mobile:[parm ks_stringValueForKey:@"phone"] type:@"SMS" code:[parm ks_stringValueForKey:@"code"] success:^(NSDictionary * _Nonnull dic) {
         [LOADING_MANAGER removeHUD];
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
             [self codeButtonCountDown];
         }
         }

+ 3 - 17
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/DeleteAccount/Controller/AccountDeleteViewController.m

@@ -108,25 +108,10 @@
 
 
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
     [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];
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
             [self codeButtonCountDown];
         }
         }
@@ -135,6 +120,7 @@
         }
         }
     } faliure:^(NSError * _Nonnull error) {
     } faliure:^(NSError * _Nonnull error) {
         [LOADING_MANAGER removeHUD];
         [LOADING_MANAGER removeHUD];
+
     }];
     }];
 }
 }
 
 

+ 3 - 17
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/PasswordModify/ForgetPasswordViewController.m

@@ -96,25 +96,10 @@
 
 
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
     [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];
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
             [self codeButtonCountDown];
         }
         }
@@ -123,6 +108,7 @@
         }
         }
     } faliure:^(NSError * _Nonnull error) {
     } faliure:^(NSError * _Nonnull error) {
         [LOADING_MANAGER removeHUD];
         [LOADING_MANAGER removeHUD];
+
     }];
     }];
 }
 }
 
 

+ 3 - 17
KulexiuForTeacher/KulexiuForTeacher/Module/Mine/Setting/PasswordModify/NewPwdModifyViewController.m

@@ -95,25 +95,10 @@
 
 
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
 - (void)veriImageCodeWithParm:(NSDictionary *)parm checkView:(VeriCheckView *)checkView {
     [LOADING_MANAGER showHUD];
     [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];
         [LOADING_MANAGER removeHUD];
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
         if ([dic ks_integerValueForKey:@"code"] == 200 && [dic ks_boolValueForKey:@"status"]) {
+            [checkView hiddView];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [LOADING_MANAGER MBShowAUTOHidingInWindow:@"验证码已发送"];
             [self codeButtonCountDown];
             [self codeButtonCountDown];
         }
         }
@@ -122,6 +107,7 @@
         }
         }
     } faliure:^(NSError * _Nonnull error) {
     } faliure:^(NSError * _Nonnull error) {
         [LOADING_MANAGER removeHUD];
         [LOADING_MANAGER removeHUD];
+
     }];
     }];
 }
 }