Index: main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/mydatadropdowntabs.pt
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/mydatadropdowntabs.pt	(revision 11975)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/customers/browser_templates/mydatadropdowntabs.pt	(revision 11975)
@@ -0,0 +1,13 @@
+<li  tal:attributes="class viewlet/active">
+  <a href="#" class="dropdown-toggle"
+     data-toggle="dropdown">
+     <span tal:replace="viewlet/tab_title">My Data</span>
+     <b class="caret"></b>
+  </a>
+  <ul class="dropdown-menu">
+    <li tal:repeat="target viewlet/targets">
+      <a tal:attributes="href target/url"
+         tal:content="target/title">LINKTITLE</a>
+    </li>
+  </ul>
+</li>
Index: main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py	(revision 11974)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py	(revision 11975)
@@ -446,2 +446,54 @@
                         'K1000000 - account activated' in logcontent)
 
+
+    def test_login_as_customer(self):
+        # CustomerImpersonators can login as customer
+        # Create clearance officer
+        self.app['users'].addUser('mrofficer', 'mrofficersecret')
+        self.app['users']['mrofficer'].email = 'mrofficer@foo.ng'
+        self.app['users']['mrofficer'].title = 'Harry Actor'
+        prmglobal = IPrincipalRoleManager(self.app)
+        prmglobal.assignRoleToPrincipal('waeup.CustomerImpersonator', 'mrofficer')
+        prmglobal.assignRoleToPrincipal('waeup.CustomersManager', 'mrofficer')
+        # Login as customer impersonator
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = 'mrofficer'
+        self.browser.getControl(name="form.password").value = 'mrofficersecret'
+        self.browser.getControl("Login").click()
+        self.assertMatches('...You logged in...', self.browser.contents)
+        self.browser.open(self.customer_path)
+        self.browser.getLink("Login as").click()
+        self.browser.getControl("Set password now").click()
+        temp_password = self.browser.getControl(name='form.password').value
+        self.browser.getControl("Login now").click()
+        self.assertMatches(
+            '...You successfully logged in as...', self.browser.contents)
+        # We are logged in as customer and can see the 'My Data' tab
+        self.assertMatches(
+            '...<a href="#" class="dropdown-toggle" data-toggle="dropdown">...',
+            self.browser.contents)
+        self.assertMatches(
+            '...My Data...',
+            self.browser.contents)
+        self.browser.getLink("Logout").click()
+        # The customer can't login with the original password ...
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.customer_id
+        self.browser.getControl(name="form.password").value = 'spwd'
+        self.browser.getControl("Login").click()
+        self.assertMatches(
+            '...Your account has been temporarily deactivated...',
+            self.browser.contents)
+        # ... but with the temporary password
+        self.browser.open(self.login_path)
+        self.browser.getControl(name="form.login").value = self.customer_id
+        self.browser.getControl(name="form.password").value = temp_password
+        self.browser.getControl("Login").click()
+        self.assertMatches('...You logged in...', self.browser.contents)
+        # Creation of temp_password is properly logged
+        logfile = os.path.join(
+            self.app['datacenter'].storage, 'logs', 'customers.log')
+        logcontent = open(logfile).read()
+        self.assertTrue(
+            'mrofficer - customers.browser.LoginAsCustomerStep1 - K1000000 - '
+            'temp_password generated: %s' % temp_password in logcontent)
