[+] Send registration request
This commit is contained in:
@@ -26,16 +26,22 @@ class LoginVC: UIViewController
|
|||||||
@IBAction func register(_ sender: Any)
|
@IBAction func register(_ sender: Any)
|
||||||
{
|
{
|
||||||
// Verify username and password
|
// Verify username and password
|
||||||
guard username.text ~= "[A-Za-z0-9_-]{3,16}" else
|
guard let name = username.text, name ~= "[A-Za-z0-9_-]{3,16}" else
|
||||||
{
|
{
|
||||||
alert("Username Invalid", "Username must be 3 to 16 characters long, and must only contain a-z, 0-9, underscore, and minus signs (-).")
|
alert("Username Invalid", "Username must be 3 to 16 characters long, and must only contain a-z, 0-9, underscore, and minus signs (-).")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
guard let text = password.text, text.count > 8 else
|
guard let pass = password.text, pass.count > 8 else
|
||||||
{
|
{
|
||||||
alert("Password Invalid", "Password must be more than 8 characters long")
|
alert("Password Invalid", "Password must be more than 8 characters long")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Send register request
|
||||||
|
alert("Registering...", "Please Wait", okayable: true)
|
||||||
|
send(APIs.register, ["username": name, "password": pass]) { it in
|
||||||
|
print(it)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@IBAction func login(_ sender: Any)
|
@IBAction func login(_ sender: Any)
|
||||||
|
|||||||
Reference in New Issue
Block a user