File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change 1010
1111use PKP \db \DAO ;
1212use APP \plugins \generic \betterPassword \classes \BadpwFailedLogins as BadpwFailedLogins ;
13+ use APP \facades \Repo ;
1314
1415class BadpwFailedLoginsDAO extends DAO {
1516 /**
@@ -58,6 +59,17 @@ public function deleteObject(BadpwFailedLogins $badpwObj) : bool {
5859 * @return BadpwFailedLogins object Object matching the username
5960 */
6061 public function getByUsername (string $ username ) : ?BadpwFailedLogins {
62+ // Verify if the username is an email
63+ if (filter_var ($ username , FILTER_VALIDATE_EMAIL )) {
64+ $ user = Repo::user ()->getByEmail ($ username );
65+ if (!$ user ) {
66+ return null ;
67+ }
68+ $ username = $ user ->getData ('userName ' );
69+ } elseif (strlen ($ username ) > 32 ) { // Invalid username length
70+ return null ;
71+ }
72+
6173 $ result = $ this ->retrieve ('
6274 SELECT *
6375 FROM badpw_failedlogins
You can’t perform that action at this time.
0 commit comments