diff --git a/docker/ss-atlas/internal/handlers/authelia.go b/docker/ss-atlas/internal/handlers/authelia.go index 5cf6c7a..432fd72 100644 --- a/docker/ss-atlas/internal/handlers/authelia.go +++ b/docker/ss-atlas/internal/handlers/authelia.go @@ -4,10 +4,27 @@ import ( "bytes" "encoding/json" "fmt" + "log" "net/http" "strings" ) +func (a *App) handleResendReset(w http.ResponseWriter, r *http.Request) { + username := r.FormValue("username") + if username == "" { + http.Error(w, "username required", http.StatusBadRequest) + return + } + if err := a.triggerPasswordReset(username); err != nil { + log.Printf("resend-reset: failed for %s: %v", username, err) + http.Error(w, "failed to send email", http.StatusInternalServerError) + return + } + log.Printf("resend-reset: password reset email sent for %s", username) + w.WriteHeader(http.StatusOK) + w.Write([]byte("Password setup email sent. Check your inbox.")) +} + func (a *App) triggerPasswordReset(username string) error { body, _ := json.Marshal(map[string]string{"username": username}) diff --git a/docker/ss-atlas/internal/handlers/routes.go b/docker/ss-atlas/internal/handlers/routes.go index 1c399b3..9bb15f9 100644 --- a/docker/ss-atlas/internal/handlers/routes.go +++ b/docker/ss-atlas/internal/handlers/routes.go @@ -47,6 +47,7 @@ func NewRouter(cfg *config.Config, sc *ssstripe.Client, lc *ldap.Client, sw *swa r.Get("/dashboard", app.handleDashboard) r.Post("/stack-manage", app.handleStackManage) r.Post("/subscribe", app.handleCreateCheckout) + r.Post("/resend-reset", app.handleResendReset) r.Post("/portal", app.handlePortal) r.Post("/resubscribe", app.handleResubscribe) r.Post("/webhook/stripe", app.handleWebhook) diff --git a/docker/ss-atlas/internal/handlers/subscription.go b/docker/ss-atlas/internal/handlers/subscription.go index 8e5eb0e..62f6d23 100644 --- a/docker/ss-atlas/internal/handlers/subscription.go +++ b/docker/ss-atlas/internal/handlers/subscription.go @@ -85,7 +85,6 @@ func (a *App) handleSuccess(w http.ResponseWriter, r *http.Request) { "IsNew": result.IsNew, "Email": email, "LoginURL": a.cfg.AutheliaURL, - "ResetURL": a.cfg.AutheliaURL + "/#/reset-password/step1", "ActivateURL": a.cfg.AppURL + "/activate", "DashboardURL": a.cfg.AppURL + "/dashboard", "InstanceURL": "https://" + result.Username + "." + a.cfg.CustomerDomain, diff --git a/docker/ss-atlas/templates/pages/welcome.html b/docker/ss-atlas/templates/pages/welcome.html index 387c8c3..bb99202 100644 --- a/docker/ss-atlas/templates/pages/welcome.html +++ b/docker/ss-atlas/templates/pages/welcome.html @@ -177,7 +177,8 @@
{{else}} @@ -204,11 +205,34 @@ {{end}} +