Got more member reset password working based on the provider config.

This commit is contained in:
Shannon
2013-10-11 11:44:48 +11:00
parent bc828176d1
commit b63135771e
5 changed files with 78 additions and 43 deletions

View File

@@ -155,3 +155,27 @@ h1.headline{height: 40px; padding: 30px 0 0 20px;}
}
// Utility classes
//SD: Had to add these because if we want to use the bootstrap text colors
// in a panel/editor they'll all show up as white on white - so we need to use the
// form styles
.umb-panel .muted { color: @grayLight; }
.umb-panel a.muted:hover,
.umb-panel a.muted:focus { color: darken(@grayLight, 10%); }
.umb-panel .text-warning { color: @formWarningText; }
.umb-panel a.text-warning:hover,
.umb-panel a.text-warning:focus { color: darken(@formWarningText, 10%); }
.umb-panel .text-error { color: @formErrorText; }
.umb-panel a.text-error:hover,
.umb-panel a.text-error:focus { color: darken(@formErrorText, 10%); }
.umb-panel .text-info { color: @formInfoText; }
.umb-panel a.text-info:hover,
.umb-panel a.text-info:focus { color: darken(@formInfoText, 10%); }
.umb-panel .text-success { color: @formSuccessText; }
.umb-panel a.text-success:hover,
.umb-panel a.text-success:focus { color: darken(@formSuccessText, 10%); }

View File

@@ -1,45 +1,50 @@
angular.module("umbraco").controller("Umbraco.PropertyEditors.ChangePasswordController",
function($scope) {
//the model config will contain an object, if it does not we'll create defaults
//NOTE: We will not support doing the password regex on the client side because the regex on the server side
//based on the membership provider cannot always be ported to js from .net directly.
/*
{
hasPassword: true/false,
requiresQuestionAnswer: true/false,
enableReset: true/false,
enablePasswordRetrieval: true/false,
minPasswordLength: 10
}
*/
function resetModel() {
//the model config will contain an object, if it does not we'll create defaults
//NOTE: We will not support doing the password regex on the client side because the regex on the server side
//based on the membership provider cannot always be ported to js from .net directly.
/*
{
hasPassword: true/false,
requiresQuestionAnswer: true/false,
enableReset: true/false,
enablePasswordRetrieval: true/false,
minPasswordLength: 10
}
*/
//set defaults if they are not available
if (!$scope.model.config || $scope.model.config.hasPassword === undefined) {
$scope.model.config.hasPassword = false;
//set defaults if they are not available
if (!$scope.model.config || $scope.model.config.hasPassword === undefined) {
$scope.model.config.hasPassword = false;
}
if (!$scope.model.config || $scope.model.config.enablePasswordRetrieval === undefined) {
$scope.model.config.enablePasswordRetrieval = true;
}
if (!$scope.model.config || $scope.model.config.requiresQuestionAnswer === undefined) {
$scope.model.config.requiresQuestionAnswer = false;
}
if (!$scope.model.config || $scope.model.config.enableReset === undefined) {
$scope.model.config.enableReset = true;
}
if (!$scope.model.config || $scope.model.config.minPasswordLength === undefined) {
$scope.model.config.minPasswordLength = 0;
}
//set the model defaults - we never get supplied a password from the server so this is ok to overwrite.
$scope.model.value = {
newPassword: "",
oldPassword: null,
reset: null,
answer: null
};
//the value to compare to match passwords
$scope.model.confirm = "";
}
if (!$scope.model.config || $scope.model.config.enablePasswordRetrieval === undefined) {
$scope.model.config.enablePasswordRetrieval = true;
}
if (!$scope.model.config || $scope.model.config.requiresQuestionAnswer === undefined) {
$scope.model.config.requiresQuestionAnswer = false;
}
if (!$scope.model.config || $scope.model.config.enableReset === undefined) {
$scope.model.config.enableReset = true;
}
if (!$scope.model.config || $scope.model.config.minPasswordLength === undefined) {
$scope.model.config.minPasswordLength = 0;
}
//set the model defaults - we never get supplied a password from the server so this is ok to overwrite.
$scope.model.value = {
newPassword: "",
oldPassword: null,
reset: null,
answer: null
};
//the value to compare to match passwords
$scope.confirm = "";
resetModel();
//if there is no password saved for this entity , it must be new so we do not allow toggling of the change password, it is always there
//with validators turned on.
@@ -52,4 +57,11 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.ChangePasswordCont
$scope.cancelChange = function() {
$scope.changing = false;
};
//listen for the saved event, when that occurs we'll
//change to changing = false;
$scope.$on("saved", function() {
$scope.changing = false;
resetModel();
});
});

View File

@@ -1,10 +1,10 @@
<div ng-controller="Umbraco.PropertyEditors.ChangePasswordController" ng-switch="changing">
<div ng-switch-when="false">
<a href="" ng-click="doChange()">Change password</a>
<a href="" ng-click="doChange()" class="text-info">Change password</a>
</div>
<div ng-switch-when="true">
<div class="control-group" >
<div class="control-group" ng-show="model.config.hasPassword && model.config.enableReset" >
<label class="control-label" for="resetPassword">Reset password?</label>
<div class="controls">
<input type="checkbox" ng-model="model.value.reset"
@@ -53,6 +53,6 @@
</div>
</div>
<a href="" ng-click="cancelChange()" ng-show="model.config.hasPassword">Cancel</a>
<a href="" ng-click="cancelChange()" ng-show="model.config.hasPassword" class="text-warning">Cancel</a>
</div>
</div>

View File

@@ -208,6 +208,8 @@ namespace Umbraco.Web.Editors
///
/// TODO: We need to update this method to return the new password if it has been reset and then show that to the UI!
///
/// TODO We should move this logic to a central helper class so we can re-use it when it comes to integrating with WebSecurity
///
/// </remarks>
private void UpdateWithMembershipProvider(MemberSave contentItem)
{

View File

@@ -175,7 +175,4 @@ Global
{73529637-28F5-419C-A6BB-D094E39DE614} = {DD32977B-EF54-475B-9A1B-B97A502C6E58}
{B555AAE6-0F56-442F-AC9F-EF497DB38DE7} = {DD32977B-EF54-475B-9A1B-B97A502C6E58}
EndGlobalSection
GlobalSection(Performance) = preSolution
HasPerformanceSessions = true
EndGlobalSection
EndGlobal