fix(order): reconcile subscriptions and grant device trials
Build docker and publish / build (20.15.1) (push) Has been cancelled

This commit is contained in:
2026-04-29 20:43:18 -07:00
parent 79427c9f4c
commit 47696b9e68
3 changed files with 139 additions and 17 deletions
+11 -4
View File
@@ -54,12 +54,19 @@ func ShouldGrantTrialForEmail(register config.RegisterConfig, email string) bool
return true
}
// IsTrialConfigReady verifies that trial auto-grant has all required config.
func IsTrialConfigReady(register config.RegisterConfig) bool {
return register.EnableTrial &&
register.TrialSubscribe > 0 &&
register.TrialTime > 0 &&
strings.TrimSpace(register.TrialTimeUnit) != ""
}
// ShouldAutoGrantTrialOnPublicEmailFlows defines whether browser/email-originated
// flows may auto-create a trial subscription. The current policy disables trial
// creation for email registration, email login auto-register, OAuth-with-email,
// and email binding/verification to avoid abuse through public email channels.
// flows may auto-create a trial subscription. Email-specific abuse protection
// is still handled by ShouldGrantTrialForEmail and NormalizedEmailHasTrial.
func ShouldAutoGrantTrialOnPublicEmailFlows(register config.RegisterConfig) bool {
return false
return IsTrialConfigReady(register)
}
// IsDisposableAlias detects Gmail dot trick and + alias abuse.