@@ -56,7 +56,7 @@ public function invoke(?array $args): bool
56
56
57
57
protected function doPasswordReset (): mixed
58
58
{
59
- if (empty ($ this ->model ->email )) return ResetPasswordModel::E_EMPTY_EMAIL ;
59
+ if (empty ($ this ->model ->email )) return ResetPasswordModel::ERROR_EMPTY_EMAIL ;
60
60
61
61
try
62
62
{
@@ -65,10 +65,10 @@ protected function doPasswordReset(): mixed
65
65
}
66
66
catch (UnexpectedValueException )
67
67
{
68
- return ResetPasswordModel::E_BAD_EMAIL ;
68
+ return ResetPasswordModel::ERROR_BAD_EMAIL ;
69
69
}
70
70
71
- if (!$ this ->model ->user ) return ResetPasswordModel::E_USER_NOT_FOUND ;
71
+ if (!$ this ->model ->user ) return ResetPasswordModel::ERROR_USER_NOT_FOUND ;
72
72
73
73
if (empty ($ this ->model ->token ))
74
74
{
@@ -79,35 +79,35 @@ protected function doPasswordReset(): mixed
79
79
)
80
80
);
81
81
82
- return $ this ->model ->user ->commit () ? self ::sendEmail () : ResetPasswordModel::E_INTERNAL_ERROR ;
82
+ return $ this ->model ->user ->commit () ? self ::sendEmail () : ResetPasswordModel::ERROR_INTERNAL ;
83
83
}
84
84
85
85
if ($ this ->model ->token !== $ this ->model ->user ->getVerifierToken ())
86
- return ResetPasswordModel::E_BAD_TOKEN ;
86
+ return ResetPasswordModel::ERROR_BAD_TOKEN ;
87
87
88
88
if ($ this ->model ->pw1 !== $ this ->model ->pw2 )
89
- return ResetPasswordModel::E_PASSWORD_MISMATCH ;
89
+ return ResetPasswordModel::ERROR_PASSWORD_MISMATCH ;
90
90
91
91
$ req = Config::get ('bnetdocs.user_register_requirements ' ) ?? [];
92
92
$ pwlen = strlen ($ this ->model ->pw1 );
93
93
94
94
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 ;
96
96
97
97
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 ;
99
99
100
100
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 ;
102
102
103
103
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 ;
105
105
106
- if ($ this ->model ->user ->isDisabled ()) return ResetPasswordModel::E_USER_DISABLED ;
106
+ if ($ this ->model ->user ->isDisabled ()) return ResetPasswordModel::ERROR_USER_DISABLED ;
107
107
108
108
$ this ->model ->user ->setPassword ($ this ->model ->pw1 );
109
109
$ 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 ;
111
111
}
112
112
113
113
protected function sendEmail (): mixed
@@ -186,9 +186,9 @@ protected function sendEmail(): mixed
186
186
}
187
187
catch (\PHPMailer \PHPMailer \Exception )
188
188
{
189
- return ResetPasswordModel::E_INTERNAL_ERROR ;
189
+ return ResetPasswordModel::ERROR_INTERNAL ;
190
190
}
191
191
192
- return ResetPasswordModel:: E_SUCCESS ;
192
+ return false ;
193
193
}
194
194
}
0 commit comments