sub2api icon indicating copy to clipboard operation
sub2api copied to clipboard

Feature: Auto-assign default subscription group on user registration

Open xsha511 opened this issue 9 months ago • 1 comments

Background

Currently, when a new user registers, they only receive a default balance and concurrency setting. There is no mechanism to automatically assign them to a subscription group. Administrators must manually assign subscriptions via the admin panel (/admin/subscriptions/assign) or generate separate subscription redeem codes for each user.

Problem

  • The registration flow (RegisterWithVerification) only sets Balance and Concurrency from DefaultConfig, with no subscription group assignment.
  • Invitation codes (RedeemTypeInvitation) only validate and mark as used — they don't carry any subscription assignment.
  • Promo codes only add balance (UpdateBalance), no subscription support.
  • There is no "default subscription group" concept in system settings.

This means for platforms that use subscription-based access control (exclusive groups), every new user requires manual admin intervention or a separate redeem code to get access.

Proposed Solution

Add a default subscription group setting in system settings, so that when a new user registers, they are automatically assigned to the configured group(s).

Option A: System-level default (simpler)

Add new settings:

  • default_subscription_group_id — Group ID to auto-assign on registration
  • default_subscription_validity_days — Subscription duration (e.g., 30 days)

In RegisterWithVerification, after user creation, call AssignSubscription if the default group is configured.

Option B: Invitation code with subscription binding (more flexible)

Allow invitation codes to optionally carry a group_id and validity_days. When used during registration, automatically assign the subscription in addition to validating the invitation.

This would reuse the existing RedeemCode model (which already has GroupID and ValidityDays fields) but extend the registration flow to process these fields for invitation-type codes as well.

Use Case

Platforms offering subscription-based access where all new users should start with a default plan (e.g., a "Standard" tier with daily/weekly/monthly limits), without requiring manual admin action for each registration.

xsha511 avatar Mar 01 '26 17:03 xsha511

#706

PMExtra avatar Mar 04 '26 17:03 PMExtra