Index: main/waeup.kofa/trunk/src/waeup/kofa/mandates/browser.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/mandates/browser.py	(revision 13962)
+++ main/waeup.kofa/trunk/src/waeup/kofa/mandates/browser.py	(revision 13986)
@@ -34,16 +34,16 @@
         mandate_id = form.get('mandate_id', None)
         if not mandate_id:
-            self.flash(_('Misuse'))
+            (self.msg, self.redirect_path) = (_('Misuse'), '')
             return
         mandates = grok.getSite()['mandates']
         mandate = mandates.get(mandate_id, None)
         if mandate is None:
-            self.flash(_('No mandate.'))
+            (self.msg, self.redirect_path) = (_('No mandate.'), '')
             return
-        msg = mandate.execute()
-        self.flash(msg)
+        (self.msg, self.redirect_path) = mandate.execute()
         return
 
     def render(self):
-        self.redirect(self.url(self.context, 'login'))
+        self.flash(self.msg)
+        self.redirect(self.url(self.context, self.redirect_path))
         return
Index: main/waeup.kofa/trunk/src/waeup/kofa/mandates/mandate.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/mandates/mandate.py	(revision 13962)
+++ main/waeup.kofa/trunk/src/waeup/kofa/mandates/mandate.py	(revision 13986)
@@ -67,4 +67,5 @@
     def execute(self):
         msg = _('Wrong mandate parameters.')
+        redirect_path = ''
         if self.expires < datetime.utcnow():
             msg = _('Mandate expired.')
@@ -75,4 +76,5 @@
             grok.getSite().logger.info(
                 'PasswordMandate used: %s ' % username)
+            redirect_path = 'login'
         del self.__parent__[self.mandate_id]
-        return msg
+        return msg, redirect_path
Index: main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py
===================================================================
--- main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py	(revision 13962)
+++ main/waeup.kofa/trunk/src/waeup/kofa/mandates/tests.py	(revision 13986)
@@ -90,11 +90,13 @@
         mandate = PasswordMandate()
         self.app['mandates'].addMandate(mandate)
-        msg = mandate.execute()
+        (msg, redirect_path) = mandate.execute()
+        self.assertEqual(redirect_path, '')
         self.assertEqual(msg, u'Wrong mandate parameters.')
         # Add and execute an expired mandate.
         mandate = PasswordMandate(days=0)
         self.app['mandates'].addMandate(mandate)
-        msg = mandate.execute()
+        (msg, redirect_path) = mandate.execute()
         self.assertEqual(msg, u'Mandate expired.')
+        self.assertEqual(redirect_path, '')
         # Add and execute a perfect mandate
         mandate = PasswordMandate()
@@ -102,7 +104,9 @@
         mandate.params['password'] = 'mypwd1'
         self.app['mandates'].addMandate(mandate)
-        msg = mandate.execute()
-        # Password has been set.
-        self.assertEqual(msg, 'Password has been successfully set. Login with your new password.')
+        (msg, redirect_path) = mandate.execute()
+        # Password has been set.
+        self.assertEqual(msg,
+            'Password has been successfully set. Login with your new password.')
+        self.assertEqual(redirect_path, 'login')
         self.assertTrue(IUserAccount(student).checkPassword('mypwd1'))
         # All mandates have been removed.
@@ -120,7 +124,9 @@
         mandate.params['password'] = 'mypwd1'
         self.app['mandates'].addMandate(mandate)
-        msg = mandate.execute()
-        # Password has been set.
-        self.assertEqual(msg, 'Password has been successfully set. Login with your new password.')
+        (msg, redirect_path) = mandate.execute()
+        # Password has been set.
+        self.assertEqual(msg,
+            'Password has been successfully set. Login with your new password.')
+        self.assertEqual(redirect_path, 'login')
         self.assertTrue(IUserAccount(officer).checkPassword('mypwd1'))
         logfile = os.path.join(
@@ -136,7 +142,9 @@
         mandate.params['password'] = 'mypwd1'
         self.app['mandates'].addMandate(mandate)
-        msg = mandate.execute()
-        # Password has been set.
-        self.assertEqual(msg, 'Password has been successfully set. Login with your new password.')
+        (msg, redirect_path) = mandate.execute()
+        # Password has been set.
+        self.assertEqual(msg,
+            'Password has been successfully set. Login with your new password.')
+        self.assertEqual(redirect_path, 'login')
         self.assertTrue(IUserAccount(applicant).checkPassword('mypwd1'))
         logfile = os.path.join(
@@ -197,2 +205,12 @@
         # We redirect to login page not to the frontpage.
         self.assertEqual(self.browser.url, 'http://localhost/app/login')
+        # Mandate has been deleted
+        self.browser.open('http://localhost/app/mandate?mandate_id=%s'
+            % mandate.mandate_id)
+        self.assertTrue('No mandate' in self.browser.contents)
+        self.assertEqual(self.browser.url, 'http://localhost/app/')
+        # Mandate id is needed
+        self.browser.open('http://localhost/app/mandate')
+        self.assertTrue('Misuse' in self.browser.contents)
+        self.assertEqual(self.browser.url, 'http://localhost/app/')
+        return
