forked from Nixius/authelia
1
0
Fork 0

Redirect paid-but-not-activated users from landing to /activate

If a logged-in user has a Stripe customer ID but isn't in the customers
group yet, they've paid but haven't activated. Send them to /activate
instead of showing "No Active Subscription".

Made-with: Cursor
This commit is contained in:
Leopere 2026-03-03 18:07:57 -05:00
parent 91c0411b90
commit 1f8f50d50b
Signed by: colin
SSH Key Fingerprint: SHA256:nRPCQTeMFLdGytxRQmPVK9VXY3/ePKQ5lGRyJhT5DY8
1 changed files with 12 additions and 0 deletions

View File

@ -10,10 +10,22 @@ import (
)
func (a *App) handleLanding(w http.ResponseWriter, r *http.Request) {
remoteUser := r.Header.Get("Remote-User")
if contains(r.Header.Get("Remote-Groups"), "customers") {
http.Redirect(w, r, a.cfg.AppURL+"/dashboard", http.StatusSeeOther)
return
}
// Logged-in user who paid but hasn't activated yet — send to activate.
if remoteUser != "" {
custID, _ := a.ldap.GetStripeCustomerID(remoteUser)
if custID != "" {
http.Redirect(w, r, a.cfg.AppURL+"/activate", http.StatusSeeOther)
return
}
}
data := map[string]any{
"AppURL": a.cfg.AppURL,
"Commit": version.Commit,