diff --git a/components/Account.php b/components/Account.php index db5d6dd..80c267d 100644 --- a/components/Account.php +++ b/components/Account.php @@ -194,6 +194,7 @@ public function onSignin() */ $data = post(); $rules = []; + $messages = []; $rules['login'] = $this->loginAttribute() == UserSettings::LOGIN_USERNAME ? 'required|between:2,255' @@ -201,13 +202,17 @@ public function onSignin() $rules['password'] = 'required|between:' . UserModel::getMinPasswordLength() . ',255'; + $messages['login'] = $this->loginAttribute() == UserSettings::LOGIN_USERNAME + ? trans('winter.user::lang.account.invalid_username') + : trans('winter.user::lang.account.invalid_email'); + if (!array_key_exists('login', $data)) { $data['login'] = post('username', post('email')); } $data['login'] = trim($data['login']); - $validation = Validator::make($data, $rules); + $validation = Validator::make($data, $rules, $messages); if ($validation->fails()) { throw new ValidationException($validation); } diff --git a/lang/de/lang.php b/lang/de/lang.php index ef618c2..0ef6614 100644 --- a/lang/de/lang.php +++ b/lang/de/lang.php @@ -182,6 +182,8 @@ 'force_secure_desc' => 'Verwende für Weiterleitungen immer das HTTPS-Protokoll.', 'invalid_activation_code' => 'Ungültiger Aktivierungscode übermittelt', 'invalid_deactivation_pass' => 'Das eingegebene Passwort war ungültig.', + 'invalid_username' => 'Der eingegebene Nutzername ist ungültig.', + 'invalid_email' => 'Die eingegebene E-Mail ist ungültig.', 'success_activation' => 'Benutzerkonto erfolgreich aktiviert.', 'success_deactivation' => 'Konto erfolgreich deaktiviert. Schade, dass du gehst!', 'success_saved' => 'Einstellungen erfolgreich gespeichert!', diff --git a/lang/en/lang.php b/lang/en/lang.php index 9164c1d..38abf4d 100644 --- a/lang/en/lang.php +++ b/lang/en/lang.php @@ -178,6 +178,8 @@ 'invalid_activation_code' => 'Invalid activation code supplied.', 'invalid_deactivation_pass' => 'The password you entered was invalid.', 'invalid_current_pass' => 'The current password you entered was invalid.', + 'invalid_username' => 'The username you have entered is invalid.', + 'invalid_email' => 'The email address you have entered is invalid.', 'success_activation' => 'Successfully activated your account.', 'success_deactivation' => 'Successfully deactivated your account. Sorry to see you go!', 'success_saved' => 'Settings successfully saved!',