This repository was archived by the owner on Jul 25, 2021. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ export class User {
4444 @MaxLength ( 40 , { message : 'Surname must be between 1 to 40 characters long' } )
4545 public surname ! : string ;
4646
47- @Column ( )
47+ @Column ( { select : false } )
4848 public password ! : string ;
4949
5050 @Column ( { unique : true } )
Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import sharp from 'sharp';
1313const writeFile = promisify ( _writeFile ) ;
1414const unlink = promisify ( _unlink ) ;
1515
16+
1617export type UserDataToCreate = Pick < User , 'forename' | 'surname' | 'email' | 'password' > ;
1718export type ProfileDataToCreate = Omit < Profile , 'id' | 'user' | 'toJSON' | 'avatar' > & { avatar : string | boolean } ;
1819
@@ -105,7 +106,11 @@ export class UserService {
105106 throw new APIError ( HttpCode . BadRequest , AuthenticateError . AccountNotFound ) ;
106107 }
107108
108- const user = await getRepository ( User ) . findOne ( { email } ) ;
109+ const user = await getRepository ( User )
110+ . createQueryBuilder ( 'user' ) . where ( 'user.email= :email' , { email } )
111+ . addSelect ( 'user.password' )
112+ . getOne ( ) ;
113+
109114 if ( ! user ) {
110115 throw new APIError ( HttpCode . BadRequest , AuthenticateError . AccountNotFound ) ;
111116 }
You can’t perform that action at this time.
0 commit comments