@@ -56,7 +56,7 @@ public function invoke(?array $args): bool
5656
5757 protected function doPasswordReset (): mixed
5858 {
59- if (empty ($ this ->model ->email )) return ResetPasswordModel::E_EMPTY_EMAIL ;
59+ if (empty ($ this ->model ->email )) return ResetPasswordModel::ERROR_EMPTY_EMAIL ;
6060
6161 try
6262 {
@@ -65,10 +65,10 @@ protected function doPasswordReset(): mixed
6565 }
6666 catch (UnexpectedValueException )
6767 {
68- return ResetPasswordModel::E_BAD_EMAIL ;
68+ return ResetPasswordModel::ERROR_BAD_EMAIL ;
6969 }
7070
71- if (!$ this ->model ->user ) return ResetPasswordModel::E_USER_NOT_FOUND ;
71+ if (!$ this ->model ->user ) return ResetPasswordModel::ERROR_USER_NOT_FOUND ;
7272
7373 if (empty ($ this ->model ->token ))
7474 {
@@ -79,35 +79,35 @@ protected function doPasswordReset(): mixed
7979 )
8080 );
8181
82- return $ this ->model ->user ->commit () ? self ::sendEmail () : ResetPasswordModel::E_INTERNAL_ERROR ;
82+ return $ this ->model ->user ->commit () ? self ::sendEmail () : ResetPasswordModel::ERROR_INTERNAL ;
8383 }
8484
8585 if ($ this ->model ->token !== $ this ->model ->user ->getVerifierToken ())
86- return ResetPasswordModel::E_BAD_TOKEN ;
86+ return ResetPasswordModel::ERROR_BAD_TOKEN ;
8787
8888 if ($ this ->model ->pw1 !== $ this ->model ->pw2 )
89- return ResetPasswordModel::E_PASSWORD_MISMATCH ;
89+ return ResetPasswordModel::ERROR_PASSWORD_MISMATCH ;
9090
9191 $ req = Config::get ('bnetdocs.user_register_requirements ' ) ?? [];
9292 $ pwlen = strlen ($ this ->model ->pw1 );
9393
9494 if (is_numeric ($ req ->password_length_max ) && $ pwlen > $ req ->password_length_max )
95- return ResetPasswordModel::E_PASSWORD_TOO_LONG ;
95+ return ResetPasswordModel::ERROR_PASSWORD_TOO_LONG ;
9696
9797 if (is_numeric ($ req ->password_length_min ) && $ pwlen < $ req ->password_length_min )
98- return ResetPasswordModel::E_PASSWORD_TOO_SHORT ;
98+ return ResetPasswordModel::ERROR_PASSWORD_TOO_SHORT ;
9999
100100 if (!$ req ->password_allow_email && stripos ($ this ->model ->pw1 , $ this ->model ->user ->getEmail ()))
101- return ResetPasswordModel::E_PASSWORD_CONTAINS_EMAIL ;
101+ return ResetPasswordModel::ERROR_PASSWORD_CONTAINS_EMAIL ;
102102
103103 if (!$ req ->password_allow_username && stripos ($ this ->model ->pw1 , $ this ->model ->user ->getUsername ()))
104- return ResetPasswordModel::E_PASSWORD_CONTAINS_USERNAME ;
104+ return ResetPasswordModel::ERROR_PASSWORD_CONTAINS_USERNAME ;
105105
106- if ($ this ->model ->user ->isDisabled ()) return ResetPasswordModel::E_USER_DISABLED ;
106+ if ($ this ->model ->user ->isDisabled ()) return ResetPasswordModel::ERROR_USER_DISABLED ;
107107
108108 $ this ->model ->user ->setPassword ($ this ->model ->pw1 );
109109 $ this ->model ->user ->setVerified (true );
110- return $ this ->model ->user ->commit () ? ResetPasswordModel:: E_SUCCESS : ResetPasswordModel::E_INTERNAL_ERROR ;
110+ return $ this ->model ->user ->commit () ? false : ResetPasswordModel::ERROR_INTERNAL ;
111111 }
112112
113113 protected function sendEmail (): mixed
@@ -186,9 +186,9 @@ protected function sendEmail(): mixed
186186 }
187187 catch (\PHPMailer \PHPMailer \Exception )
188188 {
189- return ResetPasswordModel::E_INTERNAL_ERROR ;
189+ return ResetPasswordModel::ERROR_INTERNAL ;
190190 }
191191
192- return ResetPasswordModel:: E_SUCCESS ;
192+ return false ;
193193 }
194194}
0 commit comments