xcode - Swift: Using credentials with Firebase and a additional textfield for username -


i have few things i'm trying accomplish. first, email , password don't matter if they're filled or not login. app check if email , password filled , correct before logging in. secondly, put in username when register show on profile page , tell other users they're without revealing email address. i'm using firebase , thought trick, doesn't. looked on stack overflow post , have correct think, still letting login without credentials.

@ibaction func loginregisterbtnpressed(_ sender: anyobject) {     performsegue(withidentifier: "profilevc", sender: self)     if let email = emailtextfield.text, let password = passwordtextfield.text {         firauth.auth()?.signin(withemail: email, password: password, completion: { (user, error ) in             if error == nil {                 print("daw: user created")             } else {                firauth.auth()?.createuser(withemail: email, password: password, completion: { (user, error ) in             if error != nil {                     print ("daw: user failed authenticate firebase")             } else {                     print ("daw: successfully")                 if let user = user {                     self.completesignin(id: user.uid)                         }                     }                })             }         })     } } 

@ibaction func loginregisterbtnpressed(_ sender: anyobject) {      if let email = emailtextfield.text, let password = passwordtextfield.text {         if email != "" && password != ""{             firauth.auth()?.signin(withemail: email, password: password, completion: { (user, error ) in             if error == nil {                 performsegue(withidentifier: "profilevc", sender: self)             } else {                 firauth.auth()?.createuser(withemail: email, password: password, completion: { (user, error ) in                     if error != nil {                         print ("daw: user failed authenticate firebase")                     } else {                         print ("daw: successfully")                         if let user = user {                             self.completesignin(id: user.uid)                         }                     }                 })             }         })        }     } } 

Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -