mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-01 18:53:16 +00:00
Update RegisterController
This commit is contained in:
parent
01239cb9be
commit
64950748cf
1 changed files with 4 additions and 4 deletions
|
@ -63,17 +63,17 @@ class RegisterController extends Controller
|
||||||
'unique:users',
|
'unique:users',
|
||||||
function ($attribute, $value, $fail) {
|
function ($attribute, $value, $fail) {
|
||||||
if (!ctype_alpha($value[0])) {
|
if (!ctype_alpha($value[0])) {
|
||||||
return $fail($attribute.' is invalid. Username must be alpha-numeric and start with a letter.');
|
return $fail('Username is invalid. Username must be alpha-numeric and start with a letter.');
|
||||||
}
|
}
|
||||||
$val = str_replace(['-', '_'], '', $value);
|
$val = str_replace(['_', '-', '.'], '', $value);
|
||||||
if(!ctype_alnum($val)) {
|
if(!ctype_alnum($val)) {
|
||||||
return $fail($attribute . ' is invalid. Username must be alpha-numeric.');
|
return $fail('Username is invalid. Username must be alpha-numeric and may contain dashes (-), periods (.) and underscores (_).');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
$rules = [
|
$rules = [
|
||||||
'name' => 'required|string|max:'.config('pixelfed.max_name_length'),
|
'name' => 'nullable|string|max:'.config('pixelfed.max_name_length'),
|
||||||
'username' => $usernameRules,
|
'username' => $usernameRules,
|
||||||
'email' => 'required|string|email|max:255|unique:users',
|
'email' => 'required|string|email|max:255|unique:users',
|
||||||
'password' => 'required|string|min:8|confirmed',
|
'password' => 'required|string|min:8|confirmed',
|
||||||
|
|
Loading…
Reference in a new issue