fix: format logs
This commit is contained in:
@@ -22,43 +22,43 @@ func ResendVerifyEmailResolver(ctx context.Context, params model.ResendVerifyEma
|
||||
|
||||
gc, err := utils.GinContextFromContext(ctx)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get GinContext", err)
|
||||
log.Debug("Failed to get GinContext: ", err)
|
||||
return res, err
|
||||
}
|
||||
params.Email = strings.ToLower(params.Email)
|
||||
|
||||
if !utils.IsValidEmail(params.Email) {
|
||||
log.Debug("Invalid email", params.Email)
|
||||
log.Debug("Invalid email: ", params.Email)
|
||||
return res, fmt.Errorf("invalid email")
|
||||
}
|
||||
|
||||
if !utils.IsValidVerificationIdentifier(params.Identifier) {
|
||||
log.Debug("Invalid verification identifier", params.Identifier)
|
||||
log.Debug("Invalid verification identifier: ", params.Identifier)
|
||||
return res, fmt.Errorf("invalid identifier")
|
||||
}
|
||||
|
||||
verificationRequest, err := db.Provider.GetVerificationRequestByEmail(params.Email, params.Identifier)
|
||||
if err != nil {
|
||||
log.Debug("Failed to get verification request", err)
|
||||
log.Debug("Failed to get verification request: ", err)
|
||||
return res, fmt.Errorf(`verification request not found`)
|
||||
}
|
||||
|
||||
// delete current verification and create new one
|
||||
err = db.Provider.DeleteVerificationRequest(verificationRequest)
|
||||
if err != nil {
|
||||
log.Debug("Failed to delete verification request", err)
|
||||
log.Debug("Failed to delete verification request: ", err)
|
||||
}
|
||||
|
||||
hostname := utils.GetHost(gc)
|
||||
_, nonceHash, err := utils.GenerateNonce()
|
||||
if err != nil {
|
||||
log.Debug("Failed to generate nonce", err)
|
||||
log.Debug("Failed to generate nonce: ", err)
|
||||
return res, err
|
||||
}
|
||||
|
||||
verificationToken, err := token.CreateVerificationToken(params.Email, params.Identifier, hostname, nonceHash, verificationRequest.RedirectURI)
|
||||
if err != nil {
|
||||
log.Debug("Failed to create verification token", err)
|
||||
log.Debug("Failed to create verification token: ", err)
|
||||
}
|
||||
_, err = db.Provider.AddVerificationRequest(models.VerificationRequest{
|
||||
Token: verificationToken,
|
||||
@@ -69,7 +69,7 @@ func ResendVerifyEmailResolver(ctx context.Context, params model.ResendVerifyEma
|
||||
RedirectURI: verificationRequest.RedirectURI,
|
||||
})
|
||||
if err != nil {
|
||||
log.Debug("Failed to add verification request", err)
|
||||
log.Debug("Failed to add verification request: ", err)
|
||||
}
|
||||
|
||||
// exec it as go routin so that we can reduce the api latency
|
||||
|
Reference in New Issue
Block a user