mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 14:31:26 +00:00
Merge pull request #397 from pixelfed/frontend-ui-refactor
Update RegisterController
This commit is contained in:
commit
e90d7c52bc
1 changed files with 13 additions and 2 deletions
|
@ -51,11 +51,22 @@ class RegisterController extends Controller
|
||||||
protected function validator(array $data)
|
protected function validator(array $data)
|
||||||
{
|
{
|
||||||
$this->validateUsername($data['username']);
|
$this->validateUsername($data['username']);
|
||||||
|
$usernameRules = [
|
||||||
|
'required',
|
||||||
|
'alpha_dash',
|
||||||
|
'min:2',
|
||||||
|
'max:15',
|
||||||
|
'unique:users',
|
||||||
|
function($attribute, $value, $fail) {
|
||||||
|
if(!ctype_alpha($value[0])) {
|
||||||
|
return $fail($attribute . ' is invalid. Username must be alpha-numeric and start with a letter.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'name' => 'required|string|max:255',
|
'name' => 'required|string|max:255',
|
||||||
'username' => 'required|alpha_dash|min:2|max:15|unique:users',
|
'username' => $usernameRules,
|
||||||
'email' => 'required|string|email|max:255|unique:users',
|
'email' => 'required|string|email|max:255|unique:users',
|
||||||
'password' => 'required|string|min:6|confirmed',
|
'password' => 'required|string|min:6|confirmed',
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue