I am trying to set the password rules for an app I am building using swift and parse. I have the swift code but it is not compatible with parse. Help please.
Would you mind posting your swift code?
// Storing username and password in the database
@IBAction func signUp(_ sender: Any){
let user = PFUser()
user.username = emailField.text!
user.password = passwordField.text!
user.email = emailField.text!
// customizing password rules
// adding objects to the user class
user["firstname"] = firstnameField.text!
user["lastname"] = lastnameField.text!
//user["newUser"] = true
if !firstnameField.hasText || !lastnameField.hasText || !emailField.hasText || !passwordField.hasText {
let alert = UIAlertController(title: "Oops!", message: "Please fill out all of the required information", preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action) in
}))
self.present(alert, animated: true)
print("Error:")
} else {
user.signUpInBackground { (success, error) in
if success{
self.performSegue(withIdentifier: "ToSetupProfile", sender: nil)
} else {
let alert = UIAlertController(title: "Oops!", message: error?.localizedDescription, preferredStyle: .alert)
alert.addAction(UIAlertAction(title: "Ok", style: .default, handler: { (action) in
print(error.debugDescription)
}))
self.present(alert, animated: true)
print("Error: \(String(describing: error.debugDescription))")
}
}
}
}