merge tls-sprint
authorsylvain.thenault@logilab.fr
Wed, 13 May 2009 11:02:47 +0200
branchtls-sprint
changeset 1779 e11b0dcc26bd
parent 1778 311026c9073a (current diff)
parent 1777 7bd776052e2b (diff)
child 1780 7549509ce0e6
merge
--- a/web/data/cubicweb.login.css	Wed May 13 11:02:40 2009 +0200
+++ b/web/data/cubicweb.login.css	Wed May 13 11:02:47 2009 +0200
@@ -9,7 +9,7 @@
   position: absolute;
   z-index: 400;
   right: 0px;
-  width: 23em;
+  width: 26em;
   padding: 0px 1px 1px;
   font-weight: bold;
   background: #E4EAD8; 
@@ -24,8 +24,8 @@
   position : absolute;
   top: 15%;
   left : 50%;
-  margin-left: -11em;
-  width: 24em;
+  margin-left: -14em;
+  width: 28em;
   background: #fff;
   border: 2px solid #cfceb7;
   padding-bottom: 0.5em;
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/web/test/unittest_views_basetemplates.py	Wed May 13 11:02:47 2009 +0200
@@ -0,0 +1,16 @@
+from cubicweb.devtools.testlib import WebTest
+from cubicweb.devtools.htmlparser import DTDValidator
+
+
+class LogFormTemplateTC(WebTest):
+
+    def _login_labels(self):
+        valid = self.content_type_validators.get('text/html', DTDValidator)()
+        page = valid.parse_string(self.vreg.main_template(self.request(), 'login'))
+        return page.find_tag('label')
+
+    def test_label(self):
+        self.set_option('allow-email-login', 'yes')
+        self.assertEquals(self._login_labels(), ['login or email', 'password'])
+        self.set_option('allow-email-login', 'no')
+        self.assertEquals(self._login_labels(), ['login', 'password'])
--- a/web/views/basetemplates.py	Wed May 13 11:02:40 2009 +0200
+++ b/web/views/basetemplates.py	Wed May 13 11:02:47 2009 +0200
@@ -455,7 +455,8 @@
                % html_escape(login_form_url(self.config, self.req)))
         self.w(u'<table>\n')
         self.w(u'<tr>\n')
-        self.w(u'<td><label for="__login">%s</label></td>' % _('login or email'))
+        msg = (self.config['allow-email-login'] and _('login or email')) or _('login')
+        self.w(u'<td><label for="__login">%s</label></td>' % msg)
         self.w(u'<td><input name="__login" id="__login" class="data" type="text" /></td>')
         self.w(u'</tr><tr>\n')
         self.w(u'<td><label for="__password" >%s</label></td>' % _('password'))