This commit is contained in:
OzzieIsaacs 2020-08-21 19:26:58 +02:00
parent 1535bdbcd8
commit 0cc07362b8
3 changed files with 11 additions and 7 deletions

View File

@ -602,8 +602,12 @@ def get_error_text(client_secrets=None):
if not os.path.isfile(CLIENT_SECRETS): if not os.path.isfile(CLIENT_SECRETS):
return 'client_secrets.json is missing or not readable' return 'client_secrets.json is missing or not readable'
try:
with open(CLIENT_SECRETS, 'r') as settings: with open(CLIENT_SECRETS, 'r') as settings:
filedata = json.load(settings) filedata = json.load(settings)
except PermissionError:
return 'client_secrets.json is missing or not readable'
if 'web' not in filedata: if 'web' not in filedata:
return 'client_secrets.json is not configured for web application' return 'client_secrets.json is not configured for web application'
if 'redirect_uris' not in filedata['web']: if 'redirect_uris' not in filedata['web']:

View File

@ -287,7 +287,7 @@ if ub.oauth_support:
flash(_(u"Unlink to %(oauth)s Failed", oauth=oauth_check[provider]), category="error") flash(_(u"Unlink to %(oauth)s Failed", oauth=oauth_check[provider]), category="error")
except NoResultFound: except NoResultFound:
log.warning("oauth %s for user %d not found", provider, current_user.id) log.warning("oauth %s for user %d not found", provider, current_user.id)
flash(_(u"Not Linked to %(oauth)s.", oauth=oauth_check[provider]), category="error") flash(_(u"Not Linked to %(oauth)s", oauth=provider), category="error")
return redirect(url_for('web.profile')) return redirect(url_for('web.profile'))
@ -355,4 +355,4 @@ if ub.oauth_support:
@oauth.route('/unlink/google', methods=["GET"]) @oauth.route('/unlink/google', methods=["GET"])
@login_required @login_required
def google_login_unlink(): def google_login_unlink():
return unlink_oauth(oauthblueprints[1]['blueprint'].name) return unlink_oauth(oauthblueprints[1]['id'])

View File

@ -30,20 +30,20 @@
<div data-related="gdrive_settings"> <div data-related="gdrive_settings">
{% if gdriveError %} {% if gdriveError %}
<div class="form-group"> <div class="form-group">
<label> <label id="gdrive_error">
{{_('Google Drive config problem')}}: {{ gdriveError }} {{_('Google Drive config problem')}}: {{ gdriveError }}
</label> </label>
</div> </div>
{% else %} {% else %}
{% if show_authenticate_google_drive and g.user.is_authenticated and config.config_use_google_drive %} {% if show_authenticate_google_drive and g.user.is_authenticated and config.config_use_google_drive %}
<div class="form-group required"> <div class="form-group required">
<a href="{{ url_for('gdrive.authenticate_google_drive') }}" class="btn btn-primary">{{_('Authenticate Google Drive')}}</a> <a href="{{ url_for('gdrive.authenticate_google_drive') }}" id="gdrive_auth" class="btn btn-primary">{{_('Authenticate Google Drive')}}</a>
</div> </div>
{% else %} {% else %}
{% if show_authenticate_google_drive and g.user.is_authenticated and not config.config_use_google_drive %} {% if show_authenticate_google_drive and g.user.is_authenticated and not config.config_use_google_drive %}
<div >{{_('Please hit save to continue with setup')}}</div> <div >{{_('Please hit save to continue with setup')}}</div>
{% endif %} {% endif %}
{% if not g.user.is_authenticated %} {% if not g.user.is_authenticated and show_login_button %}
<div >{{_('Please finish Google Drive setup after login')}}</div> <div >{{_('Please finish Google Drive setup after login')}}</div>
{% endif %} {% endif %}
{% if g.user.is_authenticated %} {% if g.user.is_authenticated %}