fix: Make v2 JWT incompatible with v1

- fix(Proposals): Populating driver data.
 - fix(Account): Make v1 and v2 JWT secret incompatible.
This commit is contained in:
Josepablo C
2024-08-05 23:35:15 -06:00
parent c3f0b08cb7
commit 15abfe6c45
5 changed files with 36 additions and 27 deletions

View File

@@ -41,7 +41,11 @@ class SpecificModelRepository{
.where("email","=",email)
.where("password","=",safe_password)
.first();
return await this.populate( user );
if( user ){
return await this.populate( user );
}else{
return null;
}
}
async updateSessionToken( old_token, token, expiration ){
@@ -81,7 +85,11 @@ class SpecificModelRepository{
async findBySessionToken( token ){
const session = await Sessions.query().select("*").where("token","=",token).first();
const user = await Users.query().findById( session.user_id );
return await this.populate( user );
if( user ){
return await this.populate( user );
}else{
return null;
}
}
}