ConfirmForgetPassViewController.m
1.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
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