mirror of
https://github.com/janeczku/calibre-web
synced 2025-01-26 00:46:55 +00:00
fix change name allowd as non admin
This commit is contained in:
parent
20fa9f5523
commit
3c8bfc31e4
@ -75,7 +75,6 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<input type="checkbox" name="Show_detail_random" id="Show_detail_random" {% if content.show_detail_random() %}checked{% endif %}>
|
<input type="checkbox" name="Show_detail_random" id="Show_detail_random" {% if content.show_detail_random() %}checked{% endif %}>
|
||||||
<label for="Show_detail_random">{{_('Show Random Books in Detail View')}}</label>
|
<label for="Show_detail_random">{{_('Show Random Books in Detail View')}}</label>
|
||||||
@ -85,6 +84,7 @@
|
|||||||
<a href="#" id="get_user_column_values" data-id="{{content.id}}" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add allowed/Denied Custom Column Values')}}</a>
|
<a href="#" id="get_user_column_values" data-id="{{content.id}}" class="btn btn-default" data-toggle="modal" data-target="#restrictModal">{{_('Add allowed/Denied Custom Column Values')}}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
{% if g.user and g.user.role_admin() and not profile %}
|
{% if g.user and g.user.role_admin() and not profile %}
|
||||||
{% if not content.role_anonymous() %}
|
{% if not content.role_anonymous() %}
|
||||||
@ -143,7 +143,7 @@
|
|||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="modal fade" id="modal_kobo_token" tabindex="-1" role="dialog" aria-labelledby="kobo_tokenModalLabel">
|
<div class="modal fade" id="modal_kobo_token" tabindex="-1" role="dialog" aria-labelledby="kobo_tokenModalLabel">
|
||||||
<div class="modal-dialog modal-lg" role="document">
|
<div class="modal-dialog modal-lg" role="document">
|
||||||
<div class="modal-content">
|
<div class="modal-content">
|
||||||
<div class="modal-header">
|
<div class="modal-header">
|
||||||
@ -156,7 +156,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
{% block modal %}
|
{% block modal %}
|
||||||
|
@ -1580,19 +1580,20 @@ def logout():
|
|||||||
|
|
||||||
|
|
||||||
# ################################### Users own configuration #########################################################
|
# ################################### Users own configuration #########################################################
|
||||||
def change_profile(kobo_support, local_oauth_check, oauth_status, translations, languages):
|
def change_profile(kobo_support, local_oauth_check, oauth_status):
|
||||||
to_save = request.form.to_dict()
|
to_save = request.form.to_dict()
|
||||||
current_user.random_books = 0
|
current_user.random_books = 0
|
||||||
if current_user.role_passwd() or current_user.role_admin():
|
if current_user.role_passwd() or current_user.role_admin():
|
||||||
if to_save.get("password"):
|
if to_save.get("password"):
|
||||||
current_user.password = generate_password_hash(to_save["password"])
|
current_user.password = generate_password_hash(to_save["password"])
|
||||||
try:
|
try:
|
||||||
if to_save.get("allowed_tags", current_user.allowed_tags) != current_user.allowed_tags:
|
|
||||||
current_user.allowed_tags = to_save["allowed_tags"].strip()
|
|
||||||
if to_save.get("kindle_mail", current_user.kindle_mail) != current_user.kindle_mail:
|
if to_save.get("kindle_mail", current_user.kindle_mail) != current_user.kindle_mail:
|
||||||
current_user.kindle_mail = valid_email(to_save["kindle_mail"])
|
current_user.kindle_mail = valid_email(to_save["kindle_mail"])
|
||||||
if to_save.get("email", current_user.email) != current_user.email:
|
if to_save.get("email", current_user.email) != current_user.email:
|
||||||
current_user.email = check_email(to_save["email"])
|
current_user.email = check_email(to_save["email"])
|
||||||
|
if current_user.role_admin():
|
||||||
|
if to_save.get("allowed_tags", current_user.allowed_tags) != current_user.allowed_tags:
|
||||||
|
current_user.allowed_tags = to_save["allowed_tags"].strip()
|
||||||
if to_save.get("name", current_user.name) != current_user.name:
|
if to_save.get("name", current_user.name) != current_user.name:
|
||||||
# Query User name, if not existing, change
|
# Query User name, if not existing, change
|
||||||
current_user.name = check_username(to_save["name"])
|
current_user.name = check_username(to_save["name"])
|
||||||
@ -1646,7 +1647,7 @@ def profile():
|
|||||||
local_oauth_check = {}
|
local_oauth_check = {}
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
change_profile(kobo_support, local_oauth_check, oauth_status, translations, languages)
|
change_profile(kobo_support, local_oauth_check, oauth_status)
|
||||||
return render_title_template("user_edit.html",
|
return render_title_template("user_edit.html",
|
||||||
translations=translations,
|
translations=translations,
|
||||||
profile=1,
|
profile=1,
|
||||||
|
Loading…
Reference in New Issue
Block a user