title: iOS - Firebase Authorization/login with email
body: <p>I have seen so much questions about authorization in Firebase, but none of them helped (<em>the authorization way was a bit different</em>). I am not so experienced iOS development so I need help not only in the code, but in UX also. Below is is my code:</p>
  
  <pre><code>func loginDidFinish(email: String, password: String, type: LFLoginController.SendType) {
  
      // Server call implementation here
      if type == .Login {
          if user.exists { // check if user exists
              FIRAuth.auth()?.signInWithEmail(email, password: password, completion: {
                  navigationController?.popViewControllerAnimated(true)
              })
          } else {
              self.controller.wrongInfoShake()
          }
      } else { // type == .SignUp
          if user.exists { // check if user exists
              FIRAuth.auth()?.signInWithEmail(email, password: password, completion: { (user, error) in
                  //
              })
          } else {
              FIRAuth.auth()?.createUserWithEmail(email, password: password, completion: { (user, error) in
                  //
              })
          }
      }
  
      print(email)
      print(password)
      print(type)
  
      // handling errors
      if email == "" &amp;&amp; password == "" {
          controller.wrongInfoShake()
      } else {
          navigationController?.popViewControllerAnimated(true)
      }
  }
  </code></pre>
  
  <p>This is my function for logging-in. First, I used a framework for login page (<em>yes, I am too lazy to do that myself</em>) from <a href="https://github.com/awesome-labs/LFLoginController" rel="nofollow">here</a>. And I used Firebase as a backend server to store that accounts.</p>
  
  <p>Now, I don't know how to check if the user already exists in the system. Also, if there any errors occurs the <code>LFLoginController</code> lib provides with function called <code>wrongInfoShake()</code>, which I use every time when an error occurs, but I'm not sure if I should provide the description that went wrong (<em>means to present <code>AlertControl</code></em>) (<em>this is UX question btw</em>).</p>
  
  <p>And when the type is changed to <em>SignUp</em>, will it be OK when the user types the email and password that already exists to login using that info even if the user uses type SignUp?</p>
  
  <p>When the SignUp goes on, should I handle any errors?</p>