                     print("save login erro = \(err)")
                     return
                 }
-
+                self.emailTextField.resignFirstResponder()
+                self.nameTextField.resignFirstResponder()
+                self.passwordTextField.resignFirstResponder()
                 self.dismissViewControllerAnimated(true, completion: nil)
             })
 
         })
     }
-
+    private func errorAlertWithMessage(title: String, message: String) {
+        let alert = UIAlertController(title: title, message: message, preferredStyle: .Alert)
+        let ok = UIAlertAction(title: "Ok", style: .Cancel, handler: nil)
+        alert.addAction(ok)
+        presentViewController(alert, animated: true, completion: nil)
+    }
     override func preferredStatusBarStyle() -> UIStatusBarStyle {
         return .LightContent
     }

        return imageView
    }()

    override func viewDidLoad() {
        super.viewDidLoad()
        view.backgroundColor = UIColor(r: 61, g: 91, b: 151)
        view.addSubview(inputContainerView)
        view.addSubview(loginRegisterButton)
        view.addSubview(profileImageView)

        setupInputContainerView()
        setupLoginRegisterButton()
        setupProfileImageView()
    }

    func setupInputContainerView() {

        passwordTextField.topAnchor.constraintEqualToAnchor(emailSeparatorView.bottomAnchor).active = true
        passwordTextField.widthAnchor.constraintEqualToAnchor(inputContainerView.widthAnchor).active = true
        passwordTextField.heightAnchor.constraintEqualToAnchor(inputContainerView.heightAnchor, multiplier: 1/3).active = true
    }

    func setupLoginRegisterButton() {
