Fixes in sessions
This commit is contained in:
parent
4c937fd543
commit
833e3219ea
4 changed files with 22 additions and 3 deletions
|
|
@ -29,6 +29,19 @@ try:
|
||||||
except:
|
except:
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
flask_session=False
|
||||||
|
|
||||||
|
if hasattr(config, 'flask_session'):
|
||||||
|
|
||||||
|
flask_session=config.flask_session
|
||||||
|
|
||||||
|
if flask_session:
|
||||||
|
|
||||||
|
from flask_session import Session
|
||||||
|
from redis import Redis
|
||||||
|
SESSION_TYPE='redis'
|
||||||
|
SESSION_REDIS=Redis(host='localhost', port=6379)
|
||||||
|
|
||||||
swagger_app=False
|
swagger_app=False
|
||||||
|
|
||||||
if hasattr(config, 'swagger_app'):
|
if hasattr(config, 'swagger_app'):
|
||||||
|
|
@ -150,4 +163,8 @@ def start_app():
|
||||||
from flasgger import Swagger
|
from flasgger import Swagger
|
||||||
swagger=Swagger(app)
|
swagger=Swagger(app)
|
||||||
|
|
||||||
|
if flask_session:
|
||||||
|
app.config.from_object(__name__)
|
||||||
|
Session(app)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ def ausers():
|
||||||
|
|
||||||
user_admin.fields['dark_theme'].name_form=SelectForm
|
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.create_forms(['username', 'password', 'email', 'privileges', 'lang', 'dark_theme', 'disabled', 'double_auth', 'last_login', 'privileges'])
|
||||||
|
|
||||||
user_admin.forms['privileges'].arr_select={0: _('Without privileges'), 1: _('Selected privileges'), 2: _('Administrator')}
|
user_admin.forms['privileges'].arr_select={0: _('Without privileges'), 1: _('Selected privileges'), 2: _('Administrator')}
|
||||||
|
|
||||||
|
|
@ -54,7 +54,7 @@ def ausers():
|
||||||
|
|
||||||
admin.list.search_fields=['username']
|
admin.list.search_fields=['username']
|
||||||
|
|
||||||
admin.arr_fields_edit=['username', 'password', 'repeat_password', 'email', 'lang', 'dark_theme', 'double_auth', 'disabled', 'last_login']
|
admin.arr_fields_edit=['username', 'password', 'repeat_password', 'email', 'lang', 'dark_theme', 'double_auth', 'disabled', 'last_login', 'privileges']
|
||||||
|
|
||||||
admin.post_update=update_lang
|
admin.post_update=update_lang
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ from paramecio2.modules.admin import admin_app, t
|
||||||
from paramecio2.libraries.sendmail import SendMail
|
from paramecio2.libraries.sendmail import SendMail
|
||||||
from paramecio2.libraries.formsutils import check_csrf
|
from paramecio2.libraries.formsutils import check_csrf
|
||||||
from hmac import compare_digest as compare_hash
|
from hmac import compare_digest as compare_hash
|
||||||
from paramecio2.modules.admin.libraries.admin_auth import admin_prepare, admin_finished
|
from paramecio2.modules.admin.libraries.admin_auth import admin_prepare, admin_finished, modules_access
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import crypt
|
import crypt
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,8 @@ from flask import g, request, redirect, session, url_for
|
||||||
from paramecio2.libraries.db.webmodel import WebModel
|
from paramecio2.libraries.db.webmodel import WebModel
|
||||||
from settings import config
|
from settings import config
|
||||||
|
|
||||||
|
modules_access=[]
|
||||||
|
|
||||||
def admin_prepare():
|
def admin_prepare():
|
||||||
|
|
||||||
g.connection=WebModel.connection()
|
g.connection=WebModel.connection()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue