@@ -29,7 +29,7 @@ @interface LoginViewController ()
2929
3030
3131@property (assign , nonatomic ) BOOL captchaNeeded;
32- @property (strong , nonatomic ) UIButton *loginBtn;
32+ @property (strong , nonatomic ) UIButton *loginBtn, *buttonFor2FA ;
3333@property (strong , nonatomic ) UIActivityIndicatorView *activityIndicator;
3434@property (strong , nonatomic ) UIImageView *iconUserView, *bgBlurredView;
3535@property (strong , nonatomic ) EaseInputTipsView *inputTipsView;
@@ -76,12 +76,30 @@ - (void)viewDidLoad
7676 tableView;
7777 });
7878
79-
8079 self.myTableView .contentInset = UIEdgeInsetsMake (-kHigher_iOS_6_1_DIS (20 ), 0 , 0 , 0 );
8180 self.myTableView .tableHeaderView = [self customHeaderView ];
8281 self.myTableView .tableFooterView =[self customFooterView ];
8382 [self configBottomView ];
8483 [self showdismissButton: self .showDismissButton];
84+ [self buttonFor2FA ];
85+ }
86+
87+ - (UIButton *)buttonFor2FA {
88+ if (!_buttonFor2FA) {
89+ _buttonFor2FA = ({
90+ UIButton *button = [[UIButton alloc ] initWithFrame: CGRectMake (kScreen_Width - 80 , 20 , 60 , 50 )];
91+ [button.titleLabel setFont: [UIFont systemFontOfSize: 14 ]];
92+ [button setTitleColor: [UIColor whiteColor ] forState: UIControlStateNormal];
93+ [button setTitleColor: [UIColor colorWithWhite: 1.0 alpha: 0.5 ] forState: UIControlStateHighlighted];
94+
95+ [button setTitle: @" 2FA" forState: UIControlStateNormal];
96+ [button setImage: [UIImage imageNamed: @" convenient_2FA" ] forState: UIControlStateNormal];
97+ button;
98+ });
99+ [_buttonFor2FA addTarget: self action: @selector (goTo2FAVC ) forControlEvents: UIControlEventTouchUpInside];
100+ [self .view addSubview: _buttonFor2FA];
101+ }
102+ return _buttonFor2FA;
85103}
86104
87105- (void )setCaptchaNeeded : (BOOL )captchaNeeded {
@@ -271,11 +289,14 @@ - (UIView *)customHeaderView{
271289}
272290
273291- (UIView *)customFooterView {
274- UIView *footerV = [[UIView alloc ] initWithFrame: CGRectMake (0 , 0 , kScreen_Width , 100 )];
292+ UIView *footerV = [[UIView alloc ] initWithFrame: CGRectMake (0 , 0 , kScreen_Width , 150 )];
275293 _loginBtn = [UIButton buttonWithStyle: StrapSuccessStyle andTitle: @" 登录" andFrame: CGRectMake (kLoginPaddingLeftWidth , 20 , kScreen_Width -kLoginPaddingLeftWidth *2 , 45 ) target: self action: @selector (sendLogin )];
276294 [footerV addSubview: _loginBtn];
277295
278296
297+
298+
299+
279300 RAC (self, loginBtn.enabled ) = [RACSignal combineLatest: @[
280301 RACObserve (self , myLogin.email),
281302 RACObserve (self , myLogin.password),
@@ -301,6 +322,24 @@ - (UIView *)customFooterView{
301322 }
302323 }
303324 }];
325+
326+ UIButton *cannotLoginBtn = ({
327+ UIButton *button = [[UIButton alloc ] initWithFrame: CGRectMake (0 , 0 , 100 , 30 )];
328+ [button.titleLabel setFont: [UIFont systemFontOfSize: 14 ]];
329+ [button setTitleColor: [UIColor colorWithWhite: 1.0 alpha: 0.5 ] forState: UIControlStateNormal];
330+ [button setTitleColor: [UIColor colorWithWhite: 0.5 alpha: 0.5 ] forState: UIControlStateHighlighted];
331+
332+ [button setTitle: @" 无法登录?" forState: UIControlStateNormal];
333+ [footerV addSubview: button];
334+ [button mas_makeConstraints: ^(MASConstraintMaker *make) {
335+ make.size .mas_equalTo (CGSizeMake (100 , 30 ));
336+ make.centerX .equalTo (footerV);
337+ make.top .equalTo (_loginBtn.mas_bottom ).offset (20 );
338+ }];
339+ button;
340+ });
341+ [cannotLoginBtn addTarget: self action: @selector (cannotLoginBtnClicked: ) forControlEvents: UIControlEventTouchUpInside];
342+
304343 return footerV;
305344}
306345
@@ -315,44 +354,22 @@ - (void)configBottomView{
315354 [button setTitleColor: [UIColor colorWithWhite: 1.0 alpha: 0.5 ] forState: UIControlStateNormal];
316355 [button setTitleColor: [UIColor colorWithWhite: 0.5 alpha: 0.5 ] forState: UIControlStateHighlighted];
317356
318- button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentRight;
319- [button setTitle: @" 新用户" forState: UIControlStateNormal];
357+ [button setTitle: @" 去注册" forState: UIControlStateNormal];
320358 [_bottomView addSubview: button];
321359 [button mas_makeConstraints: ^(MASConstraintMaker *make) {
322360 make.size .mas_equalTo (CGSizeMake (100 , 300 ));
323- make.centerY .equalTo (_bottomView);
324- make.right .equalTo (_bottomView).offset (-kLoginPaddingLeftWidth );
361+ make.center .equalTo (_bottomView);
325362 }];
326363 button;
327364 });
328-
329- UIButton *cannotLoginBtn = ({
330- UIButton *button = [[UIButton alloc ] initWithFrame: CGRectMake (0 , 0 , 100 , 30 )];
331- [button.titleLabel setFont: [UIFont systemFontOfSize: 14 ]];
332- [button setTitleColor: [UIColor colorWithWhite: 1.0 alpha: 0.5 ] forState: UIControlStateNormal];
333- [button setTitleColor: [UIColor colorWithWhite: 0.5 alpha: 0.5 ] forState: UIControlStateHighlighted];
334-
335- button.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
336- [button setTitle: @" 无法登录?" forState: UIControlStateNormal];
337- [_bottomView addSubview: button];
338- [button mas_makeConstraints: ^(MASConstraintMaker *make) {
339- make.size .mas_equalTo (CGSizeMake (100 , 300 ));
340- make.centerY .equalTo (_bottomView);
341- make.left .equalTo (_bottomView).offset (kLoginPaddingLeftWidth );
342- }];
343- button;
344- });
345-
346365 [registerBtn addTarget: self action: @selector (goRegisterVC: ) forControlEvents: UIControlEventTouchUpInside];
347- [cannotLoginBtn addTarget: self action: @selector (cannotLoginBtnClicked: ) forControlEvents: UIControlEventTouchUpInside];
348-
349366 [self .view addSubview: _bottomView];
350367 }
351368}
352369
353370#pragma mark Btn Clicked
354371- (void )sendLogin {
355- NSString *tipMsg = self.is2FAUI ? [self goToLoginTipWith2FA ]: [_myLogin goToLoginTipWithCaptcha: _captchaNeeded];
372+ NSString *tipMsg = self.is2FAUI ? [self loginTipFor2FA ]: [_myLogin goToLoginTipWithCaptcha: _captchaNeeded];
356373 if (tipMsg) {
357374 kTipAlert (@" %@ " , tipMsg);
358375 return ;
@@ -452,7 +469,7 @@ - (void)setIs2FAUI:(BOOL)is2FAUI{
452469 [self .myTableView reloadSections: [NSIndexSet indexSetWithIndex: 0 ] withRowAnimation: _is2FAUI? UITableViewRowAnimationLeft: UITableViewRowAnimationRight];
453470}
454471
455- - (NSString *)goToLoginTipWith2FA {
472+ - (NSString *)loginTipFor2FA {
456473 NSString *tipStr = nil ;
457474 if (self.otpCode .length <= 0 ) {
458475 tipStr = @" 动态验证码不能为空" ;
@@ -461,4 +478,9 @@ - (NSString *)goToLoginTipWith2FA{
461478 }
462479 return tipStr;
463480}
481+
482+ - (void )goTo2FAVC {
483+ OTPListViewController *vc = [OTPListViewController new ];
484+ [self .navigationController pushViewController: vc animated: YES ];
485+ }
464486@end
0 commit comments