Bugfixes from testrun (load images from gdrive)
Fix locale for new users
This commit is contained in:
		
							parent
							
								
									aca5324914
								
							
						
					
					
						commit
						25f608d109
					
				|  | @ -1352,8 +1352,6 @@ def _handle_new_user(to_save, content, languages, translations, kobo_support): | |||
|                                      languages=languages, title=_(u"Add new user"), page="newuser", | ||||
|                                      kobo_support=kobo_support, registered_oauth=oauth_check) | ||||
|     try: | ||||
|         content.default_language = config.config_default_language | ||||
|         content.locale = config.config_default_locale | ||||
|         content.allowed_tags = config.config_allowed_tags | ||||
|         content.denied_tags = config.config_denied_tags | ||||
|         content.allowed_column_value = config.config_allowed_column_value | ||||
|  | @ -1491,6 +1489,8 @@ def new_user(): | |||
|     else: | ||||
|         content.role = config.config_default_role | ||||
|         content.sidebar_view = config.config_default_show | ||||
|         content.locale = config.config_default_locale | ||||
|         content.default_language = config.config_default_language | ||||
|     return render_title_template("user_edit.html", new_user=1, content=content, translations=translations, | ||||
|                                  languages=languages, title=_(u"Add new user"), page="newuser", | ||||
|                                  kobo_support=kobo_support, registered_oauth=oauth_check) | ||||
|  |  | |||
|  | @ -21,7 +21,6 @@ | |||
| #  along with this program. If not, see <http://www.gnu.org/licenses/>. | ||||
| 
 | ||||
| import os | ||||
| import sys | ||||
| import hashlib | ||||
| import json | ||||
| import tempfile | ||||
|  | @ -33,7 +32,7 @@ from flask import Blueprint, flash, request, redirect, url_for, abort | |||
| from flask_babel import gettext as _ | ||||
| from flask_login import login_required | ||||
| 
 | ||||
| from . import logger, gdriveutils, config, ub, calibre_db | ||||
| from . import logger, gdriveutils, config, ub, calibre_db, csrf | ||||
| from .admin import admin_required | ||||
| 
 | ||||
| gdrive = Blueprint('gdrive', __name__, url_prefix='/gdrive') | ||||
|  | @ -117,6 +116,7 @@ def revoke_watch_gdrive(): | |||
|     return redirect(url_for('admin.db_configuration')) | ||||
| 
 | ||||
| 
 | ||||
| @csrf.exempt | ||||
| @gdrive.route("/watch/callback", methods=['GET', 'POST']) | ||||
| def on_received_watch_confirmation(): | ||||
|     if not config.config_google_drive_watch_changes_response: | ||||
|  |  | |||
|  | @ -33,7 +33,7 @@ | |||
|     <label for="locale">{{_('Language')}}</label> | ||||
|         <select name="locale" id="locale" class="form-control"> | ||||
|             {%  for translation in translations %} | ||||
|                 <option value="{{translation}}" {% if translation|string == content.locale %}selected{% endif %} {% if new_user == 1 and loop.first %}selected{% endif %}>{{ translation.display_name|capitalize }}</option> | ||||
|                 <option value="{{translation}}" {% if translation|string == content.locale %}selected{% endif %}>{{ translation.display_name|capitalize }}</option> | ||||
|             {% endfor %} | ||||
|         </select> | ||||
|     </div> | ||||
|  | @ -42,7 +42,7 @@ | |||
|     <div class="form-group"> | ||||
|       <label for="default_language">{{_('Language of Books')}}</label> | ||||
|         <select name="default_language" id="default_language" class="form-control"> | ||||
|             <option value="all" {% if new_user == 1 %}selected{% endif %}>{{ _('Show All') }}</option> | ||||
|             <option value="all" {% if content.default_language == "all" %}selected{% endif %}>{{ _('Show All') }}</option> | ||||
|             {%  for language in languages %} | ||||
|             <option value="{{ language.lang_code }}" {% if content.default_language == language.lang_code %}selected{% endif %}>{{ language.name }}</option> | ||||
|             {% endfor %} | ||||
|  |  | |||
|  | @ -83,7 +83,7 @@ except ImportError: | |||
| @app.after_request | ||||
| def add_security_headers(resp): | ||||
|     resp.headers['Content-Security-Policy'] = "default-src 'self' 'unsafe-inline' 'unsafe-eval'; img-src 'self' data:" | ||||
|     if request.endpoint == "editbook.edit_book": | ||||
|     if request.endpoint == "editbook.edit_book" or config.config_use_google_drive: | ||||
|         resp.headers['Content-Security-Policy'] += " *" | ||||
|     resp.headers['X-Content-Type-Options'] = 'nosniff' | ||||
|     resp.headers['X-Frame-Options'] = 'SAMEORIGIN' | ||||
|  |  | |||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Loading…
	
		Reference in New Issue
	
	Block a user