mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
fix: issue in mail sender.
This commit is contained in:
@@ -5,9 +5,11 @@ import events from 'subscribers/events';
|
||||
|
||||
@EventSubscriber()
|
||||
export class AuthenticationSubscriber {
|
||||
|
||||
/**
|
||||
* Resets the login throttle once the login success.
|
||||
*/
|
||||
@On(events.auth.login)
|
||||
public async onLogin(payload) {
|
||||
public async resetLoginThrottleOnceSuccessLogin(payload) {
|
||||
const { emailOrPhone, password, user } = payload;
|
||||
|
||||
const loginThrottler = Container.get('rateLimiter.login');
|
||||
@@ -15,26 +17,28 @@ export class AuthenticationSubscriber {
|
||||
// Reset the login throttle by the given email and phone number.
|
||||
await loginThrottler.reset(user.email);
|
||||
await loginThrottler.reset(user.phoneNumber);
|
||||
await loginThrottler.reset(emailOrPhone);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends welcome email once the user register.
|
||||
*/
|
||||
@On(events.auth.register)
|
||||
public onRegister(payload) {
|
||||
const { registerDTO, user } = payload;
|
||||
public async sendWelcomeEmail(payload) {
|
||||
const { registerDTO, tenant, user } = payload;
|
||||
|
||||
const agenda = Container.get('agenda');
|
||||
|
||||
// Send welcome mail to the user.
|
||||
agenda.now('welcome-email', {
|
||||
...pick(registerDTO, ['organizationName']),
|
||||
await agenda.now('welcome-email', {
|
||||
organizationId: tenant.organizationId,
|
||||
user,
|
||||
});
|
||||
}
|
||||
|
||||
@On(events.auth.resetPassword)
|
||||
public onResetPassword(payload) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Sends reset password mail once the reset password success.
|
||||
*/
|
||||
@On(events.auth.sendResetPassword)
|
||||
public onSendResetPassword (payload) {
|
||||
const { user, token } = payload;
|
||||
|
||||
@@ -24,6 +24,5 @@ export class InviteUserSubscriber {
|
||||
const { invite } = payload;
|
||||
const agenda = Container.get('agenda');
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,13 @@ import events from 'subscribers/events';
|
||||
|
||||
@EventSubscriber()
|
||||
export class OrganizationSubscriber {
|
||||
|
||||
/**
|
||||
* Sends welcome SMS once the organization build completed.
|
||||
*/
|
||||
@On(events.organization.build)
|
||||
public async onBuild(payload) {
|
||||
const { tenant, user } = payload;
|
||||
public async onBuild({ tenant, user }) {
|
||||
const agenda = Container.get('agenda');
|
||||
|
||||
await agenda.now('welcome-sms', { tenant, user });
|
||||
|
||||
await agenda.now('welcome-sms', { tenant, user });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user