dark_theme #1
3 changed files with 14 additions and 4 deletions
|
|
@ -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()
|
||||
|
||||
|
|
|
|||
|
|
@ -252,6 +252,10 @@ 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()
|
||||
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue