mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 20:39:59 +00:00
Unicode
This commit is contained in:
parent
cc3088c52f
commit
1de3929988
@ -142,12 +142,12 @@ if ub.oauth_support:
|
|||||||
@oauth_authorized.connect_via(github_blueprint)
|
@oauth_authorized.connect_via(github_blueprint)
|
||||||
def github_logged_in(blueprint, token):
|
def github_logged_in(blueprint, token):
|
||||||
if not token:
|
if not token:
|
||||||
flash(_("Failed to log in with GitHub."), category="error")
|
flash(_(u"Failed to log in with GitHub."), category="error")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
resp = blueprint.session.get("/user")
|
resp = blueprint.session.get("/user")
|
||||||
if not resp.ok:
|
if not resp.ok:
|
||||||
flash(_("Failed to fetch user info from GitHub."), category="error")
|
flash(_(u"Failed to fetch user info from GitHub."), category="error")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
github_info = resp.json()
|
github_info = resp.json()
|
||||||
@ -158,12 +158,12 @@ if ub.oauth_support:
|
|||||||
@oauth_authorized.connect_via(google_blueprint)
|
@oauth_authorized.connect_via(google_blueprint)
|
||||||
def google_logged_in(blueprint, token):
|
def google_logged_in(blueprint, token):
|
||||||
if not token:
|
if not token:
|
||||||
flash(_("Failed to log in with Google."), category="error")
|
flash(_(u"Failed to log in with Google."), category="error")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
resp = blueprint.session.get("/oauth2/v2/userinfo")
|
resp = blueprint.session.get("/oauth2/v2/userinfo")
|
||||||
if not resp.ok:
|
if not resp.ok:
|
||||||
flash(_("Failed to fetch user info from Google."), category="error")
|
flash(_(u"Failed to fetch user info from Google."), category="error")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
google_info = resp.json()
|
google_info = resp.json()
|
||||||
@ -226,7 +226,7 @@ if ub.oauth_support:
|
|||||||
if config.config_public_reg:
|
if config.config_public_reg:
|
||||||
return redirect(url_for('web.register'))
|
return redirect(url_for('web.register'))
|
||||||
else:
|
else:
|
||||||
flash(_('Public registration is not enabled'), category="error")
|
flash(_(u"Public registration is not enabled"), category="error")
|
||||||
redirect(url_for(redirect_url))
|
redirect(url_for(redirect_url))
|
||||||
except NoResultFound:
|
except NoResultFound:
|
||||||
return redirect(url_for(redirect_url))
|
return redirect(url_for(redirect_url))
|
||||||
@ -261,14 +261,14 @@ if ub.oauth_support:
|
|||||||
ub.session.delete(oauth)
|
ub.session.delete(oauth)
|
||||||
ub.session.commit()
|
ub.session.commit()
|
||||||
logout_oauth_user()
|
logout_oauth_user()
|
||||||
flash(_("Unlink to %(oauth)s success.", oauth=oauth_check[provider]), category="success")
|
flash(_(u"Unlink to %(oauth)s success.", oauth=oauth_check[provider]), category="success")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
app.logger.exception(e)
|
app.logger.exception(e)
|
||||||
ub.session.rollback()
|
ub.session.rollback()
|
||||||
flash(_("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:
|
||||||
app.logger.warning("oauth %s for user %d not fount" % (provider, current_user.id))
|
app.logger.warning("oauth %s for user %d not fount" % (provider, current_user.id))
|
||||||
flash(_("Not linked to %(oauth)s.", oauth=oauth_check[provider]), category="error")
|
flash(_(u"Not linked to %(oauth)s.", oauth=oauth_check[provider]), category="error")
|
||||||
return redirect(url_for('web.profile'))
|
return redirect(url_for('web.profile'))
|
||||||
|
|
||||||
|
|
||||||
@ -276,14 +276,14 @@ if ub.oauth_support:
|
|||||||
@oauth_error.connect_via(github_blueprint)
|
@oauth_error.connect_via(github_blueprint)
|
||||||
def github_error(blueprint, error, error_description=None, error_uri=None):
|
def github_error(blueprint, error, error_description=None, error_uri=None):
|
||||||
msg = (
|
msg = (
|
||||||
"OAuth error from {name}! "
|
u"OAuth error from {name}! "
|
||||||
"error={error} description={description} uri={uri}"
|
u"error={error} description={description} uri={uri}"
|
||||||
).format(
|
).format(
|
||||||
name=blueprint.name,
|
name=blueprint.name,
|
||||||
error=error,
|
error=error,
|
||||||
description=error_description,
|
description=error_description,
|
||||||
uri=error_uri,
|
uri=error_uri,
|
||||||
)
|
) # ToDo: Translate
|
||||||
flash(msg, category="error")
|
flash(msg, category="error")
|
||||||
|
|
||||||
|
|
||||||
@ -322,14 +322,14 @@ if ub.oauth_support:
|
|||||||
@oauth_error.connect_via(google_blueprint)
|
@oauth_error.connect_via(google_blueprint)
|
||||||
def google_error(blueprint, error, error_description=None, error_uri=None):
|
def google_error(blueprint, error, error_description=None, error_uri=None):
|
||||||
msg = (
|
msg = (
|
||||||
"OAuth error from {name}! "
|
u"OAuth error from {name}! "
|
||||||
"error={error} description={description} uri={uri}"
|
u"error={error} description={description} uri={uri}"
|
||||||
).format(
|
).format(
|
||||||
name=blueprint.name,
|
name=blueprint.name,
|
||||||
error=error,
|
error=error,
|
||||||
description=error_description,
|
description=error_description,
|
||||||
uri=error_uri,
|
uri=error_uri,
|
||||||
)
|
) # ToDo: Translate
|
||||||
flash(msg, category="error")
|
flash(msg, category="error")
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user