mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 12:50:38 +00:00
feat(server): remove phone number from authentication endpoints
This commit is contained in:
@@ -2,6 +2,7 @@ import { Container, Inject } from 'typedi';
|
||||
import { cloneDeep } from 'lodash';
|
||||
import { Tenant } from '@/system/models';
|
||||
import {
|
||||
IAuthSignedInEventPayload,
|
||||
IAuthSigningInEventPayload,
|
||||
IAuthSignInPOJO,
|
||||
ISystemUser,
|
||||
@@ -22,9 +23,9 @@ export class AuthSigninService {
|
||||
|
||||
/**
|
||||
* Validates the given email and password.
|
||||
* @param {ISystemUser} user
|
||||
* @param {string} email
|
||||
* @param {string} password
|
||||
* @param {ISystemUser} user
|
||||
* @param {string} email
|
||||
* @param {string} password
|
||||
*/
|
||||
public async validateSignIn(
|
||||
user: ISystemUser,
|
||||
@@ -69,7 +70,7 @@ export class AuthSigninService {
|
||||
await this.validateSignIn(user, email, password);
|
||||
|
||||
// Triggers on signing-in event.
|
||||
await this.eventPublisher.emitAsync(events.auth.logining, {
|
||||
await this.eventPublisher.emitAsync(events.auth.signingIn, {
|
||||
email,
|
||||
password,
|
||||
user,
|
||||
@@ -80,12 +81,13 @@ export class AuthSigninService {
|
||||
// Update the last login at of the user.
|
||||
await systemUserRepository.patchLastLoginAt(user.id);
|
||||
|
||||
// Triggers `onLogin` event.
|
||||
await this.eventPublisher.emitAsync(events.auth.login, {
|
||||
// Triggers `onSignIn` event.
|
||||
await this.eventPublisher.emitAsync(events.auth.signIn, {
|
||||
email,
|
||||
password,
|
||||
user,
|
||||
});
|
||||
} as IAuthSignedInEventPayload);
|
||||
|
||||
const tenant = await Tenant.query()
|
||||
.findById(user.tenantId)
|
||||
.withGraphFetched('metadata');
|
||||
|
||||
@@ -39,7 +39,7 @@ export class AuthSignupService {
|
||||
const hashedPassword = await hashPassword(signupDTO.password);
|
||||
|
||||
// Triggers signin up event.
|
||||
await this.eventPublisher.emitAsync(events.auth.registering, {
|
||||
await this.eventPublisher.emitAsync(events.auth.signingUp, {
|
||||
signupDTO,
|
||||
} as IAuthSigningUpEventPayload);
|
||||
|
||||
@@ -52,7 +52,7 @@ export class AuthSignupService {
|
||||
inviteAcceptedAt: moment().format('YYYY-MM-DD'),
|
||||
});
|
||||
// Triggers signed up event.
|
||||
await this.eventPublisher.emitAsync(events.auth.register, {
|
||||
await this.eventPublisher.emitAsync(events.auth.signUp, {
|
||||
signupDTO,
|
||||
tenant,
|
||||
user: registeredUser,
|
||||
|
||||
@@ -14,8 +14,6 @@ export const DATE_FORMATS = [
|
||||
'MMMM dd, YYYY',
|
||||
'EEE, MMMM dd, YYYY',
|
||||
];
|
||||
export const ACCEPTED_CURRENCIES = Object.keys(currencies);
|
||||
|
||||
export const MONTHS = [
|
||||
'january',
|
||||
'february',
|
||||
|
||||
Reference in New Issue
Block a user