| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596 |
- //
- // 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_box:@"Warrning" message:@"Email invalidate" 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:@"Sign Up" completion:nil];
-
- PopWaitAlert * pop = [RAUtils waiting_pop:@"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:^{
-
- [pop hide];
- NSMutableDictionary* return_json = result;
- if([[return_json valueForKey:@"result"] intValue]==2)
- {
-
- [RAUtils message_box:@"Sign Up" message:@"Sign Up Successful" completion:^{
- [self dismissViewControllerAnimated:true completion:nil];
- }];
-
- }
- else
- {
- [RAUtils message_box:@"Sign Up" 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
|