2024-05-14 20:53:47 +00:00
|
|
|
class Features:
|
|
|
|
def __init__(self, app):
|
|
|
|
self.app = app
|
|
|
|
|
|
|
|
@property
|
|
|
|
def has_smtp(self):
|
2024-05-14 21:04:32 +00:00
|
|
|
return bool(self.app.config["CANAILLE"]["SMTP"])
|
2024-05-14 20:53:47 +00:00
|
|
|
|
|
|
|
@property
|
|
|
|
def has_oidc(self):
|
|
|
|
return "CANAILLE_OIDC" in self.app.config
|
|
|
|
|
|
|
|
@property
|
|
|
|
def has_password_recovery(self):
|
|
|
|
return self.app.config["CANAILLE"]["ENABLE_PASSWORD_RECOVERY"]
|
|
|
|
|
2024-12-05 10:42:51 +00:00
|
|
|
@property
|
|
|
|
def has_intruder_lockout(self):
|
|
|
|
return self.app.config["CANAILLE"]["ENABLE_INTRUDER_LOCKOUT"]
|
|
|
|
|
2024-10-25 07:51:01 +00:00
|
|
|
@property
|
2024-11-14 08:49:19 +00:00
|
|
|
def otp_method(self):
|
|
|
|
return self.app.config["CANAILLE"]["OTP_METHOD"]
|
|
|
|
|
|
|
|
@property
|
|
|
|
def has_otp(self):
|
|
|
|
return bool(self.app.config["CANAILLE"]["OTP_METHOD"])
|
2024-10-25 07:51:01 +00:00
|
|
|
|
2024-11-18 13:16:38 +00:00
|
|
|
@property
|
|
|
|
def has_email_otp(self):
|
|
|
|
return bool(self.app.config["CANAILLE"]["EMAIL_OTP"])
|
|
|
|
|
2024-11-29 09:32:17 +00:00
|
|
|
@property
|
|
|
|
def has_sms_otp(self):
|
|
|
|
return self.app.config["CANAILLE"]["SMS_OTP"]
|
|
|
|
|
2024-05-14 20:53:47 +00:00
|
|
|
@property
|
|
|
|
def has_registration(self):
|
|
|
|
return self.app.config["CANAILLE"]["ENABLE_REGISTRATION"]
|
|
|
|
|
|
|
|
@property
|
|
|
|
def has_account_lockability(self):
|
|
|
|
return self.app.backend.instance.has_account_lockability()
|
|
|
|
|
|
|
|
@property
|
|
|
|
def has_email_confirmation(self):
|
|
|
|
return self.app.config["CANAILLE"]["EMAIL_CONFIRMATION"] is True or (
|
|
|
|
self.app.config["CANAILLE"]["EMAIL_CONFIRMATION"] is None and self.has_smtp
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def setup_features(app):
|
|
|
|
app.features = Features(app)
|