Merge branch '7.0.0' of https://github.com/umbraco/Umbraco-CMS into 7.0.0
This commit is contained in:
@@ -221,12 +221,7 @@ function umbDataFormatter() {
|
||||
});
|
||||
saveModel.email = propEmail.value;
|
||||
saveModel.username = propLogin.value;
|
||||
//NOTE: This would only be set for new members!
|
||||
if (angular.isString(propPass.value)) {
|
||||
// if we are resetting or changing passwords then that data will come from the property editor and
|
||||
// it's value will be an object not just a string.
|
||||
saveModel.password = propPass.value;
|
||||
}
|
||||
saveModel.password = propPass.value;
|
||||
|
||||
return saveModel;
|
||||
},
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
</umb-property>
|
||||
</div>
|
||||
</umb-tab>
|
||||
|
||||
</umb-tab-view>
|
||||
</umb-panel>
|
||||
</form>
|
||||
@@ -6,29 +6,44 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.ChangePasswordCont
|
||||
//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.requiresQuestionAnswer) {
|
||||
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) {
|
||||
if (!$scope.model.config || $scope.model.config.enableReset === undefined) {
|
||||
$scope.model.config.enableReset = true;
|
||||
}
|
||||
if (!$scope.model.config || !$scope.model.config.minPasswordLength) {
|
||||
$scope.model.config.minPasswordLength = 7;
|
||||
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 = "";
|
||||
|
||||
$scope.hasPassword = $scope.model.value !== undefined && $scope.model.value !== null && $scope.model.value !== "";
|
||||
|
||||
$scope.changing = !$scope.hasPassword;
|
||||
//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.
|
||||
$scope.changing = !$scope.model.config.hasPassword;
|
||||
|
||||
$scope.doChange = function() {
|
||||
$scope.changing = true;
|
||||
|
||||
@@ -1,33 +1,58 @@
|
||||
<div ng-controller="Umbraco.PropertyEditors.ChangePasswordController" ng-switch="changing">
|
||||
<div ng-switch-when="false">
|
||||
<!--<a href="" ng-click="doChange()">Change password</a> -->
|
||||
<div class="control-group warning">
|
||||
<span class="help-block">Password changing or resetting is currently not supported</span>
|
||||
</div>
|
||||
<a href="" ng-click="doChange()">Change password</a>
|
||||
</div>
|
||||
<div ng-switch-when="true">
|
||||
<div class="control-group">
|
||||
|
||||
<input type="text" name="password" ng-model="model.value" id="{{model.alias}}"
|
||||
class="umb-editor umb-textstring textstring"
|
||||
required
|
||||
val-server
|
||||
ng-minlength="{{model.config.minPasswordLength}}" />
|
||||
|
||||
<span class="help-inline" val-msg-for="password" val-toggle-msg="required">Required</span>
|
||||
<span class="help-inline" val-msg-for="password" val-toggle-msg="minlength">Minimum {{model.config.minPasswordLength}} characters</span>
|
||||
<span class="help-inline" val-msg-for="password" val-toggle-msg="valServer"></span>
|
||||
|
||||
|
||||
<div class="control-group" >
|
||||
<label class="control-label" for="resetPassword">Reset password?</label>
|
||||
<div class="controls">
|
||||
<input type="checkbox" ng-model="model.value.reset"
|
||||
id="resetPassword"
|
||||
name="resetPassword"
|
||||
val-server="resetPassword"/>
|
||||
<span class="help-inline" val-msg-for="resetPassword" val-toggle-msg="valServer"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- we need to show the old pass field when the provider cannot retreive the password -->
|
||||
<div class="control-group" ng-show="model.config.hasPassword && !model.config.enablePasswordRetrieval && !model.value.reset">
|
||||
<label class="control-label" for="password">Old password</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="oldPassword" ng-model="model.value.oldPassword"
|
||||
class="input-large umb-textstring textstring"
|
||||
ng-required="!model.value.reset && model.config.hasPassword && !model.config.enablePasswordRetrieval"
|
||||
val-server="oldPassword" />
|
||||
<span class="help-inline" val-msg-for="oldPassword" val-toggle-msg="required">Required</span>
|
||||
<span class="help-inline" val-msg-for="oldPassword" val-toggle-msg="valServer"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
||||
<input type="text" name="confirmpassword" ng-model="model.confirm" id="{{model.alias}}"
|
||||
class="umb-editor umb-textstring textstring"
|
||||
val-compare="password" />
|
||||
|
||||
<span class="help-inline" val-msg-for="confirmpassword" val-toggle-msg="valCompare">Passwords must match</span>
|
||||
<div class="control-group" ng-show="!model.value.reset">
|
||||
<label class="control-label" for="password">New password</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="password" ng-model="model.value.newPassword"
|
||||
class="input-large umb-textstring textstring"
|
||||
ng-required="!model.value.reset"
|
||||
val-server="value"
|
||||
ng-minlength="{{model.config.minPasswordLength}}" />
|
||||
<span class="help-inline" val-msg-for="password" val-toggle-msg="required">Required</span>
|
||||
<span class="help-inline" val-msg-for="password" val-toggle-msg="minlength">Minimum {{model.config.minPasswordLength}} characters</span>
|
||||
<span class="help-inline" val-msg-for="password" val-toggle-msg="valServer"></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="control-group" ng-show="!model.value.reset">
|
||||
<label class="control-label" for="password">Confirm password</label>
|
||||
<div class="controls">
|
||||
<input type="text" name="confirmpassword" ng-model="model.confirm"
|
||||
class="input-large umb-textstring textstring"
|
||||
val-compare="password" />
|
||||
|
||||
<span class="help-inline" val-msg-for="confirmpassword" val-toggle-msg="valCompare">Passwords must match</span>
|
||||
</div>
|
||||
</div>
|
||||
<!--<a href="" ng-click="cancelChange()" ng-show="hasPassword">Cancel</a> -->
|
||||
|
||||
<a href="" ng-click="cancelChange()" ng-show="model.config.hasPassword">Cancel</a>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user