SKEnterPassWordViewController.m 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #import "SKEnterPassWordViewController.h"
  2. @implementation SKEnterPassWordViewController
  3. - (void)viewDidLoad {
  4. [super viewDidLoad];
  5. // Do any additional setup after loading the view.
  6. [self.navigationController setNavigationBarHidden:NO];
  7. if (@available(iOS 11.0, *)) {
  8. [self.navigationItem setLargeTitleDisplayMode:UINavigationItemLargeTitleDisplayModeAlways];
  9. self.edgesForExtendedLayout = UIRectEdgeAll;
  10. }
  11. [self setNavigationBarColor:1];
  12. }
  13. - (void)viewWillAppear:(BOOL)animated {
  14. [super viewWillAppear:animated];
  15. [self.navigationController setNavigationBarHidden:NO];
  16. self.title = NSLocalizedString(@"Enter.Passcode.Title", nil);//@"重置密码";
  17. }
  18. - (void)viewWillDisappear:(BOOL)animated {
  19. [super viewWillDisappear:animated];
  20. self.title = @"";
  21. }
  22. - (IBAction)confirmAction:(id)sender{
  23. [[UIApplication sharedApplication].keyWindow endEditing:YES];
  24. if ([self checkAccountPasswordTextField] == NO)
  25. return;
  26. int area = [UserDataHelper getSelectArea];
  27. if (area == 0) {
  28. [self requstPhonePwd];
  29. } else {
  30. [self requstEmailPwd];
  31. }
  32. }
  33. #pragma mark - Requst
  34. - (void)requstPhonePwd {
  35. NSDictionary *param = @{
  36. @"areaCode":_mAreaCode,
  37. @"phoneNumber":_mAccount,
  38. @"newPassword":self.mPwdNewTextField.text,
  39. @"captcha":_mCaptcha,
  40. };
  41. [self ShowHUBWithText:NSLocalizedString(@"Loading...", nil)];//@"加载中..."];
  42. [ERequest httpRequest:param httpURL:URL_PWD_FORGET httpMethod:@"POST" httpEncrypt:NO onSuccess:^(NSDictionary *result) {
  43. if ([ERequest isSuccessWithResult:result]) {
  44. [EasyTextView showSuccessText:NSLocalizedString(@"Reset.Passcode.Done", nil)];//@"重置密码完成!"];
  45. [UserDataHelper setUserPassword:@"" ForUser:[UserDataHelper getUserName]];
  46. [self popMoreViewController:2];
  47. } else {
  48. [self HiddenHUB];
  49. [EasyTextView showErrorText:result[@"message"]];
  50. }
  51. NSLog(@"注册返回结果:%@", result);
  52. } onFailure:^(NSError *error) {
  53. [self HiddenHUB];
  54. [EasyTextView showErrorText:NSLocalizedString(@"Network.Error", nil)];
  55. }];
  56. }
  57. - (void)requstEmailPwd {
  58. NSDictionary *param = @{
  59. @"email":_mAccount,
  60. @"password":self.mPwdNewTextField.text,
  61. @"captcha":_mCaptcha,
  62. };
  63. [self ShowHUBWithText:NSLocalizedString(@"Loading...", nil)];//@"加载中..."];
  64. [ERequest httpRequest:param httpURL:URL_PWD_FORGET httpMethod:@"PUT" httpEncrypt:NO onSuccess:^(NSDictionary *result) {
  65. if ([ERequest isSuccessWithResult:result]) {
  66. [EasyTextView showSuccessText:NSLocalizedString(@"Reset.Passcode.Done", nil)];//@"重置密码完成!"];
  67. [UserDataHelper setUserPassword:@"" ForUser:[UserDataHelper getUserName]];
  68. [self popMoreViewController:2];
  69. } else {
  70. [self HiddenHUB];
  71. [EasyTextView showErrorText:result[@"message"]];
  72. }
  73. NSLog(@"注册返回结果:%@", result);
  74. } onFailure:^(NSError *error) {
  75. [self HiddenHUB];
  76. [EasyTextView showErrorText:NSLocalizedString(@"Network.Error", nil)];
  77. }];
  78. }
  79. @end