forked from Nixius/authelia
1
0
Fork 0

Grant active subscription on payment: add user to customers group in success + webhook

Made-with: Cursor
This commit is contained in:
Leopere 2026-03-04 18:35:43 -05:00
parent d2c8327d8c
commit 00e6320b99
Signed by: colin
SSH Key Fingerprint: SHA256:nRPCQTeMFLdGytxRQmPVK9VXY3/ePKQ5lGRyJhT5DY8
2 changed files with 8 additions and 0 deletions

View File

@ -149,6 +149,11 @@ func (a *App) handleSuccess(w http.ResponseWriter, r *http.Request) {
}
}
// Grant active subscription: add to customers group so dashboard shows subscribed.
if err := a.ldap.AddToGroup(result.Username, "customers"); err != nil {
log.Printf("ldap add to customers failed for %s: %v", result.Username, err)
}
inGroup, _ := a.ldap.IsInGroup(result.Username, "customers")
if result.IsNew || !inGroup {

View File

@ -73,6 +73,9 @@ func (a *App) onCheckoutCompleted(event stripego.Event) {
if err := a.ldap.EnsureUser(username, email, customerID, phone); err != nil {
log.Printf("webhook: ldap ensure user failed: %v", err)
}
if err := a.ldap.AddToGroup(username, "customers"); err != nil {
log.Printf("webhook: ldap add to customers failed for %s: %v", username, err)
}
if sess.Metadata != nil {
if d := sess.Metadata["customer_domain"]; d != "" {
if err := a.ldap.SetCustomerDomain(username, d); err != nil {