forked from Nixius/authelia
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:
parent
91c0411b90
commit
1f8f50d50b
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue