mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	github: Add sign up button on registration page.
This commit is contained in:
		@@ -65,15 +65,28 @@ $(function () {
 | 
			
		||||
                        {% endfor %}
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
 | 
			
		||||
                    {% if google_auth_enabled %}
 | 
			
		||||
                    {% if any_oauth_backend_enabled %}
 | 
			
		||||
                    <div class="or">or</div>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
 | 
			
		||||
                    {% if google_auth_enabled %}
 | 
			
		||||
                    <div class="register-google">
 | 
			
		||||
                        <a href="{{ url('zerver.views.auth.start_google_oauth2') }}">
 | 
			
		||||
                            <button class="login-google-button full-width">{{ _('Sign up with Google') }}</button>
 | 
			
		||||
                        </a>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
 | 
			
		||||
                    {% if github_auth_enabled %}
 | 
			
		||||
                    <div class="login-github">
 | 
			
		||||
                        <a href="{{ url('signup-social', args=('github',)) }}"
 | 
			
		||||
                           class="github-wrapper">
 | 
			
		||||
                            <button class="login-github-button github">
 | 
			
		||||
                                <span>{{ _('Sign up with GitHub') }}</span>
 | 
			
		||||
                            </button>
 | 
			
		||||
                        </a>
 | 
			
		||||
                    </div>
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                    {% endif %}
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>
 | 
			
		||||
 
 | 
			
		||||
@@ -677,6 +677,13 @@ class GitHubAuthBackendTest(ZulipTestCase):
 | 
			
		||||
        # type: () -> None
 | 
			
		||||
        result = self.client_get('/accounts/login/social/github')
 | 
			
		||||
        self.assertIn(reverse('social:begin', args=['github']), result.url)
 | 
			
		||||
        self.assertIn('is_signup=0', result.url)
 | 
			
		||||
 | 
			
		||||
    def test_signup_url(self):
 | 
			
		||||
        # type: () -> None
 | 
			
		||||
        result = self.client_get('/accounts/register/social/github')
 | 
			
		||||
        self.assertIn(reverse('social:begin', args=['github']), result.url)
 | 
			
		||||
        self.assertIn('is_signup=1', result.url)
 | 
			
		||||
 | 
			
		||||
    def test_github_complete(self):
 | 
			
		||||
        # type: () -> None
 | 
			
		||||
 
 | 
			
		||||
@@ -233,6 +233,11 @@ def start_social_login(request, backend):
 | 
			
		||||
    backend_url = reverse('social:begin', args=[backend])
 | 
			
		||||
    return redirect_to_main_site(request, backend_url)
 | 
			
		||||
 | 
			
		||||
def start_social_signup(request, backend):
 | 
			
		||||
    # type: (HttpRequest, Text) -> HttpResponse
 | 
			
		||||
    backend_url = reverse('social:begin', args=[backend])
 | 
			
		||||
    return redirect_to_main_site(request, backend_url, is_signup=True)
 | 
			
		||||
 | 
			
		||||
def send_oauth_request_to_google(request):
 | 
			
		||||
    # type: (HttpRequest) -> HttpResponse
 | 
			
		||||
    subdomain = request.GET.get('subdomain', '')
 | 
			
		||||
 
 | 
			
		||||
@@ -101,6 +101,9 @@ i18n_urls = [
 | 
			
		||||
    url(r'^avatar/(?P<email_or_id>[\S]+)?', zerver.views.users.avatar, name='zerver.views.users.avatar'),
 | 
			
		||||
 | 
			
		||||
    # Registration views, require a confirmation ID.
 | 
			
		||||
    url(r'^accounts/register/social/(\w+)$',
 | 
			
		||||
        zerver.views.auth.start_social_signup,
 | 
			
		||||
        name='signup-social'),
 | 
			
		||||
    url(r'^accounts/home/', zerver.views.registration.accounts_home,
 | 
			
		||||
        name='zerver.views.registration.accounts_home'),
 | 
			
		||||
    url(r'^accounts/send_confirm/(?P<email>[\S]+)?',
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user