kopia lustrzana https://github.com/wagtail/wagtail
				
				
				
			Add invalid password reset link error message
							rodzic
							
								
									8741491313
								
							
						
					
					
						commit
						84a2a45d49
					
				| 
						 | 
				
			
			@ -39,6 +39,7 @@ Changelog
 | 
			
		|||
 * Fix: Draftail editor no longer crashes after deleting image/embed using DEL key (Thibaud Colas)
 | 
			
		||||
 * Fix: Breadcrumb navigation now respects custom `get_admin_display_title` methods (Arthur Holzner, Wietze Helmantel, Matt Westcott)
 | 
			
		||||
 * Fix: Inconsistent order of heading features when adding h1, h5 or h6 as default feature for Hallo RichText editor (Loic Teixeira)
 | 
			
		||||
 * Fix: Add invalid password reset link error message (Coen van der Kamp)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
2.0.1 (04.04.2018)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -54,7 +54,9 @@ label {
 | 
			
		|||
    color: $color-white;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
.button {
 | 
			
		||||
.button,
 | 
			
		||||
a.button {
 | 
			
		||||
    line-height: 1.2em;
 | 
			
		||||
    font-size: 1.5em;
 | 
			
		||||
    padding: 1.1em 2.4em;
 | 
			
		||||
    height: 3.5em;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -15,7 +15,7 @@
 | 
			
		|||
                        {% include "wagtailadmin/shared/field_as_li.html" with field=field %}
 | 
			
		||||
                    {% endfor %}
 | 
			
		||||
                </ul>
 | 
			
		||||
                <input type="submit" value="{% trans 'Change password' %}" class="button" />
 | 
			
		||||
                <button type="submit" class="button">{% trans 'Change password' %}</button>
 | 
			
		||||
            </form>
 | 
			
		||||
        {% else %}
 | 
			
		||||
            <p>{% trans "Your password can't be changed here. Please contact a site administrator." %}</p>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,6 +1,12 @@
 | 
			
		|||
{% extends "wagtailadmin/admin_base.html" %}
 | 
			
		||||
{% load staticfiles i18n %}
 | 
			
		||||
{% block titletag %}{% trans "Set your new password" %}{% endblock %}
 | 
			
		||||
{% block titletag %}
 | 
			
		||||
    {% if validlink %}
 | 
			
		||||
        {% trans "Set your new password" %}
 | 
			
		||||
    {% else %}
 | 
			
		||||
        {% trans "Invalid password reset link" %}
 | 
			
		||||
    {% endif %}
 | 
			
		||||
{% endblock %}
 | 
			
		||||
{% block bodyclass %}login{% endblock %}
 | 
			
		||||
 | 
			
		||||
{% block extra_css %}
 | 
			
		||||
| 
						 | 
				
			
			@ -11,7 +17,7 @@
 | 
			
		|||
 | 
			
		||||
{% block furniture %}
 | 
			
		||||
    <div class="content-wrapper">
 | 
			
		||||
 | 
			
		||||
    {% if validlink %}
 | 
			
		||||
        <form method="post" novalidate>
 | 
			
		||||
            {% csrf_token %}
 | 
			
		||||
            <h1>{% trans "Set your new password" %}</h1>
 | 
			
		||||
| 
						 | 
				
			
			@ -46,9 +52,21 @@
 | 
			
		|||
                    </div>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li class="submit">
 | 
			
		||||
                    <input type="submit" value="{% trans 'Reset password' %}" class="button" />
 | 
			
		||||
                    <button type="submit" class="button">{% trans 'Reset password' %}</button>
 | 
			
		||||
                </li>
 | 
			
		||||
            </ul>
 | 
			
		||||
        </form>
 | 
			
		||||
    {% else %}
 | 
			
		||||
        <h1>{% trans "Invalid password reset link" %}</h1>
 | 
			
		||||
        <div class="messages">
 | 
			
		||||
            <ul>
 | 
			
		||||
                <li class="error">
 | 
			
		||||
                    {% trans "The password reset link was invalid, possibly because it has already been used." %}
 | 
			
		||||
                </li>
 | 
			
		||||
            </ul>
 | 
			
		||||
        </div>
 | 
			
		||||
        <a href="{% url 'wagtailadmin_password_reset' %}" class="button">{% trans 'Request a new password reset' %}</a>
 | 
			
		||||
    {% endif %}
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
{% endblock %}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -40,7 +40,7 @@
 | 
			
		|||
                    </div>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li class="submit">
 | 
			
		||||
                    <input type="submit" value="{% trans 'Reset password' %}" class="button" />
 | 
			
		||||
                    <button type="submit" class="button">{% trans 'Reset password' %}</button>
 | 
			
		||||
                </li>
 | 
			
		||||
            </ul>
 | 
			
		||||
        </form>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -557,6 +557,25 @@ class TestPasswordReset(TestCase, WagtailTestUtils):
 | 
			
		|||
        # Create url_args
 | 
			
		||||
        self.url_kwargs = dict(uidb64=self.password_reset_uid, token=self.password_reset_token)
 | 
			
		||||
 | 
			
		||||
    def test_password_reset_confirm_view_invalid_link(self):
 | 
			
		||||
        """
 | 
			
		||||
        This tests that the password reset view shows an error message if the link is invalid
 | 
			
		||||
        """
 | 
			
		||||
        self.setup_password_reset_confirm_tests()
 | 
			
		||||
 | 
			
		||||
        # Create invalid url_args
 | 
			
		||||
        self.url_kwargs = dict(uidb64=self.password_reset_uid, token="invalid-token")
 | 
			
		||||
 | 
			
		||||
        # Get password reset confirm page
 | 
			
		||||
        response = self.client.get(reverse('wagtailadmin_password_reset_confirm', kwargs=self.url_kwargs))
 | 
			
		||||
 | 
			
		||||
        # Check that the user received a password confirm done page
 | 
			
		||||
        self.assertEqual(response.status_code, 200)
 | 
			
		||||
        self.assertTemplateUsed(response, 'wagtailadmin/account/password_reset/confirm.html')
 | 
			
		||||
        self.assertFalse(response.context['validlink'])
 | 
			
		||||
        self.assertContains(response, 'The password reset link was invalid, possibly because it has already been used.')
 | 
			
		||||
        self.assertContains(response, 'Request a new password reset')
 | 
			
		||||
 | 
			
		||||
    def test_password_reset_confirm_view(self):
 | 
			
		||||
        """
 | 
			
		||||
        This tests that the password reset confirm view returns a password reset confirm page
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Ładowanie…
	
		Reference in New Issue