Compare commits
1 Commits
generic-oa
...
4951c12da5
Author | SHA1 | Date |
---|---|---|
decentral1se | 4951c12da5 |
|
@ -1055,9 +1055,10 @@ def _configuration_oauth_helper(to_save):
|
|||
"oauth_token_url": to_save["config_" + str(element['id']) + "_oauth_token_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"],
|
||||
"login_button_url": to_save["config_" + str(element['id']) + "_login_button_url"],
|
||||
"scope": to_save["config_" + str(element['id']) + "_scope"],
|
||||
})
|
||||
oauth_check['login_button_url'] = to_save["config_" + str(element['id']) + "_login_button_url"]
|
||||
|
||||
return reboot_required
|
||||
|
||||
|
|
|
@ -245,7 +245,7 @@ def generate_oauth_blueprints():
|
|||
oauth_token_url=oauth_ids[2].oauth_token_url,
|
||||
username_mapper=oauth_ids[2].username_mapper,
|
||||
email_mapper=oauth_ids[2].email_mapper,
|
||||
login_button=oauth_ids[2].login_button)
|
||||
login_button_url=oauth_ids[2].login_button_url)
|
||||
oauthblueprints.append(ele1)
|
||||
oauthblueprints.append(ele2)
|
||||
oauthblueprints.append(ele3)
|
||||
|
|
|
@ -343,10 +343,10 @@
|
|||
<input type="text" class="form-control" id="config_{{ prov['id'] }}_email_mapper" name="config_{{ prov['id'] }}_email_mapper" value="{% if prov['email_mapper']%}{{ prov['email_mapper'] }}{% endif %}" autocomplete="off">
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if 'login_button' in prov %}
|
||||
{% if 'login_button_url' in prov %}
|
||||
<div class="form-group">
|
||||
<label for="config_{{ prov['id'] }}_login_button">{{_('%(provider)s OAuth Login Button', provider=prov['provider_name'])}}</label>
|
||||
<input type="text" class="form-control" id="config_{{ prov['id'] }}_login_button" name="config_{{ prov['id'] }}_login_button" value="{% if prov['login_button']%}{{ prov['login_button'] }}{% endif %}" autocomplete="off">
|
||||
<label for="config_{{ prov['id'] }}_login_button_url">{{_('%(provider)s OAuth Login Button Image URL', provider=prov['provider_name'])}}</label>
|
||||
<input type="text" class="form-control" id="config_{{ prov['id'] }}_login_button_url" name="config_{{ prov['id'] }}_login_button_url" value="{% if prov['login_button_url']%}{{ prov['login_button_url'] }}{% endif %}" autocomplete="off">
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
|
|
@ -42,7 +42,9 @@
|
|||
</a>
|
||||
{% endif %}
|
||||
{% if 3 in oauth_check %}
|
||||
<a href="{{url_for('oauth.generic_login')}}" class="pull-right generic">Log in with <b>{{ login_button }}</b></a>
|
||||
<a href="{{url_for('oauth.generic_login')}}" class="pull-right generic">
|
||||
<img src="{{ oauth_check['login_button_url'] }}" alt="generic oauth2 logo">
|
||||
</a>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
</form>
|
||||
|
|
|
@ -253,10 +253,10 @@ class OAuthProvider(Base):
|
|||
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")
|
||||
scope = Column(String, default="openid profile email")
|
||||
username_mapper = Column(String, default="preferred_username")
|
||||
email_mapper = Column(String, default="email")
|
||||
login_button = Column(String)
|
||||
scope = Column(String)
|
||||
username_mapper = Column(String)
|
||||
email_mapper = Column(String)
|
||||
login_button_url = Column(String, default="https://www.fortux.com/img/oauth2_logo.svg")
|
||||
active = Column(Boolean)
|
||||
|
||||
|
||||
|
|
|
@ -1599,18 +1599,11 @@ def login():
|
|||
next_url = request.args.get('next', default=url_for("web.index"), type=str)
|
||||
if url_for("web.logout") == next_url:
|
||||
next_url = url_for("web.index")
|
||||
|
||||
login_button = "generic oauth2 provider"
|
||||
if 3 in oauth_check:
|
||||
from .oauth_bb import oauthblueprints
|
||||
login_button = oauthblueprints[2].get('login_button') or login_button
|
||||
|
||||
return render_title_template('login.html',
|
||||
title=_(u"Login"),
|
||||
next_url=next_url,
|
||||
config=config,
|
||||
oauth_check=oauth_check,
|
||||
login_button=login_button,
|
||||
mail=config.get_mail_server_configured(), page="login")
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue