Browse Source

Improve the handling of unknown email addresses in the Sign In form

pull/514/head
Pēteris Caune 4 years ago
parent
commit
e090aa5403
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
4 changed files with 13 additions and 27 deletions
  1. +1
    -0
      CHANGELOG.md
  2. +1
    -1
      hc/accounts/forms.py
  3. +0
    -15
      static/css/login.css
  4. +11
    -11
      templates/accounts/login.html

+ 1
- 0
CHANGELOG.md View File

@ -6,6 +6,7 @@ All notable changes to this project will be documented in this file.
### Improvements ### Improvements
- Increase "Success / Failure Keywords" field lengths to 200 - Increase "Success / Failure Keywords" field lengths to 200
- Django 3.2.2 - Django 3.2.2
- Improve the handling of unknown email addresses in the Sign In form
## v1.20.0 - 2020-04-22 ## v1.20.0 - 2020-04-22


+ 1
- 1
hc/accounts/forms.py View File

@ -59,7 +59,7 @@ class EmailLoginForm(forms.Form):
try: try:
self.user = User.objects.get(email=v) self.user = User.objects.get(email=v)
except User.DoesNotExist: except User.DoesNotExist:
raise forms.ValidationError("Incorrect email address.")
raise forms.ValidationError("Unknown email address.")
return v return v


+ 0
- 15
static/css/login.css View File

@ -73,21 +73,6 @@
background: #fff; background: #fff;
} }
#login-signup-cta {
font-size: 18px;
color: #999;
margin-top: 40px;
}
#login-signup-cta a {
color: #999;
text-decoration: underline;
}
#login-signup-cta a:hover {
color: #0091EA;
}
#login-password { #login-password {
margin-bottom: 0; margin-bottom: 0;
} }


+ 11
- 11
templates/accounts/login.html View File

@ -27,7 +27,17 @@
{% csrf_token %} {% csrf_token %}
{% if magic_form.identity.errors %} {% if magic_form.identity.errors %}
<p class="text-danger">{{ magic_form.identity.errors|join:"" }}</p>
<p class="text-danger">
{% for e in magic_form.identity.errors %}
{{ e }}
{% if e == "Unknown email address." and registration_open %}
<a
href="#"
data-toggle="modal"
data-target="#signup-modal">Create Account?</a>
{% endif %}
{% endfor %}
</p>
{% else %} {% else %}
<p>Enter your <strong>email address</strong>.</p> <p>Enter your <strong>email address</strong>.</p>
{% endif %} {% endif %}
@ -97,16 +107,6 @@
</form> </form>
</div> </div>
</div> </div>
{% if registration_open %}
<div class="row">
<div id="login-signup-cta" class="col-sm-12 text-center">
Don't have an account?
<a href="#" data-toggle="modal" data-target="#signup-modal">Sign Up</a>
</div>
</div>
{% endif %}
</div> </div>
</div> </div>


Loading…
Cancel
Save