|
@@ -332,59 +332,149 @@
|
|
|
- (void)keyBoardBtnOKPressed{
|
|
|
if (pwd.length == 4){
|
|
|
/*进入下一级推拉流界面*/
|
|
|
-
|
|
|
- //是否已经有密码了 有就是输入密码 没有就是设置密码
|
|
|
- NSString *curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
|
|
|
|
|
|
- NSString*desPwdStr = [RSATool AES128Decrypt:curPwd key:AESCODEKEEYY];
|
|
|
+ [self verifyPwdFun:pwd];
|
|
|
+ return;
|
|
|
+
|
|
|
+
|
|
|
+// //是否已经有密码了 有就是输入密码 没有就是设置密码
|
|
|
+// NSString *curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
|
|
|
+//
|
|
|
+// NSString*desPwdStr = [RSATool AES128Decrypt:curPwd key:AESCODEKEEYY];
|
|
|
+//
|
|
|
+// if([desPwdStr isEqualToString:pwd]){
|
|
|
+// [connectDeviceManager shareInstance].isFirstInputPwdDone = YES;
|
|
|
+// if(_isQRCodeType){
|
|
|
+// [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
|
|
|
+// }
|
|
|
+//
|
|
|
+// dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+// [[NSNotificationCenter defaultCenter] postNotificationName:ShowImgAndVoiceNotification object:nil];
|
|
|
+// });
|
|
|
+//
|
|
|
+// //view 加载在windows上
|
|
|
+// [self.view removeFromSuperview];
|
|
|
+//
|
|
|
+// }
|
|
|
+// else{
|
|
|
+// [self deleteBoardBtnPressed];
|
|
|
+// [self deleteBoardBtnPressed];
|
|
|
+// [self deleteBoardBtnPressed];
|
|
|
+// [self deleteBoardBtnPressed];
|
|
|
+//
|
|
|
+// //[[iToast makeText:NSLocalizedString(@"logo_input_pwd_fail",nil)] show];
|
|
|
+// //[[iToast makeText:@"111"] show];
|
|
|
+//
|
|
|
+// _pwdErrorTip = [[UILabel alloc] init];
|
|
|
+// _pwdErrorTip.text = NSLocalizedString(@"logo_input_pwd_fail",nil);
|
|
|
+// _pwdErrorTip.textAlignment = NSTextAlignmentCenter;
|
|
|
+// _pwdErrorTip.textColor = [UIColor whiteColor];
|
|
|
+// _pwdErrorTip.backgroundColor = [UIColor hwColor:@"000000" alpha:0.7];
|
|
|
+// [self.view addSubview:_pwdErrorTip];
|
|
|
+//
|
|
|
+// _pwdErrorTip.layer.masksToBounds = YES;
|
|
|
+// _pwdErrorTip.layer.cornerRadius = 10;
|
|
|
+//
|
|
|
+// [_pwdErrorTip mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+// make.center.mas_equalTo(0);
|
|
|
+// make.width.mas_equalTo(200);
|
|
|
+// make.height.mas_equalTo(40.f);
|
|
|
+// }];
|
|
|
+//
|
|
|
+// ///
|
|
|
+// [NSTimer scheduledTimerWithTimeInterval:3 repeats:NO block:^(NSTimer * _Nonnull timer) {
|
|
|
+//
|
|
|
+// [self->_pwdErrorTip removeFromSuperview];
|
|
|
+// self->_pwdErrorTip = nil;
|
|
|
+// }];
|
|
|
+// }
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 验证密码是否正确
|
|
|
+-(void)verifyPwdFun:(NSString*)text
|
|
|
+{
|
|
|
+ /*先判断本地有无设备 无设备时需要先扫码添加设备*/
|
|
|
+ NSDictionary *deviceDict = [HWDataManager getObjectWithKey:Const_Have_Add_Device];
|
|
|
+ if (deviceDict && [[deviceDict allKeys] containsObject:Const_Have_Add_Device_SN]){
|
|
|
+ //有设备了先去做链接准备 // 80bec9c5
|
|
|
+ NSString *SNStr = deviceDict[@"Const_Have_Add_Device_SN"];
|
|
|
|
|
|
- if([desPwdStr isEqualToString:pwd]){
|
|
|
- [connectDeviceManager shareInstance].isFirstInputPwdDone = YES;
|
|
|
- if(_isQRCodeType){
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
|
|
|
- }
|
|
|
-
|
|
|
- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
- [[NSNotificationCenter defaultCenter] postNotificationName:ShowImgAndVoiceNotification object:nil];
|
|
|
- });
|
|
|
-
|
|
|
- //view 加载在windows上
|
|
|
- [self.view removeFromSuperview];
|
|
|
-
|
|
|
- }
|
|
|
- else{
|
|
|
- [self deleteBoardBtnPressed];
|
|
|
- [self deleteBoardBtnPressed];
|
|
|
- [self deleteBoardBtnPressed];
|
|
|
- [self deleteBoardBtnPressed];
|
|
|
-
|
|
|
- //[[iToast makeText:NSLocalizedString(@"logo_input_pwd_fail",nil)] show];
|
|
|
- //[[iToast makeText:@"111"] show];
|
|
|
-
|
|
|
- _pwdErrorTip = [[UILabel alloc] init];
|
|
|
- _pwdErrorTip.text = NSLocalizedString(@"logo_input_pwd_fail",nil);
|
|
|
- _pwdErrorTip.textAlignment = NSTextAlignmentCenter;
|
|
|
- _pwdErrorTip.textColor = [UIColor whiteColor];
|
|
|
- _pwdErrorTip.backgroundColor = [UIColor hwColor:@"000000" alpha:0.7];
|
|
|
- [self.view addSubview:_pwdErrorTip];
|
|
|
-
|
|
|
- _pwdErrorTip.layer.masksToBounds = YES;
|
|
|
- _pwdErrorTip.layer.cornerRadius = 10;
|
|
|
-
|
|
|
- [_pwdErrorTip mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
- make.center.mas_equalTo(0);
|
|
|
- make.width.mas_equalTo(200);
|
|
|
- make.height.mas_equalTo(40.f);
|
|
|
- }];
|
|
|
-
|
|
|
- ///
|
|
|
- [NSTimer scheduledTimerWithTimeInterval:3 repeats:NO block:^(NSTimer * _Nonnull timer) {
|
|
|
+ if(SNStr){
|
|
|
+ [[connectDeviceManager shareInstance] getThridMsgBySN:SNStr didNetEnd:^(bool didSuc) {
|
|
|
+
|
|
|
+ if(didSuc){
|
|
|
+ NSString *curPwd = [connectDeviceManager shareInstance].DeviceThirdIdMod.data.password;
|
|
|
+ NSString*desPwdStr = [RSATool AES128Decrypt:curPwd key:AESCODEKEEYY];
|
|
|
+
|
|
|
+ if ([desPwdStr isEqualToString:text]){
|
|
|
+ [self verifyPwdRightFun];
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [self verifyPwdWrongFun];
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ else{
|
|
|
+ [self verifyPwdWrongFun];
|
|
|
+ }
|
|
|
|
|
|
- [self->_pwdErrorTip removeFromSuperview];
|
|
|
- self->_pwdErrorTip = nil;
|
|
|
}];
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 验证密码正常
|
|
|
+-(void)verifyPwdRightFun
|
|
|
+{
|
|
|
+ [connectDeviceManager shareInstance].isFirstInputPwdDone = YES;
|
|
|
+ if(_isQRCodeType){
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:GuideOkNotification object:nil];
|
|
|
+ }
|
|
|
+
|
|
|
+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
|
|
|
+ [[NSNotificationCenter defaultCenter] postNotificationName:ShowImgAndVoiceNotification object:nil];
|
|
|
+ });
|
|
|
+
|
|
|
+ //view 加载在windows上
|
|
|
+ [self.view removeFromSuperview];
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+#pragma mark 验证密码错误
|
|
|
+-(void)verifyPwdWrongFun
|
|
|
+{
|
|
|
+ [self deleteBoardBtnPressed];
|
|
|
+ [self deleteBoardBtnPressed];
|
|
|
+ [self deleteBoardBtnPressed];
|
|
|
+ [self deleteBoardBtnPressed];
|
|
|
+
|
|
|
+ //[[iToast makeText:NSLocalizedString(@"logo_input_pwd_fail",nil)] show];
|
|
|
+ //[[iToast makeText:@"111"] show];
|
|
|
+
|
|
|
+ _pwdErrorTip = [[UILabel alloc] init];
|
|
|
+ _pwdErrorTip.text = NSLocalizedString(@"logo_input_pwd_fail",nil);
|
|
|
+ _pwdErrorTip.textAlignment = NSTextAlignmentCenter;
|
|
|
+ _pwdErrorTip.textColor = [UIColor whiteColor];
|
|
|
+ _pwdErrorTip.backgroundColor = [UIColor hwColor:@"000000" alpha:0.7];
|
|
|
+ [self.view addSubview:_pwdErrorTip];
|
|
|
+
|
|
|
+ _pwdErrorTip.layer.masksToBounds = YES;
|
|
|
+ _pwdErrorTip.layer.cornerRadius = 10;
|
|
|
+
|
|
|
+ [_pwdErrorTip mas_makeConstraints:^(MASConstraintMaker *make) {
|
|
|
+ make.center.mas_equalTo(0);
|
|
|
+ make.width.mas_equalTo(200);
|
|
|
+ make.height.mas_equalTo(40.f);
|
|
|
+ }];
|
|
|
+
|
|
|
+ ///
|
|
|
+ [NSTimer scheduledTimerWithTimeInterval:3 repeats:NO block:^(NSTimer * _Nonnull timer) {
|
|
|
+
|
|
|
+ [self->_pwdErrorTip removeFromSuperview];
|
|
|
+ self->_pwdErrorTip = nil;
|
|
|
+ }];
|
|
|
}
|
|
|
|
|
|
- (void)keyBoardBtnPressed:(id)sender{
|