Merge branch 'oauth-userid-fix-pleasework' into 'master'

Update cps/ub.py, cps/admin.py, cps/templates/config_edit.html

See merge request Jafner/calibre-web!4
This commit is contained in:
Joey Hafner 2022-07-12 08:08:15 +00:00
commit e5fe6c7077
3 changed files with 5 additions and 5 deletions

View File

@ -1120,7 +1120,7 @@ def _configuration_oauth_helper(to_save):
"oauth_base_url": to_save["config_" + str(element['id']) + "_oauth_base_url"],
"oauth_auth_url": to_save["config_" + str(element['id']) + "_oauth_auth_url"],
"oauth_token_url": to_save["config_" + str(element['id']) + "_oauth_token_url"],
"oauth_userinfo_url": to_save["config_" + str(element['id']) + "oauth_userinfo_url"],
"oauth_userinfo_url": to_save["config_" + str(element['id']) + "_oauth_userinfo_url"],
"username_mapper": to_save["config_" + str(element['id']) + "_username_mapper"],
"email_mapper": to_save["config_" + str(element['id']) + "_email_mapper"],
"login_button": to_save["config_" + str(element['id']) + "_login_button"],

View File

@ -331,10 +331,10 @@
<input type="text" class="form-control" id="config_{{ prov['id'] }}_oauth_token_url" name="config_{{ prov['id'] }}_oauth_token_url" value="{% if prov['oauth_token_url']%}{{ prov['oauth_token_url'] }}{% endif %}" autocomplete="off">
</div>
{% endif %}
{% if 'oauth_userid_url' in prov %}
{% if 'oauth_userinfo_url' in prov %}
<div class="form-group">
<label for="config_{{ prov['id'] }}_oauth_userid_url">{{_('%(provider)s OAuth UserID URL (relative)', provider=prov['provider_name'])}}</label>
<input type="text" class="form-control" id="config_{{ prov['id'] }}_oauth_userid_url" name="config_{{ prov['id'] }}_oauth_userid_url" value="{% if prov['oauth_userid_url']%}{{ prov['oauth_userid_url'] }}{% endif %}" autocomplete="off">
<label for="config_{{ prov['id'] }}_oauth_userinfo_url">{{_('%(provider)s OAuth UserInfo URL (relative)', provider=prov['provider_name'])}}</label>
<input type="text" class="form-control" id="config_{{ prov['id'] }}_oauth_userinfo_url" name="config_{{ prov['id'] }}_oauth_userinfo_url" value="{% if prov['oauth_userinfo_url']%}{{ prov['oauth_userinfo_url'] }}{% endif %}" autocomplete="off">
</div>
{% endif %}
{% if 'username_mapper' in prov %}

View File

@ -260,10 +260,10 @@ class OAuthProvider(Base):
provider_name = Column(String)
oauth_client_id = Column(String)
oauth_client_secret = Column(String)
oauth_userinfo_url = Column(String, default="/protocol/openid-connect/userinfo")
oauth_base_url = Column(String)
oauth_auth_url = Column(String, default="/protocol/openid-connect/auth")
oauth_token_url = Column(String, default="/protocol/openid-connect/token")
oauth_userid_url = Column(String, default="/application/o/userinfo/")
scope = Column(String, default="openid profile email")
username_mapper = Column(String, default="preferred_username")
email_mapper = Column(String, default="email")