feat: User email verification after signing-up.

This commit is contained in:
Ahmed Bouhuolia
2024-04-26 12:21:40 +02:00
parent b7214044bb
commit 4368c18479
16 changed files with 778 additions and 8 deletions

View File

@@ -0,0 +1,8 @@
exports.up = function (knex) {
return knex.schema.table('users', (table) => {
table.string('verify_token');
table.boolean('verified').defaultTo(false);
});
};
exports.down = (knex) => {};

View File

@@ -4,6 +4,12 @@ import SystemModel from '@/system/models/SystemModel';
import SoftDeleteQueryBuilder from '@/collection/SoftDeleteQueryBuilder';
export default class SystemUser extends SystemModel {
firstName!: string;
lastName!: string;
verified!: boolean;
inviteAcceptedAt!: Date | null;
deletedAt!: Date | null;
/**
* Table name.
*/
@@ -33,19 +39,29 @@ export default class SystemUser extends SystemModel {
}
/**
*
* Detarmines whether the user is deleted.
* @returns {boolean}
*/
get isDeleted() {
return !!this.deletedAt;
}
/**
*
* Detarmines whether the sent invite is accepted.
* @returns {boolean}
*/
get isInviteAccepted() {
return !!this.inviteAcceptedAt;
}
/**
* Detarmines whether the user's email is verified.
* @returns {boolean}
*/
get isVerified() {
return !!this.verified;
}
/**
* Full name attribute.
*/