1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- #import "SKEnterPassWordViewController.h"
- @implementation SKEnterPassWordViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- [self.navigationController setNavigationBarHidden:NO];
- if (@available(iOS 11.0, *)) {
- [self.navigationItem setLargeTitleDisplayMode:UINavigationItemLargeTitleDisplayModeAlways];
- self.edgesForExtendedLayout = UIRectEdgeAll;
- }
- [self setNavigationBarColor:1];
- }
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- [self.navigationController setNavigationBarHidden:NO];
- self.title = NSLocalizedString(@"Enter.Passcode.Title", nil);//@"重置密码";
- }
- - (void)viewWillDisappear:(BOOL)animated {
- [super viewWillDisappear:animated];
- self.title = @"";
- }
- - (IBAction)confirmAction:(id)sender{
- [[UIApplication sharedApplication].keyWindow endEditing:YES];
- if ([self checkAccountPasswordTextField] == NO)
- return;
-
- int area = [UserDataHelper getSelectArea];
- if (area == 0) {
- [self requstPhonePwd];
- } else {
- [self requstEmailPwd];
- }
- }
- #pragma mark - Requst
- - (void)requstPhonePwd {
- NSDictionary *param = @{
- @"areaCode":_mAreaCode,
- @"phoneNumber":_mAccount,
- @"newPassword":self.mPwdNewTextField.text,
- @"captcha":_mCaptcha,
- };
- [self ShowHUBWithText:NSLocalizedString(@"Loading...", nil)];//@"加载中..."];
- [ERequest httpRequest:param httpURL:URL_PWD_FORGET httpMethod:@"POST" httpEncrypt:NO onSuccess:^(NSDictionary *result) {
- if ([ERequest isSuccessWithResult:result]) {
- [EasyTextView showSuccessText:NSLocalizedString(@"Reset.Passcode.Done", nil)];//@"重置密码完成!"];
- [UserDataHelper setUserPassword:@"" ForUser:[UserDataHelper getUserName]];
- [self popMoreViewController:2];
- } else {
- [self HiddenHUB];
- [EasyTextView showErrorText:result[@"message"]];
- }
- NSLog(@"注册返回结果:%@", result);
- } onFailure:^(NSError *error) {
- [self HiddenHUB];
- [EasyTextView showErrorText:NSLocalizedString(@"Network.Error", nil)];
- }];
- }
- - (void)requstEmailPwd {
- NSDictionary *param = @{
- @"email":_mAccount,
- @"password":self.mPwdNewTextField.text,
- @"captcha":_mCaptcha,
- };
- [self ShowHUBWithText:NSLocalizedString(@"Loading...", nil)];//@"加载中..."];
- [ERequest httpRequest:param httpURL:URL_PWD_FORGET httpMethod:@"PUT" httpEncrypt:NO onSuccess:^(NSDictionary *result) {
- if ([ERequest isSuccessWithResult:result]) {
- [EasyTextView showSuccessText:NSLocalizedString(@"Reset.Passcode.Done", nil)];//@"重置密码完成!"];
- [UserDataHelper setUserPassword:@"" ForUser:[UserDataHelper getUserName]];
- [self popMoreViewController:2];
- } else {
- [self HiddenHUB];
- [EasyTextView showErrorText:result[@"message"]];
- }
- NSLog(@"注册返回结果:%@", result);
- } onFailure:^(NSError *error) {
- [self HiddenHUB];
- [EasyTextView showErrorText:NSLocalizedString(@"Network.Error", nil)];
- }];
- }
- @end
|