Browse Source

Merge pull request #5655 from getsentry/ui/improve-invite-flow

ui: improve invite/register flows
David Cramer 7 years ago
parent
commit
a89bd1c9cf

+ 12 - 8
src/sentry/templates/sentry/accept-organization-invite.html

@@ -27,14 +27,18 @@
           </div>
         {% endif %}
 
-        <p>{% blocktrans %}You have been invited to join this organization, which manages <strong>{{ project_count }}</strong> project(s), including:{% endblocktrans %}</p>
-        <ul>
-          {% for project in project_list|slice:"5" %}
-            <li>
-              {{ project.team.name }} &#47; {{ project.name }}
-            </li>
-          {% endfor %}
-        </ul>
+        {% if project_count %}
+          <p>{% blocktrans %}You have been invited to join this organization, which manages <strong>{{ project_count }}</strong> project(s), including:{% endblocktrans %}</p>
+          <ul>
+            {% for project in project_list|slice:"5" %}
+              <li>
+                {{ project.team.name }} &#47; {{ project.name }}
+              </li>
+            {% endfor %}
+          </ul>
+        {% else %}
+          <p>{% blocktrans %}You have been invited to join this organization.{% endblocktrans %}</p>
+        {% endif %}
 
         {% if needs_authentication %}
           <p>{% trans "To continue, you must either login to your existing account, or create a new one." %}</p>

+ 8 - 2
src/sentry/web/forms/accounts.py

@@ -159,10 +159,16 @@ class AuthenticationForm(forms.Form):
 
 
 class RegistrationForm(forms.ModelForm):
+    name = forms.CharField(
+        label=_('Name'), max_length=30,
+        widget=forms.TextInput(attrs={'placeholder': 'Jane Doe'}),
+        required=True)
     username = forms.EmailField(
         label=_('Email'), max_length=128,
-        widget=forms.TextInput(attrs={'placeholder': 'you@example.com'}))
+        widget=forms.TextInput(attrs={'placeholder': 'you@example.com'}),
+        required=True)
     password = forms.CharField(
+        required=True,
         widget=forms.PasswordInput(attrs={'placeholder': 'something super secret'}))
     subscribe = forms.BooleanField(
         label=_('Subscribe to product updates newsletter'),
@@ -176,7 +182,7 @@ class RegistrationForm(forms.ModelForm):
             del self.fields['subscribe']
 
     class Meta:
-        fields = ('username',)
+        fields = ('username', 'name')
         model = User
 
     def clean_username(self):

+ 2 - 0
tests/sentry/web/frontend/test_auth_login.py

@@ -67,12 +67,14 @@ class AuthLoginTest(TestCase):
             resp = self.client.post(self.path, {
                 'username': 'test-a-really-long-email-address@example.com',
                 'password': 'foobar',
+                'name': 'Foo Bar',
                 'op': 'register',
             })
         assert resp.status_code == 302
         user = User.objects.get(username='test-a-really-long-email-address@example.com')
         assert user.email == 'test-a-really-long-email-address@example.com'
         assert user.check_password('foobar')
+        assert user.name == 'Foo Bar'
 
     def test_register_renders_correct_template(self):
         options.set('auth.allow-registration', True)