Skip to content

Commit

Permalink
Merge PR #481 into 15.0
Browse files Browse the repository at this point in the history
Signed-off-by vincent-hatakeyama
  • Loading branch information
OCA-git-bot committed Sep 14, 2023
2 parents b3984a9 + 0dd018b commit e653e8b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 23 deletions.
2 changes: 1 addition & 1 deletion auth_saml/__manifest__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"maintainers": ["vincent-hatakeyama"],
"website": "https://github.com/OCA/server-auth",
"license": "AGPL-3",
"depends": ["base_setup"],
"depends": ["base_setup", "web"],
"external_dependencies": {
# Place an upper bound on cryptography version to be compatible with
# pyopenssl 19 mentioned in Odoo 15's requirements.txt. If we don't do
Expand Down
6 changes: 1 addition & 5 deletions auth_saml/controllers/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,6 @@ def list_saml_providers(self, with_autoredirect: bool = False) -> models.Model:
domain.append(("autoredirect", "=", True))
providers = request.env["auth.saml.provider"].sudo().search_read(domain)

for provider in providers:
# Compatibility with auth_oauth/controllers/main.py in order to
# avoid KeyError rendering template_auth_oauth_providers
provider.setdefault("auth_link", "")
return providers

def _saml_autoredirect(self):
Expand Down Expand Up @@ -131,7 +127,7 @@ def web_login(self, *args, **kw):
else:
error = None

response.qcontext["providers"] = providers
response.qcontext["saml_providers"] = providers

if error:
response.qcontext["error"] = error
Expand Down
5 changes: 4 additions & 1 deletion auth_saml/models/auth_saml_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,11 @@ class AuthSamlProvider(models.Model):
css_class = fields.Char(
string="Button Icon CSS class",
help="Add a CSS class that serves you to style the login button.",
default="fa fa-fw fa-sign-in text-primary",
)
body = fields.Char(
string="Login button label", help="Link text in Login Dialog", translate=True
)
body = fields.Char(string="Button Description")
autoredirect = fields.Boolean(
"Automatic Redirection",
default=False,
Expand Down
10 changes: 6 additions & 4 deletions auth_saml/readme/CONTRIBUTORS.rst
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
* Florent Aide <[email protected]>
* Vincent Hatakeyama <[email protected]>
* Alexandre Brun <[email protected]>
* XCG Consulting, part of `Orbeet <https://orbeet.io>`__:

* Florent Aide <[email protected]>
* Vincent Hatakeyama <[email protected]>
* Alexandre Brun
* Houzéfa Abbasbhay <[email protected]>
* Jeremy Co Kim Len <[email protected]>
* Houzéfa Abbasbhay <[email protected]>
* Jeffery Chen Fan <[email protected]>
* Bhavesh Odedra <[email protected]>
* `Tecnativa <https://www.tecnativa.com/>`__:
Expand Down
27 changes: 15 additions & 12 deletions auth_saml/views/auth_saml.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,28 @@
<odoo>
<!-- login form button -->
<template id="auth_saml.providers" name="Auth SAML Providers">
<t t-if="len(providers) &gt; 0">
<t t-if="len(saml_providers) &gt; 0">
<em
t-attf-class="d-block text-center text-muted small my-#{len(providers) if len(providers) &lt; 3 else 3}"
>- or -</em>
<div class="o_login_saml2 mt-1 mb-1 text-left">
<t t-foreach="providers" t-as="p">
<a
t-att-href="'/auth_saml/get_auth_request?pid=%s'%p['id']"
class="btn btn-outline-primary btn-block"
>
<i t-att-class="p['css_class']" />
<t t-esc="p['body']" />
</a>
</t>
<div class="o_login_saml2 list-group mt-1 mb-1 text-left">
<a
t-foreach="saml_providers"
t-as="p"
class="list-group-item list-group-item-action py-2"
t-att-href="'/auth_saml/get_auth_request?pid=%s'%p['id']"
>
<i t-att-class="p['css_class']" />
<t t-esc="p['body']" />
</a>
</div>
</t>
</template>
<template id="auth_saml.login" inherit_id="web.login" name="Samlv2 Login buttons">
<xpath expr="//div[hasclass('o_login_auth')]" position="after">
<xpath expr="//form" position="before">
<t t-set="form_small" t-value="True" t-if="len(saml_providers) &gt; 2" />
</xpath>
<xpath expr="//div[hasclass('o_login_auth')]" position="inside">
<t t-call="auth_saml.providers" />
</xpath>
</template>
Expand Down

0 comments on commit e653e8b

Please sign in to comment.