@@ -2,7 +2,6 @@ import * as Joi from 'joi'
2
2
import bytesToUuid = require( 'uuid/lib/bytesToUuid' )
3
3
4
4
import { PasswordComplexConfiguration } from '../../api/PasswordComplexConfiguration'
5
- import { errors } from '../../errors/errors'
6
5
import { validatePassword } from '../../helpers/validatePassword'
7
6
import { AccountsController } from '../../modules/Accounts/Accounts.controller'
8
7
import { SendEmailTo } from '../../utils/SendEmail'
@@ -19,16 +18,8 @@ export const CreateAccountSchema = (
19
18
export const CreateAccount = ( sendEmail : SendEmailTo , verifiedAccount : boolean , pwnedCheckerRoot : string ) => async (
20
19
ctx : any ,
21
20
) : Promise < any > => {
22
- const logger = ctx . logger ( __dirname )
23
-
24
- try {
25
- const usersController = new AccountsController ( ctx . logger , verifiedAccount , pwnedCheckerRoot , sendEmail )
26
- const { email, password } = ctx . request . body
27
- const { account : { id, issuer } , token } = await usersController . create ( { email, password } )
28
- ctx . body = { id : bytesToUuid ( id ) , issuer, token }
29
- } catch ( exception ) {
30
- const { AccountAlreadyExists } = errors
31
- logger . error ( { exception } , 'api.CreateAccount' )
32
- ctx . throw ( AccountAlreadyExists . code , AccountAlreadyExists . message )
33
- }
21
+ const usersController = new AccountsController ( ctx . logger , verifiedAccount , pwnedCheckerRoot , sendEmail )
22
+ const { email, password } = ctx . request . body
23
+ const { account : { id, issuer } , token } = await usersController . create ( { email, password } )
24
+ ctx . body = { id : bytesToUuid ( id ) , issuer, token }
34
25
}
0 commit comments