mirror of
https://github.com/IT4Change/gradido.git
synced 2026-04-06 01:25:28 +00:00
test language, make pubkey unique, migrations dir from config
This commit is contained in:
parent
dc6459f45c
commit
5c79d34ef3
@ -185,6 +185,25 @@ describe('UserResolver', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('unknown language', () => {
|
||||||
|
it('sets "de" as default language', async () => {
|
||||||
|
await mutate({
|
||||||
|
mutation,
|
||||||
|
variables: { ...variables, email: 'bibi@bloxberg.de', language: 'es' },
|
||||||
|
})
|
||||||
|
await expect(
|
||||||
|
getRepository(LoginUser).createQueryBuilder('login_user').getMany(),
|
||||||
|
).resolves.toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
|
expect.objectContaining({
|
||||||
|
email: 'bibi@bloxberg.de',
|
||||||
|
language: 'de',
|
||||||
|
}),
|
||||||
|
]),
|
||||||
|
)
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -26,6 +26,7 @@ import { signIn } from '../../apis/KlicktippController'
|
|||||||
import { RIGHTS } from '../../auth/RIGHTS'
|
import { RIGHTS } from '../../auth/RIGHTS'
|
||||||
import { ServerUserRepository } from '../../typeorm/repository/ServerUser'
|
import { ServerUserRepository } from '../../typeorm/repository/ServerUser'
|
||||||
import { ROLE_ADMIN } from '../../auth/ROLES'
|
import { ROLE_ADMIN } from '../../auth/ROLES'
|
||||||
|
import { randomBytes } from 'crypto'
|
||||||
|
|
||||||
const EMAIL_OPT_IN_RESET_PASSWORD = 2
|
const EMAIL_OPT_IN_RESET_PASSWORD = 2
|
||||||
const EMAIL_OPT_IN_REGISTER = 1
|
const EMAIL_OPT_IN_REGISTER = 1
|
||||||
@ -432,7 +433,7 @@ export class UserResolver {
|
|||||||
dbUser.lastName = lastName
|
dbUser.lastName = lastName
|
||||||
dbUser.username = username
|
dbUser.username = username
|
||||||
// TODO this field has no null allowed unlike the loginServer table
|
// TODO this field has no null allowed unlike the loginServer table
|
||||||
dbUser.pubkey = Buffer.alloc(32, 0) // default to 0000...
|
dbUser.pubkey = Buffer.from(randomBytes(32)) // Buffer.alloc(32, 0) default to 0000...
|
||||||
// dbUser.pubkey = keyPair[0]
|
// dbUser.pubkey = keyPair[0]
|
||||||
|
|
||||||
await queryRunner.manager.save(dbUser).catch((er) => {
|
await queryRunner.manager.save(dbUser).catch((er) => {
|
||||||
|
|||||||
@ -18,7 +18,7 @@ const migration = new Migration({
|
|||||||
conn: pool,
|
conn: pool,
|
||||||
tableName: CONFIG.MIGRATIONS_TABLE,
|
tableName: CONFIG.MIGRATIONS_TABLE,
|
||||||
silent: true,
|
silent: true,
|
||||||
dir: '../database/migrations/', // CONFIG.MIGRATIONS_DIRECTORY,
|
dir: CONFIG.MIGRATIONS_DIRECTORY,
|
||||||
})
|
})
|
||||||
|
|
||||||
const initialize = async (): Promise<void> => {
|
const initialize = async (): Promise<void> => {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user