mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 23:30:32 +00:00
feat: User email verification after signing-up.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import { IAuthSignedUpEventPayload } from '@/interfaces';
|
||||
import events from '@/subscribers/events';
|
||||
import { Inject } from 'typedi';
|
||||
|
||||
export class SendVerfiyMailOnSignUp {
|
||||
@Inject('agenda')
|
||||
private agenda: any;
|
||||
|
||||
/**
|
||||
* Attaches events with handles.
|
||||
*/
|
||||
public attach(bus) {
|
||||
bus.subscribe(events.auth.signUp, this.handleSendVerifyMailOnSignup);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param {ITaxRateEditedPayload} payload -
|
||||
*/
|
||||
private handleSendVerifyMailOnSignup = async ({
|
||||
user,
|
||||
}: IAuthSignedUpEventPayload) => {
|
||||
const payload = {
|
||||
email: user.email,
|
||||
token: user.verifyToken,
|
||||
fullName: user.firstName,
|
||||
};
|
||||
await this.agenda.now('send-signup-verify-mail', payload);
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user