mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-23 00:00:31 +00:00
feat: User email verification after signing-up.
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
import { Container } from 'typedi';
|
||||
import AuthenticationMailMesssages from '@/services/Authentication/AuthenticationMailMessages';
|
||||
|
||||
export class SendVerifyMailJob {
|
||||
/**
|
||||
* Constructor method.
|
||||
* @param {Agenda} agenda
|
||||
*/
|
||||
constructor(agenda) {
|
||||
agenda.define(
|
||||
'send-signup-verify-mail',
|
||||
{ priority: 'high' },
|
||||
this.handler.bind(this)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle send welcome mail job.
|
||||
* @param {Job} job
|
||||
* @param {Function} done
|
||||
*/
|
||||
public async handler(job, done: Function): Promise<void> {
|
||||
const { data } = job.attrs;
|
||||
const { email, fullName, token } = data;
|
||||
const authService = Container.get(AuthenticationMailMesssages);
|
||||
|
||||
try {
|
||||
await authService.sendSignupVerificationMail(email, fullName, token);
|
||||
done();
|
||||
} catch (error) {
|
||||
console.log(error);
|
||||
done(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user