feat(server): remove phone number from authentication endpoints

This commit is contained in:
a.bouhuolia
2023-04-05 23:57:26 +02:00
parent 4a22576d88
commit 85b24c7a4f
9 changed files with 42 additions and 51 deletions

View File

@@ -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');

View File

@@ -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,

View File

@@ -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',