From 915e7d0c7ae8d56474c852a2d57ed9c9d68a781c Mon Sep 17 00:00:00 2001 From: phongnv Date: Wed, 2 Aug 2017 21:29:18 +0700 Subject: [PATCH] update api register --- LifeLog/LifeLog/ConfirmForgetPassViewController.h | 13 +++++ LifeLog/LifeLog/ConfirmForgetPassViewController.m | 56 ++++++++++++++++++++++ .../LifeLog/ConfirmForgetPassViewController.xib | 53 ++++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 LifeLog/LifeLog/ConfirmForgetPassViewController.h create mode 100644 LifeLog/LifeLog/ConfirmForgetPassViewController.m create mode 100644 LifeLog/LifeLog/ConfirmForgetPassViewController.xib diff --git a/LifeLog/LifeLog/ConfirmForgetPassViewController.h b/LifeLog/LifeLog/ConfirmForgetPassViewController.h new file mode 100644 index 0000000..8e01517 --- /dev/null +++ b/LifeLog/LifeLog/ConfirmForgetPassViewController.h @@ -0,0 +1,13 @@ +// +// ConfirmForgetPassViewController.h +// LifeLog +// +// Created by Panasonic R&D Center Vietnam on 8/2/17. +// Copyright © 2017 PhongNV. All rights reserved. +// + +#import + +@interface ConfirmForgetPassViewController : UIViewController +@property (nonatomic, strong) NSString *email; +@end diff --git a/LifeLog/LifeLog/ConfirmForgetPassViewController.m b/LifeLog/LifeLog/ConfirmForgetPassViewController.m new file mode 100644 index 0000000..c627465 --- /dev/null +++ b/LifeLog/LifeLog/ConfirmForgetPassViewController.m @@ -0,0 +1,56 @@ +// +// ConfirmForgetPassViewController.m +// LifeLog +// +// Created by Panasonic R&D Center Vietnam on 8/2/17. +// Copyright © 2017 PhongNV. All rights reserved. +// + +#import "ConfirmForgetPassViewController.h" +#import "ServerAPI.h" +#import "Utilities.h" + +@interface ConfirmForgetPassViewController () +@property (nonatomic, weak) IBOutlet UITextField *tfConfirm; +@property (nonatomic, weak) IBOutlet UIButton *btnConfirm; +@end + +@implementation ConfirmForgetPassViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. + self.title = @"Confirm Forget Password"; + + [self.view addConstraint:[NSLayoutConstraint constraintWithItem:self.topLayoutGuide attribute:NSLayoutAttributeBottom relatedBy:NSLayoutRelationEqual toItem:self.tfConfirm attribute:NSLayoutAttributeTop multiplier:1 constant:-30]]; +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +- (IBAction)buttonConfirmTouchUpInside:(id)sender { + if (_tfConfirm.text.length > 0) { + ConfirmForgetPassViewController __weak *weakSelf = self; + [[ServerAPI server] confirmForgetPass:self.email withConfirm:self.tfConfirm.text CompletionHandler:^(NSError *error) { + if (error == nil) { + // back screen Login + dispatch_async(dispatch_get_main_queue(), ^{ + [weakSelf.navigationController popViewControllerAnimated:YES]; + }); + } + else { + dispatch_async(dispatch_get_main_queue(), ^{ + NSString *message = [error.userInfo objectForKey:@"message"]; + [Utilities showErrorMessage:message withViewController:weakSelf]; + }); + } + }]; + } + else { + [Utilities showErrorMessage:@"Please input code confirm" withViewController:self]; + } +} + +@end diff --git a/LifeLog/LifeLog/ConfirmForgetPassViewController.xib b/LifeLog/LifeLog/ConfirmForgetPassViewController.xib new file mode 100644 index 0000000..362cc4b --- /dev/null +++ b/LifeLog/LifeLog/ConfirmForgetPassViewController.xib @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- 1.8.5.3