Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func forgotPasswordTapped(with sender: LoginView) {
- let alertController = UIAlertController(title: "Forgot My Password", message: "Enter your email address so we can send you info on how to reset your password.", preferredStyle: .alert)
- let sendAction = UIAlertAction(title: "Send", style: .default) { (action) in
- let emailField = alertController.textFields![0]
- if let email = emailField.text {
- FIRAuth.auth()?.sendPasswordReset(withEmail: email, completion: { (error) in
- if let error = error {
- let alertController = UIAlertController(title: "Error", message: "\(error.localizedDescription)", preferredStyle: .alert)
- let okAction = UIAlertAction(title: "Ok", style: .default, handler: nil)
- alertController.addAction(okAction)
- self.present(alertController, animated: true, completion: nil)
- } else {
- UserNotification.show("Password reset e-mail sent")
- }
- })
- }
- }
- let cancelAction = UIAlertAction(title: "Cancel", style: .default, handler: nil)
- alertController.addAction(sendAction)
- alertController.addAction(cancelAction)
- alertController.addTextField { (textfield) in
- textfield.placeholder = "Enter E-mail address"
- }
- self.present(alertController, animated: true, completion: nil)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement