Skip to content
This repository has been archived by the owner on Nov 29, 2021. It is now read-only.

Commit

Permalink
fix: revert
Browse files Browse the repository at this point in the history
  • Loading branch information
YanceyOfficial committed Sep 24, 2020
1 parent 5478bfc commit b8b8d80
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
30 changes: 17 additions & 13 deletions src/auth/auth.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,23 @@ export class AuthService {
}

public async login(loginInput: LoginInput) {
const { email, password, token } = loginInput
const { success, 'error-codes': errorCodes } = await this.verifyGoogleRecaptchaToken(token)

if (success) {
const res = await this.validateUser(email, password)
return this.generateJWT(email, res)
}

throw new AuthenticationError(
errorCodes
? errorCodes.toString()
: 'Google Recaptcha verification failed. Please try again!',
)
// const { email, password, token } = loginInput
// const { success, 'error-codes': errorCodes } = await this.verifyGoogleRecaptchaToken(token)

// if (success) {
// const res = await this.validateUser(email, password)
// return this.generateJWT(email, res)
// }

// throw new AuthenticationError(
// errorCodes
// ? errorCodes.toString()
// : 'Google Recaptcha verification failed. Please try again!',
// )

const { email, password } = loginInput
const res = await this.validateUser(email, password)
return this.generateJWT(email, res)
}

public async register(registerInput: RegisterInput) {
Expand Down
1 change: 1 addition & 0 deletions test/auth.DO_NOT_TEST_ME.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ describe('AuthController (e2e)', () => {
const loginData: LoginInput = {
email: `${randomSeries(10)}@example.com`,
password: 'abcd1234,',
token: '',
}

const registerData: RegisterInput = {
Expand Down

0 comments on commit b8b8d80

Please sign in to comment.