-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForgotPasswordViewController.swift
52 lines (38 loc) · 1.52 KB
/
ForgotPasswordViewController.swift
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
//
// ForgotPasswordViewController.swift
// Inaldo&Tony
//
// Created by Davide Cifariello on 11/01/18.
// Copyright © 2018 Antonio Sirica. All rights reserved.
//
import UIKit
import FirebaseAuth
class ForgotPasswordViewController: UIViewController, UITextFieldDelegate {
@IBOutlet weak var emailTextField: RoundedUITextField!
override func viewDidLoad() {
super.viewDidLoad()
self.navigationController?.isNavigationBarHidden = false
// Do any additional setup after loading the view.
}
@IBAction func sendRecoverEmail(_ sender: Any) {
guard let text = emailTextField.text else {return}
Auth.auth().sendPasswordReset(withEmail: text) { error in
if error != nil
{
AlertController.showAlert(inViewController: self, title: "Email unknown", message: "There is no account with this email")
} else
{
AlertController.showAlert(inViewController: self, title: "Password restored", message: "Check your email box to reset your password") }
}
}
override func viewWillAppear(_ animated: Bool) {
navigationController?.isNavigationBarHidden = false
}
func textFieldShouldReturn(_ textField: UITextField) -> Bool {
textField.resignFirstResponder()
return true
}
@IBAction func tapGesture(_ sender: Any) {
self.view.endEditing(true)
}
}