Index: main/waeup.ikoba/trunk/src/waeup/ikoba/mandates/browser.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/mandates/browser.py	(revision 11985)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/mandates/browser.py	(revision 12816)
@@ -19,4 +19,5 @@
 """
 import grok
+from urllib import urlencode
 from waeup.ikoba.browser.layout import UtilityView
 from waeup.ikoba.interfaces import ICompany
@@ -42,8 +43,10 @@
             return
         msg = mandate.execute()
+        self.mandate_name = mandate.__class__.__name__
         self.flash(msg)
         return
 
     def render(self):
-        self.redirect(self.url(self.context, 'login'))
+        args = {'camefrom': self.mandate_name}
+        self.redirect(self.url(self.context) + '/login?%s' % urlencode(args))
         return
Index: main/waeup.ikoba/trunk/src/waeup/ikoba/mandates/tests.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/mandates/tests.py	(revision 11985)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/mandates/tests.py	(revision 12816)
@@ -153,5 +153,6 @@
             % mandate.mandate_id)
         # Password has been set.
-        self.assertTrue('Password has been successfully set. Login with your new password.'
+        self.assertTrue(
+            'Password has been successfully set. Login with your new password.'
             in self.browser.contents)
         self.assertTrue(IUserAccount(customer).checkPassword('mypwd1'))
@@ -159,3 +160,13 @@
         self.assertEqual(len(self.app['mandates'].keys()), 0)
         # We redirect to login page not to the frontpage.
-        self.assertEqual(self.browser.url, 'http://localhost/app/login')
+        self.assertEqual(
+            self.browser.url,
+            'http://localhost/app/login?camefrom=PasswordMandate')
+        # After login we redirect to the changepassword page.
+        self.browser.getControl(name="form.login").value = customer.customer_id
+        self.browser.getControl(name="form.password").value = 'mypwd1'
+        self.browser.getControl("Login").click()
+        self.assertEqual(
+            self.browser.url,
+            'http://localhost/app/customers/%s/changepassword'
+            % customer.customer_id)
