diff --git a/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate b/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate index 9f17d05..0832d3d 100644 Binary files a/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate and b/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ManagerDemo/Common/ManagerUtil.h b/ManagerDemo/Common/ManagerUtil.h index e91c4ed..7501f33 100644 --- a/ManagerDemo/Common/ManagerUtil.h +++ b/ManagerDemo/Common/ManagerUtil.h @@ -56,4 +56,6 @@ //时间戳转时间 +(NSString*)timeFromtimeSp:(NSString*)timeSp; +//md5加密 ++(NSString*)md5:(NSString *)str; @end diff --git a/ManagerDemo/Common/ManagerUtil.m b/ManagerDemo/Common/ManagerUtil.m index a27f70d..6ffe7ce 100644 --- a/ManagerDemo/Common/ManagerUtil.m +++ b/ManagerDemo/Common/ManagerUtil.m @@ -9,6 +9,7 @@ #import "ManagerUtil.h" #import "LoginViewController.h" #import "AppDelegate.h" +#import @implementation ManagerUtil @@ -182,4 +183,18 @@ NSDate * date = [NSDate dateWithTimeIntervalSince1970:[timeSp floatValue]]; return [formatter stringFromDate:date]; } + ++ (NSString *)md5:(NSString *)str +{ + const char *cStr = [str UTF8String]; + unsigned char result[16]; + CC_MD5(cStr, strlen(cStr), result); // This is the md5 call + return [NSString stringWithFormat: + @"%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x", + result[0], result[1], result[2], result[3], + result[4], result[5], result[6], result[7], + result[8], result[9], result[10], result[11], + result[12], result[13], result[14], result[15] + ]; +} @end diff --git a/ManagerDemo/MainView/LoginView/InputPassWordViewController.m b/ManagerDemo/MainView/LoginView/InputPassWordViewController.m index 03edc18..713b8f4 100644 --- a/ManagerDemo/MainView/LoginView/InputPassWordViewController.m +++ b/ManagerDemo/MainView/LoginView/InputPassWordViewController.m @@ -57,7 +57,7 @@ if (_passwordTextField.text.length>0 && _phoneNum.length>0) { [MBProgressHUD hudWithView:self.view label:@"安全加载中"]; DaiDaiTongTestApi* daiDaiTongTestApi = [DaiDaiTongTestApi shareInstance]; - [daiDaiTongTestApi getApiWithParam:[NSDictionary dictionaryWithObjectsAndKeys:_phoneNum,@"phoneNum",_passwordTextField.text, @"loginPsw", nil] withApiType:@"loginByPsw" completionBlock:^(id jsonRes) { + [daiDaiTongTestApi getApiWithParam:[NSDictionary dictionaryWithObjectsAndKeys:_phoneNum,@"phoneNum",[ManagerUtil md5:_passwordTextField.text], @"loginPsw", nil] withApiType:@"loginByPsw" completionBlock:^(id jsonRes) { if (!([[jsonRes objectForKey:@"resultflag"] integerValue] == 0)) { [MBProgressHUD errorHudWithView:self.view label:[jsonRes objectForKey:@"resultMsg"] hidesAfter:0.5]; diff --git a/ManagerDemo/MainView/LoginView/SetPassWordViewController.m b/ManagerDemo/MainView/LoginView/SetPassWordViewController.m index 95a5cfe..2bc656e 100644 --- a/ManagerDemo/MainView/LoginView/SetPassWordViewController.m +++ b/ManagerDemo/MainView/LoginView/SetPassWordViewController.m @@ -28,6 +28,7 @@ { [super viewDidLoad]; // Do any additional setup after loading the view from its nib. + if (_type == 0) { self.navigationItem.title = @"设置登录密码"; }else{ @@ -118,13 +119,15 @@ if (_type == 0 ) { DaiDaiTongTestApi* daiDaiTongTestApi = [DaiDaiTongTestApi shareInstance]; - [daiDaiTongTestApi getApiWithParam:[NSDictionary dictionaryWithObjectsAndKeys:_passWordTextField.text,@"loginPsw", nil] withApiType:@"setLoginPsw" completionBlock:^(id jsonRes) { + [daiDaiTongTestApi getApiWithParam:[NSDictionary dictionaryWithObjectsAndKeys:[ManagerUtil md5:_passWordTextField.text],@"loginPsw", nil] withApiType:@"setLoginPsw" completionBlock:^(id jsonRes) { + [MBProgressHUD hideAllHUDsForView:self.view animated:YES]; if (!([[jsonRes objectForKey:@"resultflag"] integerValue] == 0)) { [MBProgressHUD errorHudWithView:self.view label:[jsonRes objectForKey:@"resultMsg"] hidesAfter:0.5]; }else{ [self.navigationController dismissViewControllerAnimated:YES completion:^{ }]; + [self.navigationController popViewControllerAnimated:YES]; } } failedBlock:^(NSError *error) { @@ -132,8 +135,10 @@ }]; }else{ + DaiDaiTongTestApi* daiDaiTongTestApi = [DaiDaiTongTestApi shareInstance]; - [daiDaiTongTestApi getApiWithParam:[NSDictionary dictionaryWithObjectsAndKeys:_passWordTextField.text,@"tradePsw", nil] withApiType:@"setTradePsw" completionBlock:^(id jsonRes) { + [daiDaiTongTestApi getApiWithParam:[NSDictionary dictionaryWithObjectsAndKeys:[ManagerUtil md5:_passWordTextField.text],@"tradePsw", nil] withApiType:@"setTradePsw" completionBlock:^(id jsonRes) { + [MBProgressHUD hideAllHUDsForView:self.view animated:YES]; if (!([[jsonRes objectForKey:@"resultflag"] integerValue] == 0)) { [MBProgressHUD errorHudWithView:self.view label:[jsonRes objectForKey:@"resultMsg"] hidesAfter:0.5]; }else{ diff --git a/ManagerDemo/MainView/LoginView/SetPassWordViewController.xib b/ManagerDemo/MainView/LoginView/SetPassWordViewController.xib index 8bf46da..6a8c081 100644 --- a/ManagerDemo/MainView/LoginView/SetPassWordViewController.xib +++ b/ManagerDemo/MainView/LoginView/SetPassWordViewController.xib @@ -18,26 +18,26 @@ - + - +