dark_theme #1

Merged
absurdo merged 3 commits from dark_theme into master 2023-11-26 20:26:36 +00:00
3 changed files with 14 additions and 4 deletions
Showing only changes of commit 6f6ede7cc7 - Show all commits

View file

@ -25,7 +25,9 @@ def ausers():
user_admin.fields['last_login'].name_form=HiddenForm
user_admin.create_forms(['username', 'password', 'email', 'privileges', 'lang', 'disabled', 'double_auth', 'last_login'])
user_admin.fields['dark_theme'].name_form=SelectForm
user_admin.create_forms(['username', 'password', 'email', 'privileges', 'lang', 'dark_theme', 'disabled', 'double_auth', 'last_login'])
user_admin.forms['privileges'].arr_select={0: I18n.lang('admin', 'without_privileges', 'Without privileges'), 1: I18n.lang('admin', 'selected_privileges', 'Selected privileges'), 2: I18n.lang('admin', 'administrator', 'Administrator')}
@ -35,6 +37,8 @@ def ausers():
user_admin.fields['password'].protected=False
user_admin.forms['dark_theme'].arr_select={0: I18n.lang('admin', 'light_theme', 'Light theme'), 1: I18n.lang('admin', 'dark_theme', 'Dark theme')}
user_admin.check_user=False
user_admin.check_email=False
@ -46,7 +50,7 @@ def ausers():
admin.list.search_fields=['username']
admin.arr_fields_edit=['username', 'password', 'repeat_password', 'email', 'lang', 'double_auth', 'disabled', 'last_login']
admin.arr_fields_edit=['username', 'password', 'repeat_password', 'email', 'lang', 'dark_theme', 'double_auth', 'disabled', 'last_login']
form_admin=admin.show()

View file

@ -252,7 +252,11 @@ def login():
sendmail.send(config.portal_email, [arr_user['email']], I18n.lang('admin', 'code_for_complete_login', 'Code for complete login'), I18n.lang('admin', 'code_for_complete_login_explain', 'We send to you a code for activate your account using double authentication:')+"\n"+token_auth, content_type='plain', attachments=[])
if arr_user['dark_theme']:
session['theme']='1'
else:
session['theme']='0'
arr_update['last_login']=now()
if len(arr_update)>0:
@ -399,7 +403,7 @@ def auth_check():
def change_theme():
theme_selected=str(request.args.get('theme', '0'))
print('Theme '+theme_selected)
session['theme']=theme_selected
error=0

View file

@ -94,6 +94,8 @@ class UserAdmin(UserModel):
self.register(corefields.BooleanField('double_auth'))
self.register(corefields.BooleanField('dark_theme'))
#self.register(corefields.IntegerField('num_tries', 1))
self.register(DateTimeField('last_login'))