mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-21 15:20:34 +00:00
fix: remove organization name in register form.
This commit is contained in:
@@ -2,10 +2,9 @@ import { Request, Response, Router } from 'express';
|
|||||||
import { check, ValidationChain } from 'express-validator';
|
import { check, ValidationChain } from 'express-validator';
|
||||||
import { Service, Inject } from 'typedi';
|
import { Service, Inject } from 'typedi';
|
||||||
import BaseController from 'api/controllers/BaseController';
|
import BaseController from 'api/controllers/BaseController';
|
||||||
import validateMiddleware from 'api/middleware/validateMiddleware';
|
|
||||||
import asyncMiddleware from 'api/middleware/asyncMiddleware';
|
import asyncMiddleware from 'api/middleware/asyncMiddleware';
|
||||||
import AuthenticationService from 'services/Authentication';
|
import AuthenticationService from 'services/Authentication';
|
||||||
import { IUserOTD, ISystemUser, IRegisterOTD } from 'interfaces';
|
import { ILoginDTO, ISystemUser, IRegisterOTD } from 'interfaces';
|
||||||
import { ServiceError, ServiceErrors } from "exceptions";
|
import { ServiceError, ServiceErrors } from "exceptions";
|
||||||
|
|
||||||
@Service()
|
@Service()
|
||||||
@@ -61,7 +60,6 @@ export default class AuthenticationController extends BaseController{
|
|||||||
*/
|
*/
|
||||||
get registerSchema(): ValidationChain[] {
|
get registerSchema(): ValidationChain[] {
|
||||||
return [
|
return [
|
||||||
check('organization_name').exists().trim().escape(),
|
|
||||||
check('first_name').exists().trim().escape(),
|
check('first_name').exists().trim().escape(),
|
||||||
check('last_name').exists().trim().escape(),
|
check('last_name').exists().trim().escape(),
|
||||||
check('email').exists().isEmail().trim().escape(),
|
check('email').exists().isEmail().trim().escape(),
|
||||||
@@ -102,7 +100,7 @@ export default class AuthenticationController extends BaseController{
|
|||||||
* @param {Response} res
|
* @param {Response} res
|
||||||
*/
|
*/
|
||||||
async login(req: Request, res: Response, next: Function): Response {
|
async login(req: Request, res: Response, next: Function): Response {
|
||||||
const userDTO: IUserOTD = this.matchedBodyData(req);
|
const userDTO: ILoginDTO = this.matchedBodyData(req);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { token, user, tenant } = await this.authService.signIn(
|
const { token, user, tenant } = await this.authService.signIn(
|
||||||
|
|||||||
@@ -9,6 +9,11 @@ export interface IRegisterDTO {
|
|||||||
organizationName: string,
|
organizationName: string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export interface ILoginDTO {
|
||||||
|
crediential: string,
|
||||||
|
password: string,
|
||||||
|
};
|
||||||
|
|
||||||
export interface IPasswordReset {
|
export interface IPasswordReset {
|
||||||
id: number,
|
id: number,
|
||||||
email: string,
|
email: string,
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ export default class AuthenticationService implements IAuthenticationService {
|
|||||||
|
|
||||||
const { systemUserRepository } = this.sysRepositories;
|
const { systemUserRepository } = this.sysRepositories;
|
||||||
const registeredUser = await systemUserRepository.create({
|
const registeredUser = await systemUserRepository.create({
|
||||||
...omit(registerDTO, 'country', 'organizationName'),
|
...omit(registerDTO, 'country'),
|
||||||
active: true,
|
active: true,
|
||||||
password: hashedPassword,
|
password: hashedPassword,
|
||||||
tenant_id: tenant.id,
|
tenant_id: tenant.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user