modern #2
5 changed files with 26 additions and 8 deletions
|
|
@ -8,7 +8,7 @@ import re
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from base64 import b64encode
|
from base64 import b64encode
|
||||||
from paramecio.libraries.db.webmodel import WebModel
|
from paramecio.libraries.db.webmodel import WebModel
|
||||||
from paramecio.modules.admin2.models.admin import UserAdmin2
|
from paramecio.modules.admin2.models.admin import UserAdmin2, LoginTries2
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
|
|
@ -221,7 +221,9 @@ def start():
|
||||||
|
|
||||||
conn=WebModel.connection()
|
conn=WebModel.connection()
|
||||||
|
|
||||||
useradmin=UserAdmin(conn)
|
useradmin=UserAdmin2(conn)
|
||||||
|
|
||||||
|
logintries=LoginTries2(conn)
|
||||||
|
|
||||||
# Check if db exists
|
# Check if db exists
|
||||||
|
|
||||||
|
|
@ -250,11 +252,13 @@ def start():
|
||||||
|
|
||||||
shutil.copy(workdir+'/settings/modules.py.admin', path_settings+'/modules.py')
|
shutil.copy(workdir+'/settings/modules.py.admin', path_settings+'/modules.py')
|
||||||
|
|
||||||
shutil.copy(workdir+'/settings/config_admin.py.sample', path_settings+'/config_admin.py')
|
#shutil.copy(workdir+'/settings/config_admin.py.sample', path_settings+'/config_admin.py')
|
||||||
|
|
||||||
sql=useradmin.create_table()
|
sql=useradmin.create_table()
|
||||||
|
|
||||||
if not useradmin.query(sql):
|
tries_sql=logintries.create_table()
|
||||||
|
|
||||||
|
if not useradmin.query(sql) or not useradmin.query(tries_sql) :
|
||||||
print('Error: cannot create table admin, you can create this table with padmin.py')
|
print('Error: cannot create table admin, you can create this table with padmin.py')
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,22 @@
|
||||||
from bottle import request, response
|
from bottle import request, response
|
||||||
from itsdangerous.url_safe import URLSafeTimedSerializer
|
from itsdangerous.url_safe import URLSafeTimedSerializer
|
||||||
|
from paramecio.libraries.keyutils import create_key_encrypt, create_key_encrypt_256, create_key
|
||||||
|
|
||||||
|
try:
|
||||||
|
|
||||||
from settings import config
|
from settings import config
|
||||||
|
|
||||||
|
except:
|
||||||
|
|
||||||
|
class config:
|
||||||
|
cookie_name='paramecio.session'
|
||||||
|
key_encrypt=create_key_encrypt_256(30)
|
||||||
|
session_opts={'session.data_dir': 'sessions', 'session.type': 'file', 'session.path': 'paramecio'}
|
||||||
|
|
||||||
import inspect
|
import inspect
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Session(dict):
|
class Session(dict):
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
from bottle import request, response, redirect
|
from bottle import request, response, redirect
|
||||||
from settings import config
|
#from settings import config
|
||||||
import inspect
|
import inspect
|
||||||
from paramecio.wsgiapp import app
|
from paramecio.wsgiapp import app
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ debug=False
|
||||||
|
|
||||||
reloader=False
|
reloader=False
|
||||||
|
|
||||||
admin_folder='admin'
|
admin_folder='/admin'
|
||||||
|
|
||||||
host='localhost'
|
host='localhost'
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@ list_modules=[]
|
||||||
|
|
||||||
from paramecio.modules.welcome import index
|
from paramecio.modules.welcome import index
|
||||||
|
|
||||||
from paramecio.modules.admin2 import index
|
#from paramecio.modules.admin2 import index
|
||||||
|
|
||||||
from paramecio.modules.lang import index
|
from paramecio.modules.lang import index
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue