title: how to update current user email and password (both in user node and authentication) in firebase?
body: <p>I am trying to update my user details page(username,phno,email and password).Cant able to update the email field,incase it gets updated means not in both(user and authentication).Any hlp wil be appreciated..plz code in swift2.2</p>
  
  <p>here my <em>userDeatilsViewController</em> </p>
  
  <pre><code>class UserDetailsViewController: UIViewController {
  
  var user:UserDetails?
  let userRegister = UserInfo()
  var user_name:String?
  var first_name:String?
  var last_name:String?
  var ph_no:String?
  var e_mail:String?
  var pass_word:String?
  var activeField: UITextField?
  
  @IBOutlet var Username: UITextField!
  @IBOutlet var Firstname: UITextField!
  @IBOutlet var Lastname: UITextField!
  @IBOutlet var email: UITextField!
  @IBOutlet var phNo: UITextField!
  @IBOutlet var password: UITextField!
  
  var rootRef: FIRDatabaseReference! {
      return FIRDatabase.database().reference()
  }
  
  override func viewDidAppear(animated: Bool) {
      super.viewDidAppear(true)
  
      let userRef = FIRDatabase.database().reference().child("users")
      userRef.observeEventType(.Value, withBlock: { (snapshot)  in
  
          for userInfo in snapshot.children {
              self.user = UserDetails(snapshot: userInfo as! FIRDataSnapshot)
              print(self.user)
          }
          if let user = self.user{
              self.Username.text = user.username
              self.Firstname.text = user.firstname
              self.Lastname.text = user.lastname
              self.email.text = user.email
              self.phNo.text = user.phno
          }
      })
  
      self.navigationController?.popViewControllerAnimated(true)
  
  }
  @IBAction func reset(sender: AnyObject) {
  
      let userRef = FIRDatabase.database().reference().child("users")
  
      if Username.text == "" {
          Username.text = "enter title"
      } else {
          user_name = Username.text
      }
  
      if Firstname.text == ""{
          Firstname.text = "Firstname Missing"
      } else {
          first_name = Firstname.text
      }
  
      if Lastname.text == "" {
          Lastname.text = "Lastname Missing"
      } else {
          last_name = Lastname.text
      }
  
      if phNo.text == "" {
          phNo.text = "Phno Missing"
      } else {
          ph_no = phNo.text
      }
  
      if email.text == "" {
          email.text = "email Missing"
      } else {
        if let user = FIRAuth.auth()?.currentUser {
            user.updateEmail(email.text!, completion: { (error) in
  
              if let error = error{
                print(error.localizedDescription)
              } else {
                let alertView = UIAlertView(title: "Update Email", message: "email Updated", delegate: self, cancelButtonTitle: "Ok")
                alertView.show()
              }
           })
           self.e_mail = self.email.text
           print(self.e_mail)
        }
      }
  
      let updatenote = UserDetails(username: user_name!, firstname: first_name!, lastname: last_name!, email: e_mail!, phno: ph_no!)
  
      print(updatenote)
  
      let key = user!.ref!.key
      print(key)
  
      let updateRef = rootRef.child("/users/\(key)")
  
      updateRef.updateChildValues(updatenote.toAnyObject())
      navigationController?.popViewControllerAnimated(true)
  }
  </code></pre>