Check for unique user and email. Closes #2118

This commit is contained in:
James Brooks 2016-09-29 23:19:52 +01:00
parent b40066b20e
commit 6ce4348a28

View File

@ -106,8 +106,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
* @var string[]
*/
public $rules = [
'username' => ['required', 'regex:/\A(?!.*[:;]-\))[ -~]+\z/'],
'email' => 'required|email',
'username' => ['required', 'regex:/\A(?!.*[:;]-\))[ -~]+\z/', 'unique:users,username'],
'email' => 'required|email|unique:users,email',
'password' => 'required',
];