|
@@ -23,6 +23,7 @@
|
|
|
@property (nonatomic,strong) UILabel *tipLabel;///<提示标签
|
|
@property (nonatomic,strong) UILabel *tipLabel;///<提示标签
|
|
|
@property (nonatomic,copy) NSString *password;///<密码
|
|
@property (nonatomic,copy) NSString *password;///<密码
|
|
|
@property (nonatomic,strong) UIButton *forgottenButton;
|
|
@property (nonatomic,strong) UIButton *forgottenButton;
|
|
|
|
|
+@property (nonatomic,strong) UIButton *resetButton;
|
|
|
@property (nonatomic,strong) NSMutableArray *dotArray;///<密码视图
|
|
@property (nonatomic,strong) NSMutableArray *dotArray;///<密码视图
|
|
|
@property (nonatomic,copy) NSString *input;///<输入
|
|
@property (nonatomic,copy) NSString *input;///<输入
|
|
|
@property (nonatomic,assign) NSUInteger index;///<输入了多少位
|
|
@property (nonatomic,assign) NSUInteger index;///<输入了多少位
|
|
@@ -178,9 +179,13 @@
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// forget
|
|
// forget
|
|
|
- self.forgottenButton.frame = CGRectMake(width - 100, height - 70, 80, 40);
|
|
|
|
|
|
|
+ self.forgottenButton.frame = CGRectMake(width - 120, height - 40, 120, 40);
|
|
|
[self.view addSubview:self.forgottenButton];
|
|
[self.view addSubview:self.forgottenButton];
|
|
|
|
|
|
|
|
|
|
+ // reset
|
|
|
|
|
+ self.resetButton.frame = CGRectMake(0, height - 40, 120, 40);
|
|
|
|
|
+ [self.view addSubview:self.resetButton];
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- (void)loadPassword {
|
|
- (void)loadPassword {
|
|
@@ -212,7 +217,7 @@
|
|
|
- (UIButton *)forgottenButton {
|
|
- (UIButton *)forgottenButton {
|
|
|
if (!_forgottenButton) {
|
|
if (!_forgottenButton) {
|
|
|
_forgottenButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
_forgottenButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
- [_forgottenButton setTitle:@"forget" forState:UIControlStateNormal];
|
|
|
|
|
|
|
+ [_forgottenButton setTitle:@"forget password" forState:UIControlStateNormal];
|
|
|
[_forgottenButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
|
|
[_forgottenButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
|
|
|
_forgottenButton.tag = View_Tag + 2;
|
|
_forgottenButton.tag = View_Tag + 2;
|
|
|
_forgottenButton.titleLabel.font = [UIFont systemFontOfSize:14.0f];
|
|
_forgottenButton.titleLabel.font = [UIFont systemFontOfSize:14.0f];
|
|
@@ -221,6 +226,17 @@
|
|
|
return _forgottenButton;
|
|
return _forgottenButton;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+- (UIButton *)resetButton {
|
|
|
|
|
+ if (!_resetButton) {
|
|
|
|
|
+ _resetButton = [UIButton buttonWithType:UIButtonTypeCustom];
|
|
|
|
|
+ [_resetButton setTitle:@"reset password" forState:UIControlStateNormal];
|
|
|
|
|
+ [_resetButton setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
|
|
|
|
|
+ _resetButton.tag = View_Tag + 2;
|
|
|
|
|
+ _resetButton.titleLabel.font = [UIFont systemFontOfSize:14.0f];
|
|
|
|
|
+ [_resetButton addTarget:self action:@selector(resetButtonClick:) forControlEvents:UIControlEventTouchUpInside];
|
|
|
|
|
+ }
|
|
|
|
|
+ return _resetButton;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
- (NSMutableArray *)dotArray {
|
|
- (NSMutableArray *)dotArray {
|
|
|
if (!_dotArray) {
|
|
if (!_dotArray) {
|
|
@@ -277,6 +293,72 @@
|
|
|
return YES;
|
|
return YES;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
+ messageBoxController.textHandler = ^(NSString *text){
|
|
|
|
|
+
|
|
|
|
|
+ AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
|
|
|
+
|
|
|
|
|
+ if ([text isEqualToString:appDelegate.password]) {
|
|
|
|
|
+
|
|
|
|
|
+// [[NSUserDefaults standardUserDefaults] removeObjectForKey:self.passwordKey];
|
|
|
|
|
+// weakself.password = nil;
|
|
|
|
|
+ weakself.index = 0;
|
|
|
|
|
+ weakself.input = @"";
|
|
|
|
|
+ for (JKDotView *dot in self.dotArray) {
|
|
|
|
|
+ dot.state = JKDotStateNormal;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+// weakself.tipLabel.text = @"Please Set A New Password";
|
|
|
|
|
+ [weakVC dismissViewControllerAnimated:YES completion:^{
|
|
|
|
|
+// weakself.tipLabel.text = @"Please Set A New Password";
|
|
|
|
|
+
|
|
|
|
|
+ UIAlertController *alertController = [UIAlertController alertControllerWithTitle:@"Your Current Password" message:weakself.password preferredStyle:UIAlertControllerStyleAlert];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ UIAlertAction *action = [UIAlertAction actionWithTitle:@"ok" style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
|
|
|
|
|
+
|
|
|
|
|
+ if (alertController.navigationController) {
|
|
|
|
|
+ [alertController.navigationController popViewControllerAnimated:YES];
|
|
|
|
|
+ } else {
|
|
|
|
|
+ [alertController dismissViewControllerAnimated:YES completion:nil];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+ [alertController addAction:action];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ [weakself presentViewController:alertController animated:YES completion:nil];
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }];
|
|
|
|
|
+
|
|
|
|
|
+ } else {
|
|
|
|
|
+
|
|
|
|
|
+ [weakVC warning:@"It's wrong,please try again"];
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
|
|
+ [self presentViewController:messageBoxController animated:YES completion:nil];
|
|
|
|
|
+
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (void)resetButtonClick:(UIButton *)sender {
|
|
|
|
|
+ JKMessageBoxController *messageBoxController = [JKMessageBoxController messageBoxControllerWithTip:@"Please enter your login password"];
|
|
|
|
|
+
|
|
|
|
|
+ __weak typeof(messageBoxController) weakVC = messageBoxController;
|
|
|
|
|
+ __weak typeof(self) weakself = self;
|
|
|
|
|
+
|
|
|
|
|
+ messageBoxController.changeHandler = ^(UITextField *textField,NSRange range,NSString *string) {
|
|
|
|
|
+
|
|
|
|
|
+ return YES;
|
|
|
|
|
+ };
|
|
|
|
|
+
|
|
|
messageBoxController.textHandler = ^(NSString *text){
|
|
messageBoxController.textHandler = ^(NSString *text){
|
|
|
|
|
|
|
|
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
AppDelegate *appDelegate = (AppDelegate *)[UIApplication sharedApplication].delegate;
|
|
@@ -287,10 +369,14 @@
|
|
|
weakself.password = nil;
|
|
weakself.password = nil;
|
|
|
weakself.index = 0;
|
|
weakself.index = 0;
|
|
|
weakself.input = @"";
|
|
weakself.input = @"";
|
|
|
|
|
+ for (JKDotView *dot in self.dotArray) {
|
|
|
|
|
+ dot.state = JKDotStateNormal;
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
weakself.tipLabel.text = @"Please Set A New Password";
|
|
weakself.tipLabel.text = @"Please Set A New Password";
|
|
|
[weakVC dismissViewControllerAnimated:YES completion:^{
|
|
[weakVC dismissViewControllerAnimated:YES completion:^{
|
|
|
weakself.tipLabel.text = @"Please Set A New Password";
|
|
weakself.tipLabel.text = @"Please Set A New Password";
|
|
|
|
|
+
|
|
|
}];
|
|
}];
|
|
|
|
|
|
|
|
} else {
|
|
} else {
|
|
@@ -305,7 +391,6 @@
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
[self presentViewController:messageBoxController animated:YES completion:nil];
|
|
[self presentViewController:messageBoxController animated:YES completion:nil];
|
|
|
-
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|