password reset feedback fixes

This commit is contained in:
vfedosevich 2015-04-29 05:44:09 -07:00
parent afae6c4a6d
commit dde62638b2
18 changed files with 228 additions and 23 deletions

View file

@ -267,15 +267,21 @@ namespace WebsitePanel.WebDavPortal.Controllers
return result;
}
var tokenEntity = WspContext.Services.Organizations.GetPasswordresetAccessToken(token);
var account = WspContext.Services.Organizations.GetUserGeneralSettings(tokenEntity.ItemId,
tokenEntity.AccountId);
var model = new PasswordEditor();
var model = new PasswordResetFinalStepModel();
model.PasswordEditor.Settings = WspContext.Services.Organizations.GetOrganizationPasswordSettings(tokenEntity.ItemId);
model.Login = account.UserPrincipalName;
return View(model);
}
[HttpPost]
[AllowAnonymous]
public ActionResult PasswordResetFinalStep(Guid token, string pincode, PasswordEditor model)
public ActionResult PasswordResetFinalStep(Guid token, string pincode, PasswordResetFinalStepModel model)
{
if (!ModelState.IsValid)
{
@ -293,12 +299,10 @@ namespace WebsitePanel.WebDavPortal.Controllers
WspContext.Services.Organizations.SetUserPassword(
tokenEntity.ItemId, tokenEntity.AccountId,
model.NewPassword);
model.PasswordEditor.NewPassword);
WspContext.Services.Organizations.DeletePasswordresetAccessToken(token);
AddMessage(MessageType.Success, Resources.Messages.PasswordSuccessfullyChanged);
return RedirectToRoute(AccountRouteNames.PasswordResetSuccess);
}

View file

@ -0,0 +1,15 @@
using WebsitePanel.WebDavPortal.Models.Common.EditorTemplates;
namespace WebsitePanel.WebDavPortal.Models.Account
{
public class PasswordResetFinalStepModel
{
public PasswordResetFinalStepModel()
{
PasswordEditor = new PasswordEditor();
}
public string Login { get; set; }
public PasswordEditor PasswordEditor { get; set; }
}
}

View file

