diff --git a/wagtail/wagtailadmin/forms.py b/wagtail/wagtailadmin/forms.py
index 9073e57c1e..1cb6a159f5 100644
--- a/wagtail/wagtailadmin/forms.py
+++ b/wagtail/wagtailadmin/forms.py
@@ -1,5 +1,6 @@
from django import forms
-from django.contrib.auth.forms import AuthenticationForm
+from django.contrib.auth import get_user_model
+from django.contrib.auth.forms import AuthenticationForm, PasswordResetForm
class SearchForm(forms.Form):
q = forms.CharField(label="Search term")
@@ -28,3 +29,30 @@ class LoginForm(AuthenticationForm):
password = forms.CharField(
widget=forms.PasswordInput(attrs={'placeholder': "Enter password"}),
)
+
+
+class PasswordResetForm(PasswordResetForm):
+ def clean(self):
+ cleaned_data = super(PasswordResetForm, self).clean()
+
+ # Find users of this email address
+ UserModel = get_user_model()
+ email = cleaned_data['email']
+ active_users = UserModel._default_manager.filter(email__iexact=email, is_active=True)
+
+ if active_users.exists():
+ # Check if all users of the email address are LDAP users (and give an error if they are)
+ found_non_ldap_user = False
+ for user in active_users:
+ if user.has_usable_password():
+ found_non_ldap_user = True
+ break
+
+ if not found_non_ldap_user:
+ # All found users are LDAP users, give error message
+ raise forms.ValidationError("Sorry, you cannot reset your password here as your user account is managed by another server.")
+ else:
+ # No user accounts exist
+ raise forms.ValidationError("This email address is not recognised.")
+
+ return cleaned_data
\ No newline at end of file
diff --git a/wagtail/wagtailadmin/static/wagtailadmin/css/layouts/login.less b/wagtail/wagtailadmin/static/wagtailadmin/css/layouts/login.less
index aac755ee42..298664a0c5 100644
--- a/wagtail/wagtailadmin/static/wagtailadmin/css/layouts/login.less
+++ b/wagtail/wagtailadmin/static/wagtailadmin/css/layouts/login.less
@@ -7,11 +7,12 @@ html{
height:100%;
}
body{
- margin-left: 0px;
+ padding:0 5%;
height:100%;
+ color:white;
+ margin:0;
}
h1{
- .nice-padding();
font-weight:300;
font-size:2em;
line-height:1em;
@@ -30,24 +31,68 @@ h1{
vertical-align: -15%;
}
}
-form{
+.content-wrapper{
width:100%;
- ul{
- .unlist();
+ float:none;
+ background:none;
+ border:0;
+}
+.fields{
+ .unlist();
+
+ li.full{
+ overflow:hidden;
+ position:relative;
+ padding:0;
+ margin-bottom:1px;
+
+ label{
+ display:none;
+ }
+ input{
+ border:0;
+ }
+
+ label{
+ .border-radius(2px);
+ text-transform:uppercase;
+ padding:2px 5px;
+ position:absolute;
+ top:0;
+ left:0;
+ margin-top:-1px;
+ font-size:0.7em;
+ z-index:1;
+ margin:0.2em 0;
+ line-height:1.5em;
+ font-weight:normal;
+ }
+ input{
+ .border-radius(0px);
+ font-weight:300;
+ border:0;
+ padding-top:1.5em;
+ padding-bottom:1.5em;
+ font-size:1.6em;
+ line-height:1.6em;
+ }
}
- .fields li{
- .nice-padding();
- padding-top:1em;
- padding-bottom:1em;
+ li:first-child input{
+ border-top:0;
}
- .fields .checkbox{
+ .checkbox{
padding-top:2em;
padding-bottom:2em;
}
+ .field{
+ padding:0;
+ }
+
+ .field.icon:before{
+ display:none;
+ }
}
-label{
- color:white;
-}
+
input[type=submit]{
font-size:1.5em;
padding:1.1em 2.4em;
@@ -57,55 +102,7 @@ input[type=checkbox]:before{
color:#555;
border:1px solid #555;
}
-.fields li.full{
- position:relative;
- padding:0;
-
- label{
- display:none;
- }
- input{
- border-top: 1px dashed @color-input-border;
- }
-}
-.fields li:first-child input{
- border-top:0;
-}
-.field{
- padding:0;
-}
-.field.icon:before{
- display:none;
-}
-
-
-.full label{
- .border-radius(2px);
- text-transform:uppercase;
- padding:2px 5px;
- position:absolute;
- top:0;
- left:0;
- margin-top:-1px;
- font-size:0.7em;
- z-index:1;
- margin:0.2em 0;
- line-height:1.5em;
- font-weight:normal;
-}
-
-/* Special full-width, one-off fields i.e a single text or textarea input */
-.full input{
- .nice-padding;
- .border-radius(0px);
- font-weight:300;
- border:0;
- padding-top:1.5em;
- padding-bottom:1.5em;
- font-size:1.6em;
- line-height:1.6em;
-}
.help{
opacity:1;
position:absolute;
@@ -118,6 +115,7 @@ input[type=checkbox]:before{
@media screen and (min-width: @breakpoint-mobile){
body{
font-size:85%;
+ padding:0 10%;
}
/* centres login form vertically */
@@ -132,44 +130,43 @@ input[type=checkbox]:before{
margin-left:-4px;
}
}
- form{
+ .content-wrapper{
width:100%;
display:inline-block;
vertical-align: middle;
-
- .fields li{
- padding-left:10%;
- }
}
h1{
- padding-left:10%;
font-weight:300;
font-size:4em;
line-height:1em;
}
- .full input{
- padding-left:10%;
- }
- .field.icon:before{
- display:inline-block;
- position: absolute;
- color:@color-grey-4;
- border: 2px solid @color-grey-4;
- border-radius: 100%;
- width: 1em;
- padding: 0.3em;
- left: 12%;
- margin-left: 80px;
- margin-left: -25px;
- top: 50%;
- margin-top: -25px;
- }
- .full input{
- padding-left:15%;
+ .fields{
+ .field.icon:before{
+ display:inline-block;
+ position: absolute;
+ color:@color-grey-4;
+ border: 2px solid @color-grey-4;
+ border-radius: 100%;
+ width: 1em;
+ padding: 0.3em;
+ left: 12%;
+ margin-left: -25px;
+ margin-top: -25px;
+ top: 50%;
+ }
+ .full{
+ margin:0 -13%;
+ }
+ .full input{
+ padding-left:15%;
+ }
+ .submit{
+ margin-top:2em;
+ }
}
- .messages li{
- padding-left:11%;
+ .messages{
+ margin:0 -13%
}
}
\ No newline at end of file
diff --git a/wagtail/wagtailadmin/templates/wagtailadmin/account/account.html b/wagtail/wagtailadmin/templates/wagtailadmin/account/account.html
new file mode 100644
index 0000000000..92fb8f585e
--- /dev/null
+++ b/wagtail/wagtailadmin/templates/wagtailadmin/account/account.html
@@ -0,0 +1,31 @@
+{% extends "wagtailadmin/base.html" %}
+
+{% block content %}
+ Account
+
Your password can't be changed here. Please contact a site administrator.
+ {% endif %} +A link to reset your password has been emailed to you.
+