File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -249,8 +249,10 @@ export class AuthenticationMWs {
249249 if (
250250 typeof req . body === 'undefined' ||
251251 typeof req . body . loginCredential === 'undefined' ||
252- typeof req . body . loginCredential . username === 'undefined' ||
253- typeof req . body . loginCredential . password === 'undefined'
252+ typeof req . body . loginCredential . username !== 'string' ||
253+ typeof req . body . loginCredential . password !== 'string' ||
254+ req . body . loginCredential . username . length === 0 ||
255+ req . body . loginCredential . password . length === 0
254256 ) {
255257 Logger . warn ( LOG_TAG , 'Failed login from IP `' + req . ip + '` no user or password provided' ) ;
256258 return next (
Original file line number Diff line number Diff line change @@ -12,11 +12,12 @@ export class UserManager {
1212
1313 public async findOne ( filter : FindOptionsWhere < UserEntity > ) : Promise < UserEntity > {
1414 const connection = await SQLConnection . getConnection ( ) ;
15+ const verifyPassword = typeof filter . password == 'string' ;
1516 const pass = filter . password as string ;
1617 delete filter . password ;
1718 const user = await connection . getRepository ( UserEntity ) . findOneBy ( filter ) ;
1819
19- if ( pass && ! PasswordHelper . comparePassword ( pass , user . password ) ) {
20+ if ( verifyPassword && ! PasswordHelper . comparePassword ( pass , user . password ) ) {
2021 throw new Error ( 'No entry found' ) ;
2122 }
2223 return user ;
You can’t perform that action at this time.
0 commit comments