@@ -749,6 +749,7 @@ export class ApiService {
749
749
const salt = this . configResolverService . getSalt ( loginDto . applicationId ) ;
750
750
const password = salt + this . configService . get ( 'DEFAULT_USER_PASSWORD' ) ; // mix OTP with salt
751
751
console . log ( password ) ;
752
+ let response ;
752
753
753
754
const { statusFA } : { statusFA : FAStatus } =
754
755
await this . fusionAuthService . getUser (
@@ -757,7 +758,7 @@ export class ApiService {
757
758
authHeader ,
758
759
) ;
759
760
if ( statusFA === FAStatus . USER_EXISTS ) {
760
- return this . login ( { ...loginDto , password } , authHeader ) ;
761
+ response = await this . login ( { ...loginDto , password } , authHeader ) ;
761
762
} else {
762
763
// create a new user
763
764
const createUserPayload : UserRegistration = {
@@ -781,8 +782,22 @@ export class ApiService {
781
782
if ( userId == null || user == null ) {
782
783
throw new HttpException ( err , HttpStatus . BAD_REQUEST ) ;
783
784
}
784
- return this . login ( { ...loginDto , password } , authHeader ) ;
785
+ response = await this . login ( { ...loginDto , password } , authHeader ) ;
785
786
}
787
+ let existingJWTS : any = await this . redis . get (
788
+ response ?. result ?. data ?. user ?. user ?. id ,
789
+ ) ;
790
+ if ( existingJWTS ) {
791
+ existingJWTS = JSON . parse ( existingJWTS ) ;
792
+ } else {
793
+ existingJWTS = [ ] ;
794
+ }
795
+ existingJWTS . push ( response ?. result ?. data ?. user ?. token ) ;
796
+ await this . redis . set (
797
+ response ?. result ?. data ?. user ?. user ?. id ,
798
+ JSON . stringify ( existingJWTS ) ,
799
+ ) ;
800
+ return response ;
786
801
}
787
802
788
803
async updateUserRegistration (
0 commit comments