@ -654,6 +654,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to Password must meet the following requirements:.
/// </summary>
public static string PasswordFollowingRequirements {
get {
return ResourceManager.GetString("PasswordFollowingRequirements", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Password never expires. If you want to change password then please click {0}..
/// </summary>
@ -915,6 +924,15 @@ namespace WebsitePanel.WebDavPortal.Resources {
}
}
/// <summary>
/// Looks up a localized string similar to You are changing password for &apos;{0}&apos; account..
/// </summary>
public static string YouRChangingPswForFormat {
get {
return ResourceManager.GetString("YouRChangingPswForFormat", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Zip/Postal Code.
/// </summary>

View file

@ -405,4 +405,10 @@
<data name="NewPasswordBeenSet" xml:space="preserve">
<value>Your new password has been set.</value>
</data>
<data name="PasswordFollowingRequirements" xml:space="preserve">
<value>Password must meet the following requirements:</value>
</data>
<data name="YouRChangingPswForFormat" xml:space="preserve">
<value>You are changing password for '{0}' account.</value>
</data>
</root>

View file

@ -1,9 +1,9 @@
@{
@using WebsitePanel.WebDavPortal.Resources
@using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.Account.PasswordResetFinalStepModel
@{
Layout = "~/Views/Shared/_Layout.cshtml";
}
@using WebsitePanel.WebDavPortal.Resources
@using WebsitePanel.WebDavPortal.UI.Routes
@model WebsitePanel.WebDavPortal.Models.Common.EditorTemplates.PasswordEditor
<div class="container row">
@using (Html.BeginRouteForm(AccountRouteNames.PasswordResetFinalStep, FormMethod.Post, new { @class = "form-horizontal user-password-reset-final-step bs-val-styles col-lg-9 col-lg-offset-3", id = "user-password-reset" }))
@ -12,8 +12,14 @@
<div class="form-group">
<h3>@UI.PasswordReset</h3>
</div>
<div class="form-group">
<span>
@string.Format(UI.YouRChangingPswForFormat, Model.Login)
</span>
</div>
@Html.EditorFor(x=>x)
@Html.EditorFor(x => x.PasswordEditor)
<div class="form-group">
<div class="col-sm-offset-2 col-sm-10">
@ -23,5 +29,64 @@
}
</div>
@if (Model.PasswordEditor.Settings != null)
{
<div class="form-group hidden" id="password-hint-popup">
<ul>
<li>
@string.Format(Messages.PasswordMinLengthFormat, Model.PasswordEditor.Settings.MinimumLength)
</li>
<li>
@string.Format(Messages.PasswordMaxLengthFormat, Model.PasswordEditor.Settings.MaximumLength)
</li>
@if (Model.PasswordEditor.Settings.PasswordComplexityEnabled)
{
if (Model.PasswordEditor.Settings.UppercaseLettersCount > 0)
{
<li>
@string.Format(Messages.PasswordUppercaseCountFormat, Model.PasswordEditor.Settings.UppercaseLettersCount)
</li>
}
if (Model.PasswordEditor.Settings.NumbersCount > 0)
{
<li>
@string.Format(Messages.PasswordNumbersCountFormat, Model.PasswordEditor.Settings.NumbersCount)
</li>
}
if (Model.PasswordEditor.Settings.SymbolsCount > 0)
{
<li>
@string.Format(Messages.PasswordSymbolsCountFormat, Model.PasswordEditor.Settings.SymbolsCount)
</li>
}
}
</ul>
</div>
}
@section scripts{
<script>
$(function() {
if ($(document).width() < 800) {
$('.password-input').data('placement', "bottom");
}
$(".password-input").popover({
html: true,
title: '@UI.PasswordFollowingRequirements',
content: function() {
return $('#password-hint-popup').html();
}
})
.blur(function() {
$(this).popover('hide');
});
});
</script>
}

View file

@ -8,7 +8,7 @@
<div class="form-group">
<label for="@Html.IdFor(x => x.NewPassword)" class="col-sm-2 control-label">@UI.NewPassword</label>
<div class="col-sm-10">
@Html.PasswordFor(x => x.NewPassword, new { @class = "form-control", placeholder = UI.NewPassword, maxlength })
@Html.PasswordFor(x => x.NewPassword, new { @class = "form-control password-input", placeholder = UI.NewPassword, maxlength })
@Html.Raw(HttpUtility.HtmlDecode(Html.ValidationMessageFor(m => m.NewPassword).ToHtmlString()))
</div>
</div>
@ -16,7 +16,7 @@
<div class="form-group">
<label for="@Html.IdFor(x => x.NewPasswordConfirmation)" class="col-sm-2 control-label">@UI.NewPasswordConfirmation</label>
<div class="col-sm-10">
@Html.PasswordFor(x => x.NewPasswordConfirmation, new { @class = "form-control", placeholder = UI.NewPasswordConfirmation, maxlength })
@Html.PasswordFor(x => x.NewPasswordConfirmation, new { @class = "form-control" , placeholder = UI.NewPasswordConfirmation, maxlength })
@Html.ValidationMessageFor(x => x.NewPasswordConfirmation)
</div>
</div>

View file

@ -198,6 +198,7 @@
<Compile Include="Models\AccountModel.cs" />
<Compile Include="Models\Account\PasswordChangeModel.cs" />
<Compile Include="Models\Account\PasswordResetEmailModel.cs" />
<Compile Include="Models\Account\PasswordResetFinalStepModel.cs" />
<Compile Include="Models\Account\PasswordResetSmsModel.cs" />
<Compile Include="Models\Account\UserProfile.cs" />
<Compile Include="Models\Common\AjaxModel.cs" />
@ -510,6 +511,7 @@
<EmbeddedResource Include="Resources\Messages.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<LastGenOutput>Messages.Designer.cs</LastGenOutput>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Resources\UI.resx">
<Generator>PublicResXFileCodeGenerator</Generator>