BaseURL configuration variable generalization

This commit is contained in:
2022-03-25 15:11:29 +01:00
parent 41748363d1
commit 33dbb6ea47
9 changed files with 51 additions and 40 deletions

View File

@ -18,13 +18,12 @@ import (
)
type SendConfirmationEmailRequest struct {
Email string
Challenge string
DefaultScheme string
DefaultAddress string
RememberMe bool
ClientName string
ClientURI string
Email string
Challenge string
BaseURL string
RememberMe bool
ClientName string
ClientURI string
}
func HandleSendConfirmationEmailRequest(ctx context.Context, cmd cqrs.Command) error {
@ -56,21 +55,7 @@ func HandleSendConfirmationEmailRequest(ctx context.Context, cmd cqrs.Command) e
return errors.Wrap(err, "could not generate jwt")
}
address := req.DefaultAddress
if conf.HTTP.PublicAddress != "" {
address = conf.HTTP.PublicAddress
}
scheme := req.DefaultScheme
if scheme == "" {
scheme = "http:"
}
if conf.HTTP.PublicScheme != "" {
scheme = conf.HTTP.PublicScheme
}
verificationLink := fmt.Sprintf("%s//%s/verify?token=%s", scheme, address, token)
verificationLink := fmt.Sprintf("%s/verify?token=%s", req.BaseURL, token)
data := template.Data{
"ClientName": req.ClientName,