| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- //
- // SignUpViewController.m
- // HMLG Scan Order
- //
- // Created by Rui Zhang on 4/7/22.
- // Copyright © 2022 United Software Applications, Inc. All rights reserved.
- //
- #import "SignUpViewController.h"
- #import "RAUtils.h"
- #import "RADataProvider.h"
- @interface SignUpViewController ()
- @end
- @implementation SignUpViewController
- - (void)viewDidLoad {
- [super viewDidLoad];
- // Do any additional setup after loading the view.
- }
- - (IBAction)onSignUpClick:(id)sender {
-
- NSString* user = self.editUser.text;
- NSString* email = self.editEmail.text;
- NSString* pwd = self.editpwd.text;
- NSString* cpwd = self.editcpwd.text;
-
- if(![RAUtils validateEmail:email])
- {
- [RAUtils message_alert:@"Email invalidate" title:@"Warrning" controller:self];
- return;
- }
- if(![RAUtils checkPassword:pwd])
- {
- [RAUtils message_alert:@"Password must be 8-16 characters and contain numbers and letters." title:@"Warrning" controller:self];
- return;
- }
- if(![pwd isEqualToString:cpwd])
- {
- [RAUtils message_alert:@"Password does not equal" title:@"Warrning" controller:self];
- return;
- }
- __block UIAlertController * waitalert =[RAUtils waiting_alert:self title:@"Sign Up" completion:nil];
-
- dispatch_async(dispatch_get_main_queue(), ^{
- [RADataProvider request_sign_up:user email:email password:pwd completionHandler:^(NSMutableDictionary *result) {
- [waitalert dismissViewControllerAnimated:true completion:^{
- NSMutableDictionary* return_json = result;
- if([[return_json valueForKey:@"result"] intValue]==2)
- {
-
- [RAUtils message_alert:@"Sign Up Successful" title:@"Sign Up" controller:self action_handler:^(UIAlertAction * _Nonnull action) {
- [self dismissViewControllerAnimated:true completion:nil];
- } completion:nil];
- }
- else
- {
- [RAUtils message_alert:[return_json valueForKey:@"err_msg"] title:@"Sign Up" controller:self] ;
- }
- }];
- }];
- });
-
- }
- - (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
|