mirror of
https://github.com/IT4Change/gradido.git
synced 2026-01-20 20:01:31 +00:00
linting
This commit is contained in:
parent
a921625f4a
commit
b10f9245b6
@ -26,7 +26,6 @@ import { hasElopageBuys } from '@/util/hasElopageBuys'
|
||||
log4js.configure(CONFIG.LOG4JS_CONFIG)
|
||||
const logger = log4js.getLogger('graphql.resolver.UserResolver')
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const sodium = require('sodium-native')
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
@ -223,31 +222,31 @@ export class UserResolver {
|
||||
): Promise<User> {
|
||||
email = email.trim().toLowerCase()
|
||||
const dbUser = await DbUser.findOneOrFail({ email }, { withDeleted: true }).catch(() => {
|
||||
logger.error('User does not exists with this email=' + email)
|
||||
logger.error('User does not exists with this email=' + email)
|
||||
throw new Error('No user with this credentials')
|
||||
})
|
||||
if (dbUser.deletedAt) {
|
||||
logger.error('The User was permanently deleted in database. email=' + email)
|
||||
logger.error('The User was permanently deleted in database. email=' + email)
|
||||
throw new Error('This user was permanently deleted. Contact support for questions.')
|
||||
}
|
||||
if (!dbUser.emailChecked) {
|
||||
logger.error('The Users email is not validate yet. email=' + email)
|
||||
logger.error('The Users email is not validate yet. email=' + email)
|
||||
throw new Error('User email not validated')
|
||||
}
|
||||
if (dbUser.password === BigInt(0)) {
|
||||
logger.error('The User has not set a password yet. email=' + email)
|
||||
logger.error('The User has not set a password yet. email=' + email)
|
||||
// TODO we want to catch this on the frontend and ask the user to check his emails or resend code
|
||||
throw new Error('User has no password set yet')
|
||||
}
|
||||
if (!dbUser.pubKey || !dbUser.privKey) {
|
||||
logger.error('The User has no private or publicKey. email=' + email)
|
||||
logger.error('The User has no private or publicKey. email=' + email)
|
||||
// TODO we want to catch this on the frontend and ask the user to check his emails or resend code
|
||||
throw new Error('User has no private or publicKey')
|
||||
}
|
||||
const passwordHash = SecretKeyCryptographyCreateKey(email, password) // return short and long hash
|
||||
const loginUserPassword = BigInt(dbUser.password.toString())
|
||||
if (loginUserPassword !== passwordHash[0].readBigUInt64LE()) {
|
||||
logger.error('The User has no valid credentials. email=' + email)
|
||||
logger.error('The User has no valid credentials. email=' + email)
|
||||
throw new Error('No user with this credentials')
|
||||
}
|
||||
|
||||
|
||||
@ -38,7 +38,6 @@ logger.error('This little thing had roast beef')
|
||||
logger.fatal('This little thing had none')
|
||||
logger.trace('and this little thing went wee, wee, wee, all the way home.')
|
||||
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const createServer = async (context: any = serverContext): Promise<ServerDef> => {
|
||||
// open mysql connection
|
||||
|
||||
@ -21,8 +21,6 @@ const setHeadersPlugin = {
|
||||
|
||||
// const requestDidStartLog = (requestContext: any): void => {
|
||||
|
||||
|
||||
|
||||
// }
|
||||
|
||||
const logPlugin = {
|
||||
@ -33,8 +31,8 @@ const logPlugin = {
|
||||
return {
|
||||
willSendResponse(requestContext: any) {
|
||||
// console.log(requestContext)
|
||||
logger.trace('Response-Data:' + JSON.stringify(requestContext.response.errors, null, 2))
|
||||
logger.trace('Response-Errors:' + JSON.stringify(requestContext.response.data, null, 2))
|
||||
logger.trace('Response-Data:' + JSON.stringify(requestContext.response.errors, null, 2))
|
||||
logger.trace('Response-Errors:' + JSON.stringify(requestContext.response.data, null, 2))
|
||||
return requestContext
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user