Advertisement
Guest User

Untitled

a guest
Jan 17th, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. func forgotPasswordTapped(with sender: LoginView) {
  2.  
  3. 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)
  4. let sendAction = UIAlertAction(title: "Send", style: .default) { (action) in
  5. let emailField = alertController.textFields![0]
  6. if let email = emailField.text {
  7. FIRAuth.auth()?.sendPasswordReset(withEmail: email, completion: { (error) in
  8. if let error = error {
  9. let alertController = UIAlertController(title: "Error", message: "\(error.localizedDescription)", preferredStyle: .alert)
  10. let okAction = UIAlertAction(title: "Ok", style: .default, handler: nil)
  11. alertController.addAction(okAction)
  12. self.present(alertController, animated: true, completion: nil)
  13. } else {
  14. UserNotification.show("Password reset e-mail sent")
  15. }
  16. })
  17. }
  18. }
  19. let cancelAction = UIAlertAction(title: "Cancel", style: .default, handler: nil)
  20. alertController.addAction(sendAction)
  21. alertController.addAction(cancelAction)
  22. alertController.addTextField { (textfield) in
  23. textfield.placeholder = "Enter E-mail address"
  24. }
  25.  
  26. self.present(alertController, animated: true, completion: nil)
  27.  
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement