This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
package auth
|
||||
|
||||
import "strings"
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/perfect-panel/server/internal/config"
|
||||
)
|
||||
|
||||
// IsEmailDomainWhitelisted checks if the email's domain is in the comma-separated whitelist.
|
||||
// Returns false if the email format is invalid.
|
||||
@@ -20,3 +24,16 @@ func IsEmailDomainWhitelisted(email, whitelistCSV string) bool {
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func ShouldGrantTrialForEmail(register config.RegisterConfig, email string) bool {
|
||||
if !register.EnableTrial {
|
||||
return false
|
||||
}
|
||||
if !register.EnableTrialEmailWhitelist {
|
||||
return true
|
||||
}
|
||||
if register.TrialEmailDomainWhitelist == "" {
|
||||
return false
|
||||
}
|
||||
return IsEmailDomainWhitelisted(email, register.TrialEmailDomainWhitelist)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user