Index: Controllers/AccountController.cs
===================================================================
--- Controllers/AccountController.cs (revision 24358)
+++ Controllers/AccountController.cs (working copy)
@@ -162,23 +162,27 @@
var owner = _currentSite.Owner;
if(userUpdate.NewEmail != userUpdate.NewEmailConfirm || userUpdate.NewPassword != userUpdate.NewPasswordConfirm) {
this.SetMessage(MessageType.Error, "The email or password confirmation did not match.");
- return RedirectToAction("UserInformation");
+ return View(userUpdate);
}
if(!string.IsNullOrEmpty(userUpdate.NewPassword) && userUpdate.NewPassword.Count() < MIN_PASSWORD_LENGTH) {
this.SetMessage(MessageType.Error, String.Format("Your new password must be at least {0} characters.", MIN_PASSWORD_LENGTH));
- return RedirectToAction("UserInformation");
+ return View(userUpdate);
}
// authorized to change
if(_authBL.ValidateCredentials(owner.Email, userUpdate.CurrentPassword) == AuthInfo.Empty) {
this.SetMessage(MessageType.Error, "Your current password is not correct.");
- return RedirectToAction("UserInformation");
+ return View(userUpdate);
}
// update email
- if(userUpdate.NewEmail.ToLower() != owner.Email.ToLower()) {
+ var newEmail = userUpdate.NewEmail.Trim();
+ if(newEmail.CompareInvariantIgnoreCase(owner.Email) != 0) {
+ if (!_userBL.IsEmailAvailable(newEmail)) {
+ ModelState.AddModelError("NewEmail", "This email address is already registered.");
+ return View(userUpdate);
+ }
var oldEmail = owner.Email;
- owner.Email = userUpdate.NewEmail.Trim();
_userBL.Update(owner);
// send email to new and old addresses
Index: Views/Account/UserInformation.aspx
===================================================================
--- Views/Account/UserInformation.aspx (revision 24358)
+++ Views/Account/UserInformation.aspx (working copy)
@@ -32,30 +32,35 @@
<label for="CurrentPassword">Current Password</label>
<div class="input-wrap">
<%= Html.PasswordFor(m => m.CurrentPassword, new { @class = "required" })%>
+ <%= Html.ValidationMessage("CurrentPassword")%>
</div>
</div>
<div class="field">
<label for="NewPassword">New Password (if changing)</label>
<div class="input-wrap">
<%= Html.PasswordFor(m => m.NewPassword) %>
+ <%= Html.ValidationMessage("NewPassword")%>
</div>
</div>
<div class="field">
<label for="NewPasswordConfirm">New Password Confirm</label>
<div class="input-wrap">
<%= Html.PasswordFor(m => m.NewPasswordConfirm)%>
+ <%= Html.ValidationMessage("NewPasswordConfirm")%>
</div>
</div>
<div class="field">
<label for="NewEmail">Email Address</label>
<div class="input-wrap">
<%= Html.TextBoxFor(m => m.NewEmail, new { @class = "required" })%>
+ <%= Html.ValidationMessage("NewEmail")%>
</div>
</div>
<div class="field">
<label for="NewEmailConfirm">Email Address Confirm</label>
<div class="input-wrap">
<%= Html.TextBoxFor(m => m.NewEmailConfirm, new { @class = "required" })%>
+ <%= Html.ValidationMessage("NewEmailConfirm")%>
</div>
</div>
</div>
| Images 0 | ||
|---|---|---|
| No images to display in the gallery. |
Copyright © 2011 MindTouch, Inc. Powered by