| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
- //
- // ChangePasswordViewController.m
- // HMLG Scan Order
- //
- // Created by Rui Zhang on 4/8/22.
- // Copyright © 2022 United Software Applications, Inc. All rights reserved.
- //
- #import "ChangePasswordViewController.h"
- #import "AppDelegate.h"
- #import "RAUtils.h"
- #import "RADataProvider.h"
- @interface ChangePasswordViewController ()
- @end
- @implementation ChangePasswordViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- }
- - (IBAction)onChangeClick:(id)sender {
-
- // UIApplication * app = [UIApplication sharedApplication];
- // AppDelegate *appDelegate = (AppDelegate *)[app delegate];
- NSString* opwd = self.editopwd.text;
-
- NSString* pwd = self.editnpwd.text;
- NSString* cpwd = self.editcpwd.text;
-
- if(![opwd isEqualToString: RASingleton.sharedInstance.password])
- {
-
-
- [RAUtils message_box:@"Warrning" message:@"Password incorrect." completion:nil];
- return;
- }
- if(![RAUtils checkPassword:pwd])
- {
- [RAUtils message_box:@"Warrning" message:@"Password must be 8-16 characters and contain numbers and letters." completion:nil];
-
-
- return;
- }
- if(![pwd isEqualToString:cpwd])
- {
- [RAUtils message_box:@"Warrning" message:@"Password does not equal" completion:nil];
-
-
- return;
- }
- // __block UIAlertController * waitalert =[RAUtils waiting_alert:self title:@"Change Password" completion:nil];
- PopWaitAlert* pop = [RAUtils waiting_pop:@"Change Password" completion:nil];
- dispatch_async(dispatch_get_main_queue(), ^{
- [RADataProvider request_change_password:pwd completionHandler:^(NSMutableDictionary *result) {
- // [waitalert dismissViewControllerAnimated:true completion:^{
- [pop hide];
- NSMutableDictionary* return_json = result;
- if([[return_json valueForKey:@"result"] intValue]==2)
- {
- [RAUtils message_box:@"Change Password" message:@"Successful" completion:^{
- RASingleton.sharedInstance.password = pwd;
- [self dismissViewControllerAnimated:true completion:nil];
-
-
- }];
-
- }
- else
- {
- [RAUtils message_box:@"Change Password" message:[return_json valueForKey:@"err_msg"] completion:nil];
- }
- // }];
- }];
- });
- }
- - (IBAction)onCloseClick:(id)sender {
- [self dismissViewControllerAnimated:true completion:nil];
- }
- /*
- #pragma mark - Navigation
- // In a storyboard-based application, you will often want to do a little preparation before navigation
- - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
- // Get the new view controller using [segue destinationViewController].
- // Pass the selected object to the new view controller.
- }
- */
- @end
|