-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathDBCreateAccountViewController.m
51 lines (38 loc) · 2.03 KB
/
DBCreateAccountViewController.m
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
//
// DBCreateAccountViewController.m
// Zxcvbn
//
// Created by Leah Culver on 2/22/14.
// Copyright (c) 2014 Dropbox. All rights reserved.
//
#import "DBCreateAccountViewController.h"
#import <Zxcvbn/DBPasswordStrengthMeterView.h>
@interface DBCreateAccountViewController () <DBPasswordStrengthMeterViewDelegate>
@property (weak, nonatomic) IBOutlet UITextField *firstNameTextField;
@property (weak, nonatomic) IBOutlet UITextField *lastNameTextField;
@property (weak, nonatomic) IBOutlet UITextField *emailTextField;
@property (weak, nonatomic) IBOutlet DBPasswordStrengthMeterView *passwordStrengthMeterView;
@end
@implementation DBCreateAccountViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.passwordStrengthMeterView.delegate = self;
}
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
{
NSString *password = [textField.text stringByReplacingCharactersInRange:range withString:string];
[self.passwordStrengthMeterView scorePassword:password userInputs:@[self.firstNameTextField.text,
self.lastNameTextField.text,
self.emailTextField.text]];
return YES;
}
- (void)passwordStrengthMeterViewTapped:(DBPasswordStrengthMeterView *)passwordStrengthMeterView
{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:nil
message:@"Good passwords are hard to guess. Use uncommon words or inside jokes, non-standard uPPercasing, creative spelling, and non-obvious numbers and symbols."
preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction:[UIAlertAction actionWithTitle:@"Okay" style:UIAlertActionStyleDefault handler:nil]];
[self presentViewController:alertController animated:YES completion:nil];
}
@end