File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -223,18 +223,6 @@ class Auth extends BaseConfig
223223 'username ' ,
224224 ];
225225
226- /**
227- * --------------------------------------------------------------------
228- * Login validation rules
229- * --------------------------------------------------------------------
230- * Returns the rules that should be used for user login validation.
231- */
232- public array $ loginRules = [
233- // 'username' => 'required|max_length[30]|alpha_numeric_space|min_length[3]',
234- 'email ' => 'required|valid_email|max_length[254] ' ,
235- 'password ' => 'required ' ,
236- ];
237-
238226 /**
239227 * --------------------------------------------------------------------
240228 * Additional Fields for "Nothing Personal"
Original file line number Diff line number Diff line change @@ -28,7 +28,11 @@ public function loginView()
2828 */
2929 public function loginAction (): RedirectResponse
3030 {
31- if (! $ this ->validate (setting ('Auth.loginRules ' ))) {
31+ // Validate here first, since some things,
32+ // like the password, can only be validated properly here.
33+ $ rules = $ this ->getValidationRules ();
34+
35+ if (! $ this ->validate ($ rules )) {
3236 return redirect ()->back ()->withInput ()->with ('errors ' , $ this ->validator ->getErrors ());
3337 }
3438
@@ -52,6 +56,20 @@ public function loginAction(): RedirectResponse
5256 return redirect ()->to (config ('Auth ' )->loginRedirect ())->withCookies ();
5357 }
5458
59+ /**
60+ * Returns the rules that should be used for validation.
61+ *
62+ * @return string[]
63+ */
64+ protected function getValidationRules (): array
65+ {
66+ return setting ('Validation.login ' ) ?? [
67+ //'username' => 'required|max_length[30]|alpha_numeric_space|min_length[3]',
68+ 'email ' => 'required|valid_email|max_length[254] ' ,
69+ 'password ' => 'required ' ,
70+ ];
71+ }
72+
5573 /**
5674 * Logs the current user out.
5775 */
You can’t perform that action at this time.
0 commit comments