feat: add admin user serializer with accept invitation url
This commit is contained in:
@@ -180,6 +180,10 @@ class User extends Base {
|
||||
},
|
||||
});
|
||||
|
||||
static get virtualAttributes() {
|
||||
return ['acceptInvitationUrl'];
|
||||
}
|
||||
|
||||
get authorizedFlows() {
|
||||
const conditions = this.can('read', 'Flow');
|
||||
return conditions.isCreator ? this.$relatedQuery('flows') : Flow.query();
|
||||
@@ -204,6 +208,10 @@ class User extends Base {
|
||||
: Execution.query();
|
||||
}
|
||||
|
||||
get acceptInvitationUrl() {
|
||||
return `${appConfig.webAppUrl}/accept-invitation?token=${this.invitationToken}`;
|
||||
}
|
||||
|
||||
static async authenticate(email, password) {
|
||||
const user = await User.query().findOne({
|
||||
email: email?.toLowerCase() || null,
|
||||
@@ -362,7 +370,6 @@ class User extends Base {
|
||||
await this.generateInvitationToken();
|
||||
|
||||
const jobName = `Invitation Email - ${this.id}`;
|
||||
const acceptInvitationUrl = `${appConfig.webAppUrl}/accept-invitation?token=${this.invitationToken}`;
|
||||
|
||||
const jobPayload = {
|
||||
email: this.email,
|
||||
@@ -370,7 +377,7 @@ class User extends Base {
|
||||
template: 'invitation-instructions',
|
||||
params: {
|
||||
fullName: this.fullName,
|
||||
acceptInvitationUrl,
|
||||
acceptInvitationUrl: this.acceptInvitationUrl,
|
||||
},
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user