diff mbox

[Branch,~linaro-validation/lava-server/trunk] Rev 412: Cosmetic changes to better support generic OpenID (OPENID_SSO_SERVER_URL unset).

Message ID 20130724095035.12291.21913.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Paul Sokolovsky July 24, 2013, 9:50 a.m. UTC
------------------------------------------------------------
revno: 412
committer: Paul Sokolovsky <paul.sokolovsky@linaro.org>
branch nick: lava-server.openid-generic
timestamp: Tue 2013-07-23 16:29:45 +0300
message:
  Cosmetic changes to better support generic OpenID (OPENID_SSO_SERVER_URL unset).
  
  If OPENID_SSO_SERVER_URL is unset or non-Launchpad OpenID server is used,
  just use generic OpenID wording.
modified:
  lava_server/context_processors.py
  lava_server/templates/registration/login.html


--
lp:lava-server
https://code.launchpad.net/~linaro-validation/lava-server/trunk

You are subscribed to branch lp:lava-server.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-server/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'lava_server/context_processors.py'
--- lava_server/context_processors.py	2012-05-11 20:11:09 +0000
+++ lava_server/context_processors.py	2013-07-23 13:29:45 +0000
@@ -21,6 +21,7 @@ 
 import lava_server
 from lava_server.extension import Menu, loader
 from django.core.urlresolvers import reverse
+from django.conf import settings
 
 
 def lava(request):
@@ -47,4 +48,10 @@ 
 
 def openid_available(request):
     openid_enabled = "django_openid_auth.auth.OpenIDBackend" in lava_server.settings.common.AUTHENTICATION_BACKENDS
-    return {"openid_available": openid_enabled}
+    # Check if we use generic OpenID or Launchpad.net
+    openid_url = getattr(settings, "OPENID_SSO_SERVER_URL", "")
+    if "ubuntu.com" in openid_url or "launchpad.net" in openid_url:
+        provider = 'Launchpad.net'
+    else:
+        provider = "OpenID"
+    return {"openid_available": openid_enabled, "openid_provider": provider}

=== modified file 'lava_server/templates/registration/login.html'
--- lava_server/templates/registration/login.html	2012-05-11 20:11:09 +0000
+++ lava_server/templates/registration/login.html	2013-07-23 13:29:45 +0000
@@ -40,7 +40,7 @@ 
   <table>
     {% if openid_available %}
     <tr>
-      <th id="lp_net_column">{% trans "Use Launchpad.net account" %}</th>
+      <th id="lp_net_column">{% blocktrans %}Use {{ openid_provider }} account{% endblocktrans %}</th>
       <th id="or_column" rowspan="3">&ge;</th>
       <th id="local_account_column">{% trans "Use custom account" %}</th>
     </tr>
@@ -51,10 +51,10 @@ 
         {% blocktrans %}
         <p>Thanks to the <a
           href="http://openid.net/get-an-openid/what-is-openid/"
-          >OpenID technology</a> you can use your existing <a
-          href="http://login.launchpad.net/">launchpad.net</a> account to
+          >OpenID technology</a> you can use your existing
+          {{ openid_provider }} account to
         access the dashboard.</p>
-        <p>This is the preferred method as you don't need to worry about
+        <p>This is the recommended method as you don't need to worry about
         having to maintain another account just for this website.</p>
         {% endblocktrans %}
       </td>
@@ -79,7 +79,7 @@ 
       {% if openid_available %}
       <th>
         <a class="button" href="{% url django_openid_auth.views.login_begin %}?next={{next|escape}}"
-          >{% trans "Sign in with Launchpad.net" %}</a>
+          >{% blocktrans %}Sign in with {{ openid_provider }}{% endblocktrans %}</a>
       </th>
       {% endif %}
       <th>