[ad_1]
That is my viecontroller –
import UIKit
import FirebaseFirestore
import FirebaseAuth
import Stripe
import FirebaseFunctions
class SignUpViewController: UIViewController {
var paymentContext = STPPaymentContext()
@IBOutlet weak var e mail: UITextField!
@IBOutlet weak var password: UITextField!
@IBOutlet weak var passwordConfirm: UITextField!
@IBOutlet weak var login: UITextField!
@IBOutlet weak var loginpassword: UITextField!
@IBAction func signUpAction(_ sender: Any) {
if password.textual content != passwordConfirm.textual content {
let alertController = UIAlertController(title: "Password Incorrect", message: "Please re-type password", preferredStyle: .alert)
let defaultAction = UIAlertAction(title: "OK", model: .cancel, handler: nil)
alertController.addAction(defaultAction)
self.current(alertController, animated: true, completion: nil)
}
else{
Auth.auth().createUser(withEmail: e mail.textual content!, password: password.textual content!){ [self]
(person, error) in if error == nil {
// 👇
Capabilities.features().httpsCallable("createStripeUser").name(["email": email.text ?? ""]) {
(outcome, error) in
if let error = error {
debugPrint(error.localizedDescription)
return
}
self.dismiss(animated: true)
}
}
else{
let alertController = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: .alert)
let defaultAction = UIAlertAction(title: "OK", model: .cancel, handler: nil)
alertController.addAction(defaultAction)
self.current(alertController, animated: true, completion: nil)
}
}
}
}
@IBAction func loginAction(_ sender: Any) {
Auth.auth().signIn(withEmail: e mail.textual content!, password: password.textual content!) { (person, error) in
if error == nil{
self.performSegue(withIdentifier: "loginToHome", sender: self)
}
else{
let alertController = UIAlertController(title: "Error", message: error?.localizedDescription, preferredStyle: .alert)
let defaultAction = UIAlertAction(title: "OK", model: .cancel, handler: nil)
alertController.addAction(defaultAction)
self.current(alertController, animated: true, completion: nil)
}
}
}
}
The “signUpAction” motion works wonderful however the “loginAction” doesn’t. It says “re-type password whether or not the person is registered or not as proven beneath:-

The firebase and stripe buyer is authenticated as proven within the figures beneath:-
What am a I doing incorrect ?
[ad_2]


