Skip to content

Commit

Permalink
Fix backend e2e tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glutengo committed Jun 3, 2021
1 parent f997cde commit 2917167
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 19 deletions.
1 change: 0 additions & 1 deletion generators/server/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const serverFiles = {
'src/security/decorators/auth-user.decorator.ts',
'src/security/decorators/roles.decorator.ts',
'src/security/index.ts',
'src/security/hash.transformer.ts',
'src/client/header-util.ts',
'src/client/interceptors/logging.interceptor.ts',
'src/service/auth.service.ts',
Expand Down
2 changes: 2 additions & 0 deletions generators/server/templates/server/package.json.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
<%_ } _%>
"@nestjs/swagger": "3.1.0",
"@nestjs/typeorm": "7.1.4",
<%_ if (authenticationType === 'jwt') { _%>
"bcrypt": "5.0.1",
<%_ } _%>
"class-transformer": "0.3.1",
"class-validator": "0.13.1",
"cloud-config-client": "1.4.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Authority } from './authority.entity';
import { Entity, Column, BeforeInsert, BeforeUpdate <%_ if (databaseType !== 'mongodb') { _%>, ManyToMany, JoinTable <%_ } _%> } from 'typeorm';
import { Entity, Column<%_ if (authenticationType === 'jwt') { _%>, BeforeInsert, BeforeUpdate<%_ } _%> <%_ if (databaseType !== 'mongodb') { _%>, ManyToMany, JoinTable <%_ } _%> } from 'typeorm';
import { BaseEntity } from './base/base.entity';
<%_ if (authenticationType === 'jwt') { _%>
import * as bcrypt from 'bcrypt';
import { config } from '../config';
<% } %>

@Entity('nhi_user')
export class User extends BaseEntity {
Expand Down Expand Up @@ -42,11 +44,13 @@ export class User extends BaseEntity {
@Column({ nullable: true })
resetDate?: Date;

<%_ if (authenticationType === 'jwt') { _%>
@BeforeInsert()
@BeforeUpdate()
async hashPassword?(): Promise<void> {
if (this.password) {
this.password = await bcrypt.hash(this.password, config.get('jhipster.security.authentication.jwt.hash-salt-or-rounds'));
}
}
<%_ } _%>
}

This file was deleted.

0 comments on commit 2917167

Please sign in to comment.