=== modified file 'src/identityprovider/tests/openid_server/per_version/test_sso_workflow_reset_password.py'
--- src/identityprovider/tests/openid_server/per_version/test_sso_workflow_reset_password.py	2018-02-08 15:12:52 +0000
+++ src/identityprovider/tests/openid_server/per_version/test_sso_workflow_reset_password.py	2019-01-09 18:49:43 +0000
@@ -21,9 +21,8 @@
         # At this point, we are at the login page.  Lets try to recover a
         # password for an unregistered email.
         link = self.get_attribute_from_response(
-            response,
-            'a[data-qa-id="forgot_password_link"]',
-            'href')
+            response, 'input[name="forgot_password"]', 'formaction')
+
         data = dict(email='no-account@example.com')
         response = self.client.post(link, data=data, follow=True)
 
@@ -36,9 +35,8 @@
         response = self.do_openid_dance()
 
         link = self.get_attribute_from_response(
-            response,
-            'a[data-qa-id="forgot_password_link"]',
-            'href')
+            response, 'input[name="forgot_password"]', 'formaction')
+
         data = dict(email='support@ubuntu.com')
         response = self.client.post(link, data=data, follow=True)
 
@@ -51,9 +49,8 @@
 
         response = self.do_openid_dance()
         link = self.get_attribute_from_response(
-            response,
-            'a[data-qa-id="forgot_password_link"]',
-            'href')
+            response, 'input[name="forgot_password"]', 'formaction')
+
         data = dict(email=self.default_email)
         response = self.client.post(link, data=data, follow=True)
 

=== modified file 'src/identityprovider/tests/sso_server/test_prefilled_email.py'
--- src/identityprovider/tests/sso_server/test_prefilled_email.py	2013-11-12 13:44:06 +0000
+++ src/identityprovider/tests/sso_server/test_prefilled_email.py	2019-01-09 18:49:43 +0000
@@ -13,11 +13,12 @@
         """Forgot Password form."""
         response = self.login(email=self.new_email)
 
+        email = self.get_attribute_from_response(
+            response, 'input[name="email"]', 'value')
         link = self.get_attribute_from_response(
-            response,
-            'a[data-qa-id="forgot_password_link"]',
-            'href')
+            response, 'input[name="forgot_password"]', 'formaction')
 
-        response = self.client.get(link)
+        response = self.client.post(
+            link, data={'email': email, 'forgot_password': ''})
         email_field = self.get_from_response(response, 'input[name="email"]')
         self.assertEqual(email_field[0].get('value'), self.new_email)

=== removed file 'src/webui/templates/common/forgot_password_link.html'
--- src/webui/templates/common/forgot_password_link.html	2017-02-26 01:29:52 +0000
+++ src/webui/templates/common/forgot_password_link.html	1970-01-01 00:00:00 +0000
@@ -1,5 +0,0 @@
-{% load i18n url_with_token %}
-{% if not readonly %}
-    <a href="{% url_with_token 'forgot_password' %}{% if form.email.data %}?email={{ form.email.data|urlencode }}{% endif %}"
-       id="forgotpw-link" data-qa-id="forgot_password_link">{% trans "Forgot your password?" %}</a>
-{% endif %}

=== modified file 'src/webui/templates/registration/_login_form.html'
--- src/webui/templates/registration/_login_form.html	2017-02-26 01:29:52 +0000
+++ src/webui/templates/registration/_login_form.html	2019-01-09 18:49:43 +0000
@@ -43,7 +43,11 @@
         <button type="submit" class="btn cta" name="continue" data-qa-id="login_button">
             <span>{% trans "Log in" %}</span>
         </button>
-        <p class="forgot-password">{% include "common/forgot_password_link.html" %}</p>
+        {% if not readonly %}
+        <input type="submit" class="forgot-password" name="forgot_password" formnovalidate formaction="{% url_with_token 'forgot_password' %}"
+            style="border:none; outline:none; background:none; cursor:pointer; color:#dd4814;"
+            value="{% trans 'Forgot your password?' %}">
+        {% endif %}
 
         {% comment %}
         {% if token %}{% trans "or" %}

=== modified file 'src/webui/templates/registration/login.html'
--- src/webui/templates/registration/login.html	2014-12-10 15:30:54 +0000
+++ src/webui/templates/registration/login.html	2019-01-09 18:49:43 +0000
@@ -26,7 +26,7 @@
     <h1 class="u1-h-main">{% trans "One account to log in to everything on Ubuntu" %}</h1>
 {% endblock %}
 
-/div>
+</div>
 
 {% block extra_css %}
     {% if rpconfig and rpconfig.logo_url %}

=== modified file 'src/webui/tests/test_views_registration.py'
--- src/webui/tests/test_views_registration.py	2018-12-20 18:23:07 +0000
+++ src/webui/tests/test_views_registration.py	2019-01-09 18:49:43 +0000
@@ -496,6 +496,20 @@
         ctx = response.context_data
         self.assertEqual(ctx['form']['email'].value(), 'test@test.com')
 
+    def test_post_with_initial_data(self):
+        data = dict(email='test@test.com', forgot_password='')
+        response = self.post(data=data)
+        self.assert_form_displayed(response)
+        ctx = response.context_data
+        self.assertEqual(ctx['form']['email'].value(), 'test@test.com')
+
+    def test_post_with_initial_data_no_email(self):
+        data = dict(forgot_password='')
+        response = self.post(data=data)
+        self.assert_form_displayed(response)
+        ctx = response.context_data
+        self.assertIsNone(ctx['form']['email'].value())
+
     def test_post_required_fields(self):
         response = self.post()
         self.assert_form_displayed(response, email=FIELD_REQUIRED)

=== modified file 'src/webui/views/registration.py'
--- src/webui/views/registration.py	2018-12-20 18:23:07 +0000
+++ src/webui/views/registration.py	2019-01-09 18:49:43 +0000
@@ -186,10 +186,11 @@
     def collect_stats(key):
         stats.increment('flows.forgot_password', key=key, rpconfig=rpconfig)
 
-    if request.method == 'GET':
+    if request.method == 'GET' or 'forgot_password' in request.POST:
         # track forgot password requests
         collect_stats('requested')
-        form = GenericEmailForm(initial={'email': request.GET.get('email')})
+        email = request.GET.get('email', request.POST.get('email'))
+        form = GenericEmailForm(initial={'email': email})
 
     elif request.method == 'POST':
         form = GenericEmailForm(request.POST)

