feat: add accept-invitation page

This commit is contained in:
Ali BARIN
2024-07-09 11:46:31 +00:00
committed by Faruk AYDIN
parent 3c3e6e4144
commit 9922033d33
13 changed files with 225 additions and 8 deletions

View File

@@ -35,7 +35,7 @@ class User extends Base {
password: { type: 'string' },
status: {
type: 'string',
enum: ['active', 'pending'],
enum: ['active', 'invited'],
default: 'active',
},
resetPasswordToken: { type: ['string', 'null'] },
@@ -234,11 +234,12 @@ class User extends Base {
return await this.$query().patch({
invitationToken: null,
invitationTokenSentAt: null,
status: 'active',
password,
});
}
async isResetPasswordTokenValid() {
isResetPasswordTokenValid() {
if (!this.resetPasswordTokenSentAt) {
return false;
}
@@ -250,7 +251,7 @@ class User extends Base {
return now.getTime() - sentAt.getTime() < fourHoursInMilliseconds;
}
async isInvitationTokenValid() {
isInvitationTokenValid() {
if (!this.invitationTokenSentAt) {
return false;
}