Reputation: 91
I'm currently working on an application with integrated Firebase login. The last one I developed worked fine but the current App is causing a problem.
I'm taking the input from the Email and Password field and trying to login.
func login(user: String, pass: String){
Auth.auth().signIn(withEmail: user, password: pass) { (user, error) in
if(error != nil){
print("Success")
}
}
Every time I hit the "Login" button it prints "Success", even when I've not even entered Username and Password (blank text fields)
Thanks for your Help in advance!
Upvotes: 1
Views: 225
Reputation: 566
if (error != nil) ? Ok try to change if error == nil , because (error != nil) means that there is an error :).
func login(user: String, pass: String){
Auth.auth().signIn(withEmail: user, password: pass) { (user, error) in
if(error == nil){
print("Success")
} else {
print("error")
}
}
Upvotes: 1