Fix password auth proof serialization
This commit is contained in:
parent
8f449f3eb9
commit
56cc192a9f
|
@ -58,6 +58,7 @@ export class PasswordAuthProof implements AuthProof<User> {
|
|||
}
|
||||
|
||||
public async getResource(): Promise<User | null> {
|
||||
if (typeof this.userId !== 'number') return null;
|
||||
return await User.getById(this.userId);
|
||||
}
|
||||
|
||||
|
@ -71,11 +72,7 @@ export class PasswordAuthProof implements AuthProof<User> {
|
|||
}
|
||||
|
||||
public async isValid(): Promise<boolean> {
|
||||
if (typeof this.userId === 'number') {
|
||||
return Boolean(await this.getResource());
|
||||
} else {
|
||||
return await this.isAuthorized();
|
||||
}
|
||||
return Boolean(await this.getResource());
|
||||
}
|
||||
|
||||
public async revoke(): Promise<void> {
|
||||
|
@ -101,7 +98,7 @@ export class PasswordAuthProof implements AuthProof<User> {
|
|||
private save() {
|
||||
this.session.auth_password_proof = {
|
||||
authorized: this.authorized,
|
||||
userID: this.userId,
|
||||
userId: this.userId,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue