Basic logout flow and better UX
This commit is contained in:
@ -4,7 +4,6 @@ import (
|
||||
"bytes"
|
||||
"context"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"forge.cadoles.com/wpetit/hydra-passwordless/internal/config"
|
||||
"forge.cadoles.com/wpetit/hydra-passwordless/internal/hydra"
|
||||
@ -23,6 +22,9 @@ type SendConfirmationEmailRequest struct {
|
||||
Challenge string
|
||||
DefaultScheme string
|
||||
DefaultAddress string
|
||||
RememberMe bool
|
||||
ClientName string
|
||||
ClientURI string
|
||||
}
|
||||
|
||||
func HandleSendConfirmationEmailRequest(ctx context.Context, cmd cqrs.Command) error {
|
||||
@ -48,6 +50,7 @@ func HandleSendConfirmationEmailRequest(ctx context.Context, cmd cqrs.Command) e
|
||||
conf.HTTP.TokenEncryptionKey,
|
||||
req.Email,
|
||||
req.Challenge,
|
||||
req.RememberMe,
|
||||
)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not generate jwt")
|
||||
@ -67,13 +70,11 @@ func HandleSendConfirmationEmailRequest(ctx context.Context, cmd cqrs.Command) e
|
||||
scheme = conf.HTTP.PublicScheme
|
||||
}
|
||||
|
||||
log.Println(req, scheme)
|
||||
|
||||
verificationLink := fmt.Sprintf("%s//%s/verify?token=%s", scheme, address, token)
|
||||
|
||||
log.Println(verificationLink)
|
||||
|
||||
data := template.Data{
|
||||
"ClientName": req.ClientName,
|
||||
"ClientURI": req.ClientURI,
|
||||
"BuildInfo": info,
|
||||
"VerificationLink": verificationLink,
|
||||
}
|
||||
@ -92,7 +93,7 @@ func HandleSendConfirmationEmailRequest(ctx context.Context, cmd cqrs.Command) e
|
||||
err = ml.Send(
|
||||
mail.WithSender(conf.SMTP.SenderAddress, conf.SMTP.SenderName),
|
||||
mail.WithRecipients(req.Email),
|
||||
mail.WithSubject(fmt.Sprintf("[Authentification]")),
|
||||
mail.WithSubject(fmt.Sprintf("[%s] Connexion", req.ClientName)),
|
||||
mail.WithBody(mail.ContentTypeHTML, html, nil),
|
||||
mail.WithAlternativeBody(mail.ContentTypeText, "", nil),
|
||||
)
|
||||
|
Reference in New Issue
Block a user