Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Vladislav Rykov
THSO.server
Commits
0896e160
Commit
0896e160
authored
Oct 08, 2020
by
Vladislav Rykov
Browse files
navigation links active fixed
parent
f557369d
Changes
5
Show whitespace changes
Inline
Side-by-side
app/app/__pycache__/views.cpython-37.pyc
View file @
0896e160
No preview for this file type
app/app/__pycache__/views_admin.cpython-37.pyc
View file @
0896e160
No preview for this file type
app/app/templates/logged_layout.html
View file @
0896e160
...
@@ -91,8 +91,8 @@
...
@@ -91,8 +91,8 @@
<i
class=
"ni ni-briefcase-24 text-pink"
></i>
Administration
<i
class=
"ni ni-briefcase-24 text-pink"
></i>
Administration
</a>
</a>
</li>
</li>
<li
class=
"nav-item"
{{
users
}}
>
<li
class=
"nav-item"
{{
users
_link
}}
>
<a
class=
"nav-link {{ users }} "
href=
"/administration/users"
>
<a
class=
"nav-link {{ users
_link
}} "
href=
"/administration/users"
>
<i
class=
"ni ni-single-02 text-info"
></i>
Users
<i
class=
"ni ni-single-02 text-info"
></i>
Users
</a>
</a>
</li>
</li>
...
...
app/app/views.py
View file @
0896e160
...
@@ -503,7 +503,7 @@ def application_device_geo(appkey, devid):
...
@@ -503,7 +503,7 @@ def application_device_geo(appkey, devid):
def
application_alerts
(
appkey
):
def
application_alerts
(
appkey
):
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
alerts
=
nfs
.
get_alerts_list
(
appkey
)
alerts
=
nfs
.
get_alerts_list
(
appkey
)
return
render_template
(
'views/public/alerts.html'
,
alert_list
=
alerts
[
1
],
app
=
ap
[
1
])
return
render_template
(
'views/public/alerts.html'
,
alert_list
=
alerts
[
1
],
app
=
ap
[
1
]
,
applications
=
"active"
)
@
app
.
route
(
'/application/<appkey>/new-alert'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/application/<appkey>/new-alert'
,
methods
=
[
'GET'
,
'POST'
])
...
@@ -514,7 +514,7 @@ def application_new_alert(appkey):
...
@@ -514,7 +514,7 @@ def application_new_alert(appkey):
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
devs
=
dd
.
get_list
(
appkey
)
devs
=
dd
.
get_list
(
appkey
)
return
render_template
(
'views/public/new-alert.html'
,
devs
=
devs
[
1
],
app
=
ap
[
1
])
return
render_template
(
'views/public/new-alert.html'
,
devs
=
devs
[
1
],
app
=
ap
[
1
]
,
applications
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
# create new notification
# create new notification
nid
=
misc
.
rand_str
(
app
.
config
[
'NID_LENGTH'
]).
decode
(
'utf-8'
)
nid
=
misc
.
rand_str
(
app
.
config
[
'NID_LENGTH'
]).
decode
(
'utf-8'
)
...
@@ -565,7 +565,7 @@ def application_automation(appkey):
...
@@ -565,7 +565,7 @@ def application_automation(appkey):
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
ats
=
nfs
.
get_automation_list
(
appkey
)
ats
=
nfs
.
get_automation_list
(
appkey
)
return
render_template
(
'views/public/automation.html'
,
automations
=
ats
[
1
],
app
=
ap
[
1
])
return
render_template
(
'views/public/automation.html'
,
automations
=
ats
[
1
],
app
=
ap
[
1
]
,
applications
=
"active"
)
@
app
.
route
(
'/application/<appkey>/new-automation'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/application/<appkey>/new-automation'
,
methods
=
[
'GET'
,
'POST'
])
...
@@ -576,7 +576,7 @@ def application_new_automation(appkey):
...
@@ -576,7 +576,7 @@ def application_new_automation(appkey):
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
devs
=
dd
.
get_list
(
appkey
)
devs
=
dd
.
get_list
(
appkey
)
return
render_template
(
'views/public/new-automation.html'
,
devs
=
devs
[
1
],
app
=
ap
[
1
])
return
render_template
(
'views/public/new-automation.html'
,
devs
=
devs
[
1
],
app
=
ap
[
1
]
,
applications
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
# create new notification
# create new notification
nid
=
misc
.
rand_str
(
app
.
config
[
'NID_LENGTH'
]).
decode
(
'utf-8'
)
nid
=
misc
.
rand_str
(
app
.
config
[
'NID_LENGTH'
]).
decode
(
'utf-8'
)
...
@@ -612,7 +612,7 @@ def application_settings(appkey):
...
@@ -612,7 +612,7 @@ def application_settings(appkey):
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
return
render_template
(
'views/public/application-settings.html'
,
app
=
ap
[
1
])
return
render_template
(
'views/public/application-settings.html'
,
app
=
ap
[
1
]
,
applications
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
if
request
.
form
.
getlist
(
'secure'
)
and
request
.
form
.
getlist
(
'secure'
)[
0
]
==
'on'
:
if
request
.
form
.
getlist
(
'secure'
)
and
request
.
form
.
getlist
(
'secure'
)[
0
]
==
'on'
:
secure
=
True
secure
=
True
...
@@ -637,7 +637,7 @@ def application_device_settings(appkey, devid):
...
@@ -637,7 +637,7 @@ def application_device_settings(appkey, devid):
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
dev
=
dd
.
get
(
appkey
,
devid
)
dev
=
dd
.
get
(
appkey
,
devid
)
return
render_template
(
'views/public/device-settings.html'
,
app
=
ap
[
1
],
dev
=
dev
[
1
],
models
=
ddm
.
MODELS
)
return
render_template
(
'views/public/device-settings.html'
,
app
=
ap
[
1
],
dev
=
dev
[
1
],
models
=
ddm
.
MODELS
,
applications
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
ddmin
=
ddm
.
extract
(
request
)
ddmin
=
ddm
.
extract
(
request
)
res
=
dd
.
update
(
appkey
,
devid
,
request
.
form
[
'devname'
],
request
.
form
[
'devdesc'
],
ddmin
)
res
=
dd
.
update
(
appkey
,
devid
,
request
.
form
[
'devname'
],
request
.
form
[
'devdesc'
],
ddmin
)
...
@@ -661,4 +661,4 @@ def map():
...
@@ -661,4 +661,4 @@ def map():
devslocs
=
md
.
get_devices_locations
(
session
[
'name'
])
devslocs
=
md
.
get_devices_locations
(
session
[
'name'
])
import
json
import
json
return
render_template
(
'views/public/map.html'
,
info
=
info
,
devslocs
=
json
.
dumps
(
devslocs
))
return
render_template
(
'views/public/map.html'
,
info
=
info
,
devslocs
=
json
.
dumps
(
devslocs
)
,
map
=
"active"
)
app/app/views_admin.py
View file @
0896e160
...
@@ -35,7 +35,7 @@ def administration():
...
@@ -35,7 +35,7 @@ def administration():
devs_cnt
=
dd
.
get_count_all
()[
1
][
0
]
devs_cnt
=
dd
.
get_count_all
()[
1
][
0
]
info
=
[
user_cnt
,
apps_cnt
,
devs_cnt
]
info
=
[
user_cnt
,
apps_cnt
,
devs_cnt
]
return
render_template
(
'views/admin/administration.html'
,
info
=
info
)
return
render_template
(
'views/admin/administration.html'
,
info
=
info
,
administration
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
if
request
.
form
.
getlist
(
'signup'
)
and
request
.
form
.
getlist
(
'signup'
)[
0
]
==
'on'
:
if
request
.
form
.
getlist
(
'signup'
)
and
request
.
form
.
getlist
(
'signup'
)[
0
]
==
'on'
:
app
.
config
[
'USERS_SIGNUP'
]
=
True
app
.
config
[
'USERS_SIGNUP'
]
=
True
...
@@ -58,7 +58,7 @@ def administration_users():
...
@@ -58,7 +58,7 @@ def administration_users():
cur_pg
=
1
cur_pg
=
1
users
=
ud
.
get_range
([
MAX_PG_ENTRIES_USERS
,
(
cur_pg
-
1
)
*
MAX_PG_ENTRIES_USERS
])[
1
]
users
=
ud
.
get_range
([
MAX_PG_ENTRIES_USERS
,
(
cur_pg
-
1
)
*
MAX_PG_ENTRIES_USERS
])[
1
]
return
render_template
(
'views/admin/users.html'
,
users
=
users
,
info
=
info
)
return
render_template
(
'views/admin/users.html'
,
users
=
users
,
info
=
info
,
users_link
=
"active"
)
@
app
.
route
(
'/administration/<name>'
)
@
app
.
route
(
'/administration/<name>'
)
...
@@ -70,20 +70,20 @@ def administration_user(name):
...
@@ -70,20 +70,20 @@ def administration_user(name):
last_activity
=
md
.
get_user_data_count_per_day
(
name
)[
1
][
0
]
last_activity
=
md
.
get_user_data_count_per_day
(
name
)[
1
][
0
]
info
=
[
created_apps
,
active_devices
,
total_activity
,
last_activity
]
info
=
[
created_apps
,
active_devices
,
total_activity
,
last_activity
]
return
render_template
(
'views/admin/user-dashboard.html'
,
info
=
info
,
user
=
name
)
return
render_template
(
'views/admin/user-dashboard.html'
,
info
=
info
,
user
=
name
,
administration
=
"active"
)
@
app
.
route
(
'/administration/<name>/applications'
)
@
app
.
route
(
'/administration/<name>/applications'
)
@
restricted
(
'admin'
,
True
)
@
restricted
(
'admin'
,
True
)
def
administration_user_applications
(
name
):
def
administration_user_applications
(
name
):
apps
=
ad
.
get_list
(
name
)[
1
]
apps
=
ad
.
get_list
(
name
)[
1
]
return
render_template
(
'views/admin/user-applications.html'
,
apps
=
apps
,
user
=
name
)
return
render_template
(
'views/admin/user-applications.html'
,
apps
=
apps
,
user
=
name
,
administration
=
"active"
)
@
app
.
route
(
'/administration/<name>/new-application'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/administration/<name>/new-application'
,
methods
=
[
'GET'
,
'POST'
])
@
restricted
(
'admin'
,
True
)
@
restricted
(
'admin'
,
True
)
def
administration_user_new_application
(
name
):
def
administration_user_new_application
(
name
):
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
return
render_template
(
'views/admin/user-new-application.html'
,
user
=
name
)
return
render_template
(
'views/admin/user-new-application.html'
,
user
=
name
,
administration
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
if
request
.
form
[
'appname'
]
==
''
:
if
request
.
form
[
'appname'
]
==
''
:
flash
(
'Application name cannot be empty.'
,
'danger'
)
flash
(
'Application name cannot be empty.'
,
'danger'
)
...
@@ -123,7 +123,7 @@ def administration_user_application(name, appkey):
...
@@ -123,7 +123,7 @@ def administration_user_application(name, appkey):
ap
[
5
]
=
misc
.
skey_b64_to_hex
(
ap
[
5
])
ap
[
5
]
=
misc
.
skey_b64_to_hex
(
ap
[
5
])
devs
=
dd
.
get_list
(
ap
[
1
])[
1
]
devs
=
dd
.
get_list
(
ap
[
1
])[
1
]
return
render_template
(
'views/admin/user-application.html'
,
app
=
ap
,
devs
=
devs
,
user
=
name
)
return
render_template
(
'views/admin/user-application.html'
,
app
=
ap
,
devs
=
devs
,
user
=
name
,
administration
=
"active"
)
@
app
.
route
(
'/administration/<name>/application/<appkey>/add-device'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/administration/<name>/application/<appkey>/add-device'
,
methods
=
[
'GET'
,
'POST'
])
...
@@ -132,7 +132,7 @@ def administration_user_application_add_device(name, appkey):
...
@@ -132,7 +132,7 @@ def administration_user_application_add_device(name, appkey):
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
dev_list
=
dd
.
get_list
(
appkey
)
dev_list
=
dd
.
get_list
(
appkey
)
return
render_template
(
'views/admin/user-application-add-device.html'
,
app
=
ap
[
1
],
free_ids
=
misc
.
prep_id_range
(
dev_list
[
1
]),
models
=
ddm
.
MODELS
,
user
=
name
)
return
render_template
(
'views/admin/user-application-add-device.html'
,
app
=
ap
[
1
],
free_ids
=
misc
.
prep_id_range
(
dev_list
[
1
]),
models
=
ddm
.
MODELS
,
user
=
name
,
administration
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
if
dd
.
check_devid
(
appkey
,
request
.
form
[
'devid'
]):
if
dd
.
check_devid
(
appkey
,
request
.
form
[
'devid'
]):
ddmin
=
ddm
.
extract
(
request
)
ddmin
=
ddm
.
extract
(
request
)
...
@@ -174,7 +174,7 @@ def administration_user_application_device(name, appkey, devid):
...
@@ -174,7 +174,7 @@ def administration_user_application_device(name, appkey, devid):
if
ld
[
0
]
and
ld
[
1
][
0
]
!=
[]:
if
ld
[
0
]
and
ld
[
1
][
0
]
!=
[]:
ltup
=
ld
[
1
][
0
][
1
]
ltup
=
ld
[
1
][
0
][
1
]
return
render_template
(
'views/admin/user-application-device.html'
,
dev
=
dev
[
1
],
app
=
ap
[
1
],
ltup
=
ltup
,
total
=
cnt
[
1
][
0
],
user
=
name
,
table_max
=
MAX_PG_ENTRIES_DATA
)
return
render_template
(
'views/admin/user-application-device.html'
,
dev
=
dev
[
1
],
app
=
ap
[
1
],
ltup
=
ltup
,
total
=
cnt
[
1
][
0
],
user
=
name
,
table_max
=
MAX_PG_ENTRIES_DATA
,
administration
=
"active"
)
@
app
.
route
(
'/administration/<name>/application/<appkey>/device/<devid>/settings'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/administration/<name>/application/<appkey>/device/<devid>/settings'
,
methods
=
[
'GET'
,
'POST'
])
...
@@ -184,7 +184,7 @@ def administration_user_application_device_settings(name, appkey, devid):
...
@@ -184,7 +184,7 @@ def administration_user_application_device_settings(name, appkey, devid):
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
dev
=
dd
.
get
(
appkey
,
devid
)
dev
=
dd
.
get
(
appkey
,
devid
)
return
render_template
(
'views/admin/user-application-device-settings.html'
,
app
=
ap
[
1
],
dev
=
dev
[
1
],
models
=
ddm
.
MODELS
,
user
=
name
)
return
render_template
(
'views/admin/user-application-device-settings.html'
,
app
=
ap
[
1
],
dev
=
dev
[
1
],
models
=
ddm
.
MODELS
,
user
=
name
,
administration
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
ddmin
=
ddm
.
extract
(
request
)
ddmin
=
ddm
.
extract
(
request
)
res
=
dd
.
update
(
appkey
,
devid
,
request
.
form
[
'devname'
],
request
.
form
[
'devdesc'
],
ddmin
)
res
=
dd
.
update
(
appkey
,
devid
,
request
.
form
[
'devname'
],
request
.
form
[
'devdesc'
],
ddmin
)
...
@@ -222,7 +222,7 @@ def administration_user_application_device_delete(name, appkey, devid):
...
@@ -222,7 +222,7 @@ def administration_user_application_device_delete(name, appkey, devid):
def
administration_user_application_alerts
(
name
,
appkey
):
def
administration_user_application_alerts
(
name
,
appkey
):
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
alerts
=
nfs
.
get_alerts_list
(
appkey
)
alerts
=
nfs
.
get_alerts_list
(
appkey
)
return
render_template
(
'views/admin/user-application-alerts.html'
,
alert_list
=
alerts
[
1
],
app
=
ap
[
1
],
user
=
name
)
return
render_template
(
'views/admin/user-application-alerts.html'
,
alert_list
=
alerts
[
1
],
app
=
ap
[
1
],
user
=
name
,
administration
=
"active"
)
@
app
.
route
(
'/administration/<name>/application/<appkey>/new-alert'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/administration/<name>/application/<appkey>/new-alert'
,
methods
=
[
'GET'
,
'POST'
])
...
@@ -232,7 +232,7 @@ def administration_user_application_new_alert(name, appkey):
...
@@ -232,7 +232,7 @@ def administration_user_application_new_alert(name, appkey):
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
devs
=
dd
.
get_list
(
appkey
)
devs
=
dd
.
get_list
(
appkey
)
return
render_template
(
'views/admin/user-application-new-alert.html'
,
devs
=
devs
[
1
],
app
=
ap
[
1
],
user
=
name
)
return
render_template
(
'views/admin/user-application-new-alert.html'
,
devs
=
devs
[
1
],
app
=
ap
[
1
],
user
=
name
,
administration
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
# create new notification
# create new notification
nid
=
misc
.
rand_str
(
app
.
config
[
'NID_LENGTH'
]).
decode
(
'utf-8'
)
nid
=
misc
.
rand_str
(
app
.
config
[
'NID_LENGTH'
]).
decode
(
'utf-8'
)
...
@@ -264,7 +264,7 @@ def administration_user_application_automation(name, appkey):
...
@@ -264,7 +264,7 @@ def administration_user_application_automation(name, appkey):
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
ats
=
nfs
.
get_automation_list
(
appkey
)
ats
=
nfs
.
get_automation_list
(
appkey
)
return
render_template
(
'views/admin/user-application-automation.html'
,
automations
=
ats
[
1
],
app
=
ap
[
1
],
user
=
name
)
return
render_template
(
'views/admin/user-application-automation.html'
,
automations
=
ats
[
1
],
app
=
ap
[
1
],
user
=
name
,
administration
=
"active"
)
@
app
.
route
(
'/administration/<name>/application/<appkey>/new-automation'
,
methods
=
[
'GET'
,
'POST'
])
@
app
.
route
(
'/administration/<name>/application/<appkey>/new-automation'
,
methods
=
[
'GET'
,
'POST'
])
...
@@ -274,7 +274,7 @@ def administration_user_application_new_automation(name, appkey):
...
@@ -274,7 +274,7 @@ def administration_user_application_new_automation(name, appkey):
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
devs
=
dd
.
get_list
(
appkey
)
devs
=
dd
.
get_list
(
appkey
)
return
render_template
(
'views/admin/user-application-new-automation.html'
,
devs
=
devs
[
1
],
app
=
ap
[
1
],
user
=
name
)
return
render_template
(
'views/admin/user-application-new-automation.html'
,
devs
=
devs
[
1
],
app
=
ap
[
1
],
user
=
name
,
administration
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
# create new notification
# create new notification
nid
=
misc
.
rand_str
(
app
.
config
[
'NID_LENGTH'
]).
decode
(
'utf-8'
)
nid
=
misc
.
rand_str
(
app
.
config
[
'NID_LENGTH'
]).
decode
(
'utf-8'
)
...
@@ -337,7 +337,7 @@ def administration_user_application_settings(name, appkey):
...
@@ -337,7 +337,7 @@ def administration_user_application_settings(name, appkey):
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
ap
=
ad
.
get
(
appkey
)
ap
=
ad
.
get
(
appkey
)
return
render_template
(
'views/admin/user-application-settings.html'
,
app
=
ap
[
1
],
user
=
name
)
return
render_template
(
'views/admin/user-application-settings.html'
,
app
=
ap
[
1
],
user
=
name
,
administration
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
if
request
.
form
.
getlist
(
'secure'
)
and
request
.
form
.
getlist
(
'secure'
)[
0
]
==
'on'
:
if
request
.
form
.
getlist
(
'secure'
)
and
request
.
form
.
getlist
(
'secure'
)[
0
]
==
'on'
:
secure
=
True
secure
=
True
...
@@ -439,7 +439,7 @@ def administration_user_application_device_configuration(name, appkey, devid):
...
@@ -439,7 +439,7 @@ def administration_user_application_device_configuration(name, appkey, devid):
ack
=
pm
[
3
]
ack
=
pm
[
3
]
config_list
.
append
((
config_id
,
config_args
,
ack
,
pm
[
2
]))
config_list
.
append
((
config_id
,
config_args
,
ack
,
pm
[
2
]))
return
render_template
(
'views/admin/user-application-device-configuration.html'
,
dev
=
dev
,
app
=
ap
,
config_list
=
config_list
,
user
=
name
)
return
render_template
(
'views/admin/user-application-device-configuration.html'
,
dev
=
dev
,
app
=
ap
,
config_list
=
config_list
,
user
=
name
,
administration
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
base64_args
=
misc
.
pend_base64_encode
(
request
.
form
[
'arg'
],
request
.
form
[
'confid'
])
base64_args
=
misc
.
pend_base64_encode
(
request
.
form
[
'arg'
],
request
.
form
[
'confid'
])
pend
.
create
(
appkey
,
devid
,
base64_args
)
pend
.
create
(
appkey
,
devid
,
base64_args
)
...
@@ -548,7 +548,7 @@ def administration_users_table(page):
...
@@ -548,7 +548,7 @@ def administration_users_table(page):
@
restricted
(
'admin'
)
@
restricted
(
'admin'
)
def
administration_new_user
():
def
administration_new_user
():
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
return
render_template
(
'views/admin/new-user.html'
)
return
render_template
(
'views/admin/new-user.html'
,
administration
=
"active"
)
elif
request
.
method
==
'POST'
:
elif
request
.
method
==
'POST'
:
username
=
request
.
form
[
'username'
]
username
=
request
.
form
[
'username'
]
password
=
request
.
form
[
'password'
].
encode
(
'utf-8'
)
password
=
request
.
form
[
'password'
].
encode
(
'utf-8'
)
...
@@ -578,7 +578,7 @@ def administration_user_settings(name):
...
@@ -578,7 +578,7 @@ def administration_user_settings(name):
user
=
ud
.
get
(
name
)
user
=
ud
.
get
(
name
)
if
user
[
0
]
and
misc
.
grant_view
(
user
[
1
][
2
],
session
[
'role'
]):
if
user
[
0
]
and
misc
.
grant_view
(
user
[
1
][
2
],
session
[
'role'
]):
if
request
.
method
==
'GET'
:
if
request
.
method
==
'GET'
:
return
render_template
(
'views/admin/user-settings.html'
,
user
=
name
,
user_role
=
user
[
1
][
2
])
return
render_template
(
'views/admin/user-settings.html'
,
user
=
name
,
user_role
=
user
[
1
][
2
]
,
administration
=
"active"
)
else
:
else
:
if
request
.
form
[
'name'
]
!=
name
:
if
request
.
form
[
'name'
]
!=
name
:
res
=
ud
.
update_name
(
name
,
request
.
form
[
'name'
])
res
=
ud
.
update_name
(
name
,
request
.
form
[
'name'
])
...
@@ -637,7 +637,7 @@ def administration_user_delete_account(name):
...
@@ -637,7 +637,7 @@ def administration_user_delete_account(name):
if
not
res
[
0
]:
if
not
res
[
0
]:
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
flash
(
'Error: {}'
.
format
(
res
[
1
]),
'danger'
)
app
.
logger
.
error
(
'Administrator %s failed to delete user %s - %s'
,
session
[
'name'
],
name
,
res
[
1
])
app
.
logger
.
error
(
'Administrator %s failed to delete user %s - %s'
,
session
[
'name'
],
name
,
res
[
1
])
return
render_template
(
'views/admin/user-settings.html'
,
user
=
name
)
return
render_template
(
'views/admin/user-settings.html'
,
user
=
name
,
administration
=
"active"
)
else
:
else
:
app
.
logger
.
warning
(
'Administrator %s deleted user %s'
,
session
[
'name'
],
name
)
app
.
logger
.
warning
(
'Administrator %s deleted user %s'
,
session
[
'name'
],
name
)
flash
(
'User {} was deleted'
.
format
(
name
),
'success'
)
flash
(
'User {} was deleted'
.
format
(
name
),
'success'
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment