From 2faf84bbf59af78f939ed40fd50e577864a10139 Mon Sep 17 00:00:00 2001
From: David Fischer <david@readthedocs.org>
Date: Wed, 25 Apr 2018 12:36:38 -0700
Subject: [PATCH 1/3] Support sign in and sign up with GH/GL/BB

---
 media/css/core.css                            | 12 +++++++
 readthedocs/templates/account/login.html      | 22 ++++++++++---
 readthedocs/templates/account/signup.html     | 33 +++++++++++++++++++
 .../socialaccount/snippets/provider_list.html |  8 ++---
 4 files changed, 67 insertions(+), 8 deletions(-)
 create mode 100644 readthedocs/templates/account/signup.html

diff --git a/media/css/core.css b/media/css/core.css
index e363486f8c5..97aec349904 100644
--- a/media/css/core.css
+++ b/media/css/core.css
@@ -521,6 +521,18 @@ p.build-missing { font-size: .8em; color: #9d9a55; margin: 0 0 3px; }
 .navigable .profile_image img { border-radius:5px; }
 
 .profile #content { padding-top:8px; }
+
+/* login & signup pages */
+.login-page h3, .signup-page h3 {
+    margin: 40px 0;
+}
+.login-page .socialaccount_providers .button,
+.signup-page .socialaccount_providers .button {
+    display: inline-block;
+    float: none;
+    margin: 10px 0;
+}
+
 /* build page */
 
 #build_list select { width: 10em; }
diff --git a/readthedocs/templates/account/login.html b/readthedocs/templates/account/login.html
index c9bb569727c..18d24917efa 100644
--- a/readthedocs/templates/account/login.html
+++ b/readthedocs/templates/account/login.html
@@ -5,12 +5,14 @@
 
 {% block head_title %}{% trans "Sign In" %}{% endblock %}
 
+{% block body_class %}login-page{% endblock %}
+
 {% block content %}
 
 <h1>{% trans "Sign In" %}</h1>
 
-<p>{% blocktrans %}If you have not created an account yet, then please
-<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</p>
+<p><small>{% blocktrans %}If you have not created an account yet, then please
+<a href="{{ signup_url }}">sign up</a> first.{% endblocktrans %}</small></p>
 
 <form class="login" method="POST" action="{% url "account_login" %}">
   {% csrf_token %}
@@ -19,7 +21,19 @@ <h1>{% trans "Sign In" %}</h1>
   <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
   {% endif %}
   <button class="primaryAction" type="submit">{% trans "Sign In" %}</button>
-  {% blocktrans %}If you forgot your password, <a href="/accounts/password/reset/">reset it.</a>{% endblocktrans %}
+
+  {% url 'account_reset_password' as password_reset_url %}
+  <p>
+    <small>{% blocktrans %}If you forgot your password, <a href="{{ password_reset_url }}">reset it.</a>{% endblocktrans %}</small>
+  </p>
 </form>
 
-{% endblock %}
+<h3>{% trans 'Or' %}</h3>
+
+<div class="clearfix">
+  <ul class="socialaccount_providers">
+    {% include "socialaccount/snippets/provider_list.html" with process="login" next="" verbiage="Sign in with" %}
+  </ul>
+</div>
+
+{% endblock content %}
diff --git a/readthedocs/templates/account/signup.html b/readthedocs/templates/account/signup.html
new file mode 100644
index 00000000000..b9b2a81f767
--- /dev/null
+++ b/readthedocs/templates/account/signup.html
@@ -0,0 +1,33 @@
+{% extends "account/base.html" %}
+
+{% load i18n %}
+
+{% block head_title %}{% trans "Signup" %}{% endblock %}
+
+{% block body_class %}signup-page{% endblock %}
+
+{% block content %}
+<h1>{% trans "Sign Up" %}</h1>
+
+<p>
+  <small>{% blocktrans %}Already have an account? Then please <a href="{{ login_url }}">sign in</a>.{% endblocktrans %}</small>
+</p>
+
+<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
+  {% csrf_token %}
+  {{ form.as_p }}
+  {% if redirect_field_value %}
+  <input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
+  {% endif %}
+  <button type="submit">{% trans "Sign Up" %} &raquo;</button>
+</form>
+
+<h3>{% trans 'Or' %}</h3>
+
+<div class="clearfix">
+  <ul class="socialaccount_providers">
+    {% include "socialaccount/snippets/provider_list.html" with process="login" next="" verbiage="Sign up with" %}
+  </ul>
+</div>
+
+{% endblock %}
diff --git a/readthedocs/templates/socialaccount/snippets/provider_list.html b/readthedocs/templates/socialaccount/snippets/provider_list.html
index 2c8f2ee4140..9ca9482030d 100644
--- a/readthedocs/templates/socialaccount/snippets/provider_list.html
+++ b/readthedocs/templates/socialaccount/snippets/provider_list.html
@@ -11,8 +11,8 @@
            class="socialaccount-provider {{ provider.id }} {{ brand.id }} button"
            href="{% provider_login_url provider.id openid=brand.openid_url process=process next=next %}"
            >
-           {% blocktrans with brand_name=brand.name %}
-             Connect to {{ brand_name }}
+           {% blocktrans with brand_name=brand.name verbiage=verbiage|default:'Connect to' %}
+             {{ verbiage }} {{ brand_name }}
            {% endblocktrans %}
         </a>
       </li>
@@ -24,8 +24,8 @@
          class="socialaccount-provider {{ provider.id }} button"
          href="{% provider_login_url provider.id process=process scope=scope auth_params=auth_params next=next %}"
          >
-         {% blocktrans with provider_name=provider.name %}
-           Connect to {{ provider_name }}
+         {% blocktrans with provider_name=provider.name verbiage=verbiage|default:'Connect to' %}
+           {{ verbiage }} {{ provider_name }}
          {% endblocktrans %}
       </a>
     </li>

From 8a2bf285320baf4446f9cd9ca89c5b98f26efc13 Mon Sep 17 00:00:00 2001
From: David Fischer <david@readthedocs.org>
Date: Wed, 25 Apr 2018 13:57:23 -0700
Subject: [PATCH 2/3] Sign up is two words

---
 readthedocs/templates/account/signup.html | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/readthedocs/templates/account/signup.html b/readthedocs/templates/account/signup.html
index b9b2a81f767..4ee44570749 100644
--- a/readthedocs/templates/account/signup.html
+++ b/readthedocs/templates/account/signup.html
@@ -2,7 +2,7 @@
 
 {% load i18n %}
 
-{% block head_title %}{% trans "Signup" %}{% endblock %}
+{% block head_title %}{% trans "Sign up" %}{% endblock %}
 
 {% block body_class %}signup-page{% endblock %}
 

From 2b484ac5cde245058150c833083895db553a0e95 Mon Sep 17 00:00:00 2001
From: David Fischer <david@readthedocs.org>
Date: Wed, 25 Apr 2018 21:28:57 -0700
Subject: [PATCH 3/3] Let's verify social account emails

---
 readthedocs/settings/base.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/readthedocs/settings/base.py b/readthedocs/settings/base.py
index ed1b6b4fed3..5ee1c462fbb 100644
--- a/readthedocs/settings/base.py
+++ b/readthedocs/settings/base.py
@@ -273,7 +273,6 @@ def USE_PROMOS(self):  # noqa
     ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
     ACCOUNT_AUTHENTICATION_METHOD = 'username_email'
     ACCOUNT_ACTIVATION_DAYS = 7
-    SOCIALACCOUNT_EMAIL_VERIFICATION = 'none'
     SOCIALACCOUNT_AUTO_SIGNUP = False
     SOCIALACCOUNT_PROVIDERS = {
         'github': {