mirror of
https://github.com/ail-project/ail-framework.git
synced 2024-11-25 15:27:17 +00:00
chg: [2fa] add instance name in config
This commit is contained in:
parent
0a67441416
commit
d5dccf630d
2 changed files with 5 additions and 1 deletions
|
@ -37,6 +37,9 @@ if config_loader.get_config_boolean('Users', 'force_2fa'):
|
||||||
r_serv_db.hset('ail:2fa', '2fa', 1)
|
r_serv_db.hset('ail:2fa', '2fa', 1)
|
||||||
else:
|
else:
|
||||||
r_serv_db.hset('ail:2fa', '2fa', 0)
|
r_serv_db.hset('ail:2fa', '2fa', 0)
|
||||||
|
|
||||||
|
ail_2fa_name = config_loader.get_config_str('Users', '2fa_name')
|
||||||
|
|
||||||
config_loader = None
|
config_loader = None
|
||||||
|
|
||||||
regex_password = r'^(?=(.*\d){2})(?=.*[a-z])(?=.*[A-Z]).{10,100}$'
|
regex_password = r'^(?=(.*\d){2})(?=.*[a-z])(?=.*[A-Z]).{10,100}$'
|
||||||
|
@ -541,7 +544,7 @@ class AILUser(UserMixin):
|
||||||
def init_setup_2fa(self, create=True):
|
def init_setup_2fa(self, create=True):
|
||||||
if create:
|
if create:
|
||||||
create_user_otp(self.user_id)
|
create_user_otp(self.user_id)
|
||||||
instance_name = 'AIL TEST'
|
instance_name = f'{ail_2fa_name}: {self.user_id}'
|
||||||
return get_user_otp_qr_code(self.user_id, instance_name), get_user_otp_uri(self.user_id, instance_name), get_user_hotp_code(self.user_id)
|
return get_user_otp_qr_code(self.user_id, instance_name), get_user_otp_uri(self.user_id, instance_name), get_user_hotp_code(self.user_id)
|
||||||
|
|
||||||
def setup_2fa(self):
|
def setup_2fa(self):
|
||||||
|
|
|
@ -82,6 +82,7 @@ DiffMaxLineLength = 10000
|
||||||
##### Users #####
|
##### Users #####
|
||||||
[Users]
|
[Users]
|
||||||
force_2fa = False
|
force_2fa = False
|
||||||
|
2fa_name = AIL
|
||||||
|
|
||||||
[AIL_2_AIL]
|
[AIL_2_AIL]
|
||||||
server_host = 0.0.0.0
|
server_host = 0.0.0.0
|
||||||
|
|
Loading…
Reference in a new issue