fix: add location middleware to get exact host

This commit is contained in:
Lakhan Samani
2021-08-04 15:55:13 +05:30
parent f88363e6dc
commit 104adfea1d
21 changed files with 102 additions and 70 deletions

View File

@@ -13,25 +13,19 @@ import (
)
func ResendVerifyEmail(ctx context.Context, params model.ResendVerifyEmailInput) (*model.Response, error) {
gc, err := utils.GinContextFromContext(ctx)
var res *model.Response
if err != nil {
return res, err
}
params.Email = strings.ToLower(params.Email)
if !utils.IsValidEmail(params.Email) {
return res, fmt.Errorf("invalid email")
}
host := gc.Request.Host
verificationRequest, err := db.Mgr.GetVerificationByEmail(params.Email)
if err != nil {
return res, fmt.Errorf(`verification request not found`)
}
token, err := utils.CreateVerificationToken(params.Email, verificationRequest.Identifier, host)
token, err := utils.CreateVerificationToken(params.Email, verificationRequest.Identifier)
if err != nil {
log.Println(`Error generating token`, err)
}