Merge branch 'changepassword-fix' of https://github.com/arknu/Umbraco-CMS into arknu-changepassword-fix

This commit is contained in:
Mads Rasmussen
2015-09-30 11:28:52 +02:00
5 changed files with 100 additions and 14 deletions

View File

@@ -269,7 +269,36 @@
display: none;
}
//Change password form in user flyout
//Styling overrides to avoid duplicating property editor code
.umb-panel-body .change-password{
.umb-pane{
margin:0;
}
.control-label{
display: inline-block;
width: 46%;
vertical-align: top;
}
.controls-row{
margin-left:0 !important;
display: inline-block;
width: 47%;
input[type=text],
input[type=password]{
width: 100%;
}
}
.umb-control-group{
padding-bottom: 0;
}
}
// Utility classes

View File

@@ -1,5 +1,5 @@
angular.module("umbraco")
.controller("Umbraco.Dialogs.UserController", function ($scope, $location, $timeout, userService, historyService, eventsService, externalLoginInfo, authResource) {
angular.module("umbraco")
.controller("Umbraco.Dialogs.UserController", function ($scope, $location, $timeout, userService, currentUserResource, historyService, eventsService, externalLoginInfo, authResource) {
$scope.history = historyService.getCurrent();
$scope.version = Umbraco.Sys.ServerVariables.application.version + " assembly: " + Umbraco.Sys.ServerVariables.application.assemblyVersion;
@@ -102,4 +102,44 @@ angular.module("umbraco")
});
//create the initial model for change password property editor
$scope.changePasswordModel = {
alias: "_umb_password",
view: "changepassword",
config: {},
value: {}
};
//go get the config for the membership provider and add it to the model
currentUserResource.getMembershipProviderConfig().then(function (data) {
$scope.changePasswordModel.config = data;
//ensure the hasPassword config option is set to true (the user of course has a password already assigned)
//this will ensure the oldPassword is shown so they can change it
$scope.changePasswordModel.config.hasPassword = true;
$scope.changePasswordModel.config.disableToggle = true;
});
////this is the model we will pass to the service
//$scope.profile = {};
$scope.changePassword = function () {
if (formHelper.submitForm({ scope: $scope })) {
currentUserResource.changePassword($scope.changePasswordModel.value).then(function (data) {
//if the password has been reset, then update our model
if (data.value) {
$scope.changePasswordModel.value.generatedPassword = data.value;
}
formHelper.resetForm({ scope: $scope, notifications: data.notifications });
}, function (err) {
formHelper.handleError(err);
});
}
};
});

View File

@@ -29,8 +29,8 @@
</a>
</p>
</div>
<div class="umb-pane external-logins" ng-if="externalLoginProviders.length > 0">
<div class="umb-pane external-logins" ng-if="externalLoginProviders.length > 0">
<h5>External login providers</h5>
@@ -73,9 +73,31 @@
</li>
</ul>
</div>
<div class="umb-pane change-password">
<h5>Change password</h5>
<p>Enter your current password, then repeat your new password to change it</p>
<form novalidate name="passwordForm"
ng-controller="Umbraco.Dashboard.StartupChangePasswordController"
ng-submit="changePassword()"
val-form-manager>
<umb-pane>
<umb-editor model="changePasswordModel"></umb-editor>
<umb-control-group hidelabel="1">
<button class="btn btn-primary">Change</button>
</umb-control-group>
</umb-pane>
</form>
</div>
</div>
<small class="umb-version">Umbraco version {{version}}</small>
</div>
</div>
</div>

View File

@@ -2410,9 +2410,9 @@ xcopy "$(ProjectDir)"..\packages\SqlServerCE.4.0.0.0\x86\*.* "$(TargetDir)x86\"
<VisualStudio>
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
<WebProjectProperties>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>7300</DevelopmentServerPort>
<UseIIS>True</UseIIS>
<AutoAssignPort>True</AutoAssignPort>
<DevelopmentServerPort>7300</DevelopmentServerPort>
<DevelopmentServerVPath>/</DevelopmentServerVPath>
<IISUrl>http://localhost:7400</IISUrl>
<NTLMAuthentication>False</NTLMAuthentication>

View File

@@ -73,11 +73,6 @@
</control>
</tab>
<tab caption="Change Password">
<control showOnce="false" addPanel="false" panelCaption="">
views/dashboard/ChangePassword.html
</control>
</tab>
</section>
<section alias="StartupMemberDashboardSection">