Disabled login for now
This commit is contained in:
parent
758d7e4cef
commit
bce9c008b8
2 changed files with 61 additions and 15 deletions
|
|
@ -3,9 +3,11 @@ from flask import g, url_for
|
||||||
from paramecio2.libraries.i18n import I18n
|
from paramecio2.libraries.i18n import I18n
|
||||||
import copy
|
import copy
|
||||||
from paramecio2.modules.admin import admin_app, t as admin_t
|
from paramecio2.modules.admin import admin_app, t as admin_t
|
||||||
|
from paramecio2.modules.login.models.login import LoginType
|
||||||
from paramecio2.libraries.db import coreforms
|
from paramecio2.libraries.db import coreforms
|
||||||
from paramecio2.libraries.formsutils import show_form
|
from paramecio2.libraries.formsutils import show_form
|
||||||
from paramecio2.libraries.mtemplates import PTemplate, env_theme
|
from paramecio2.libraries.mtemplates import PTemplate, env_theme
|
||||||
|
from paramecio2.libraries.generate_admin_class import GenerateAdminClass
|
||||||
import os
|
import os
|
||||||
|
|
||||||
#env=env_theme(__file__)
|
#env=env_theme(__file__)
|
||||||
|
|
@ -16,13 +18,24 @@ t=copy.copy(admin_t)
|
||||||
|
|
||||||
t.env.directories.insert(1, os.path.dirname(__file__)+'/templates')
|
t.env.directories.insert(1, os.path.dirname(__file__)+'/templates')
|
||||||
|
|
||||||
print(t.env.directories)
|
#print(t.env.directories)
|
||||||
|
|
||||||
@admin_app.route('/admin/login/', methods=['GET', 'POST'])
|
@admin_app.route('/admin/admin_login/', methods=['GET'])
|
||||||
def admin_login():
|
def admin_login():
|
||||||
"""
|
|
||||||
connection=g.connection
|
|
||||||
|
|
||||||
|
connection=g.connection
|
||||||
|
"""
|
||||||
|
login_type=LoginType(connection)
|
||||||
|
|
||||||
|
url=url_for('.admin_login')
|
||||||
|
|
||||||
|
admin=GenerateAdminClass(login_type, url, t)
|
||||||
|
|
||||||
|
login_type.create_forms()
|
||||||
|
|
||||||
|
login_type.forms['double_check'].arr_select={0: I18n.lang('admin', 'no', 'No'), 1: I18n.lang('admin', 'yes', 'Yes')}
|
||||||
|
"""
|
||||||
|
"""
|
||||||
user_admin=UserAdmin(connection)
|
user_admin=UserAdmin(connection)
|
||||||
|
|
||||||
user_admin.fields['privileges'].name_form=SelectForm
|
user_admin.fields['privileges'].name_form=SelectForm
|
||||||
|
|
@ -45,7 +58,8 @@ def admin_login():
|
||||||
admin.list.search_fields=['username']
|
admin.list.search_fields=['username']
|
||||||
|
|
||||||
admin.arr_fields_edit=['username', 'password', 'repeat_password', 'email', 'privileges', 'lang']
|
admin.arr_fields_edit=['username', 'password', 'repeat_password', 'email', 'privileges', 'lang']
|
||||||
|
"""
|
||||||
|
"""
|
||||||
form_admin=admin.show()
|
form_admin=admin.show()
|
||||||
|
|
||||||
if type(form_admin).__name__=='str':
|
if type(form_admin).__name__=='str':
|
||||||
|
|
@ -54,9 +68,8 @@ def admin_login():
|
||||||
else:
|
else:
|
||||||
|
|
||||||
return form_admin
|
return form_admin
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
"""
|
||||||
form_admin=''
|
form_admin=''
|
||||||
|
|
||||||
arr_forms={}
|
arr_forms={}
|
||||||
|
|
@ -80,3 +93,20 @@ def admin_login():
|
||||||
|
|
||||||
return form_admin
|
return form_admin
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
return ""
|
||||||
|
"""
|
||||||
|
@admin_app.route('/admin/login/', methods=['POST'])
|
||||||
|
def admin_login_post():
|
||||||
|
|
||||||
|
data={'error': 0, 'txt_error': 0}
|
||||||
|
|
||||||
|
# Save in json
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,30 @@
|
||||||
|
<form id="admin_login_form">
|
||||||
${content_form|n}
|
${content_form|n}
|
||||||
<p><input type="submit" value="${lang('admin', 'send', 'Send')}"/></p>
|
<p><input type="submit" value="${lang('admin', 'send', 'Send')}"/></p>
|
||||||
|
</form>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
$.ajax({
|
$('#admin_login_form').submit( function () {
|
||||||
url: "${url_for('.admin_login')}",
|
|
||||||
|
$.ajax({
|
||||||
|
url: "${url_for('.login')}",
|
||||||
data: {},
|
data: {},
|
||||||
success: function(data) {
|
success: function(data) {
|
||||||
|
|
||||||
|
if(!data.error) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
type: 'POST',
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue