File tree Expand file tree Collapse file tree 3 files changed +16
-14
lines changed
Expand file tree Collapse file tree 3 files changed +16
-14
lines changed Original file line number Diff line number Diff line change 11{
22 "name" : " nestjs-authentication" ,
3- "version" : " 0.1.5 " ,
3+ "version" : " 0.1.6 " ,
44 "description" : " A nestjs module that support multiple authentications provider" ,
55 "author" : " Alex Hermann <contact@pop-code.com>" ,
66 "repository" : " https://github.com/Pop-Code/nestjs-authentication.git" ,
Original file line number Diff line number Diff line change @@ -45,7 +45,7 @@ export abstract class AuthController<LoginRequest extends ILoginRequest> {
4545 * @param req The http request (@Req|@Request)
4646 */
4747 logoutAction ( req : any ) : any {
48- if ( req . isAuthenticated ( ) ! == true ) {
48+ if ( req . isAuthenticated ( ) = == true ) {
4949 req . logOut ( ) ;
5050 }
5151 if ( req . get ( 'accept' ) === 'application/json' ) {
Original file line number Diff line number Diff line change @@ -12,24 +12,26 @@ export class AuthUserProvider<T extends IEmailPassword> implements IAuthProvider
1212 private readonly encryptor : IEncrypt
1313 ) { }
1414
15+ getName ( ) : string {
16+ return this . providerName ;
17+ }
18+
1519 async loadUser ( data : { password : string ; [ key : string ] : any } ) : Promise < T > {
1620 const query = { ...data } ;
1721 delete query . password ;
18- if ( typeof data . password !== 'string' ) {
19- const entity = await this . userProvider . findOne ( query ) ;
20- if ( entity === undefined ) {
22+ const entity = await this . userProvider . findOne ( query ) ;
23+ if ( entity === undefined ) {
24+ return ;
25+ }
26+ if ( typeof data . password === 'string' ) {
27+ const encrypted = this . encryptor . encrypt ( data . password ) ;
28+ if ( encrypted !== entity . passwordEncrypted ) {
2129 return ;
22- } else if ( typeof data . password === 'string' ) {
23- const encrypted = this . encryptor . encrypt ( data . password ) ;
24- if ( encrypted !== entity . passwordEncrypted ) {
25- return ;
26- }
2730 }
28- return entity ;
2931 }
30- }
32+ return entity ;
3133
32- getName ( ) : string {
33- return this . providerName ;
3434 }
35+
36+
3537}
You can’t perform that action at this time.
0 commit comments