My application is linked with firebase database and authentication.
When a user creates an account, the only requirements for the password are for it to be 6 charact
Use this function. It includes range 6-15 i.e. minimum 6 and maximum 15 characters.One Capital letter , One number respectively.
func isValidPasswordString(pwdStr:String) -> Bool {
let pwdRegEx = "(?:(?:(?=.*?[0-9])(?=.*?[-!@#$%&*ˆ+=_])|(?:(?=.*?[0-9])|(?=.*?[A-Z])|(?=.*?[-!@#$%&*ˆ+=_])))|(?=.*?[a-z])(?=.*?[0-9])(?=.*?[-!@#$%&*ˆ+=_]))[A-Za-z0-9-!@#$%&*ˆ+=_]{6,15}"
let pwdTest = NSPredicate(format:"SELF MATCHES %@", pwdRegEx)
return pwdTest.evaluate(with: pwdStr)
}
This func will return true for valid password string