kar*_*eem -1 iphone xcode ios parse-platform swift
在我的注册页面上,我希望用户使用确认密码文本字段来确认他们选择的密码。我正在使用 Swift。
这是我的注册代码
if(newUser.password != self.confirmPassword.text){
let alertController = UIAlertController(title: "Sign Up Failed", message: "Sorry, your Passwords were not matching.", preferredStyle: .Alert)
let OKAction = UIAlertAction(title: "OK", style: .Default) { (action) in
// ...
}
alertController.addAction(OKAction)
self.presentViewController(alertController, animated: true) {
// ...
}
}
Run Code Online (Sandbox Code Playgroud)
这是在我的 @IBAction func confirmButton(sender: AnyObject)
编辑:
我没有收到错误,如果我只填写两个不同的密码或根本没有密码,Parse 仍然会注册用户。
谢谢。
这是我通常的做法:
func registerButtonTapped() {
var a = false
var b = false
if passwordField.text == confirmField.text {
a = true
} else {
//Passwords dont match
}
if(passwordField.text == "" || confirmField.text == "") {
//alert saying there are empty fields
} else {
b = true
}
if a == true && b == true {
//Signup code
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8769 次 |
| 最近记录: |