U4-5523: move change password to it's own part of user fly out to minimize visual clutter, use new 7.4 buttons + remove functionality from dashboard files.

This commit is contained in:
Mads Rasmussen
2015-09-30 12:16:30 +02:00
parent c604f3591f
commit df76554aaf
7 changed files with 91 additions and 147 deletions

View File

@@ -152,6 +152,11 @@ h5{
display: inline-block
}
.block-form .controls-row {
margin-left: 0;
padding-top: 0;
}
.hidelabel > div > .controls-row, .hidelabel > .controls-row, .hidelabel .controls {
padding: 0px;
border: none;

View File

@@ -269,38 +269,6 @@
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
//SD: Had to add these because if we want to use the bootstrap text colors

View File

@@ -1,8 +1,10 @@
angular.module("umbraco")
.controller("Umbraco.Dialogs.UserController", function ($scope, $location, $timeout, userService, currentUserResource, historyService, eventsService, externalLoginInfo, authResource) {
.controller("Umbraco.Dialogs.UserController", function ($scope, $location, $timeout, userService, historyService, eventsService, externalLoginInfo, authResource, currentUserResource, formHelper) {
$scope.history = historyService.getCurrent();
$scope.version = Umbraco.Sys.ServerVariables.application.version + " assembly: " + Umbraco.Sys.ServerVariables.application.assemblyVersion;
$scope.showPasswordFields = false;
$scope.changePasswordButtonState = "init";
$scope.externalLoginProviders = externalLoginInfo.providers;
$scope.externalLinkLoginFormAction = Umbraco.Sys.ServerVariables.umbracoUrls.externalLinkLoginsUrl;
@@ -47,7 +49,7 @@ angular.module("umbraco")
updateTimeout();
}
}, 1000, false); // 1 second, do NOT execute a global digest
}, 1000, false); // 1 second, do NOT execute a global digest
}
function updateUserInfo() {
@@ -102,30 +104,34 @@ angular.module("umbraco")
});
/* ---------- UPDATE PASSWORD ---------- */
//create the initial model for change password property editor
$scope.changePasswordModel = {
alias: "_umb_password",
view: "changepassword",
config: {},
value: {}
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;
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
// disable reset password functionality beacuse it does not make sense inside the backoffice
$scope.changePasswordModel.config.hasPassword = true;
$scope.changePasswordModel.config.disableToggle = true;
$scope.changePasswordModel.config.enableReset = false;
});
////this is the model we will pass to the service
//$scope.profile = {};
$scope.changePassword = function() {
$scope.changePassword = function () {
if (formHelper.submitForm({ scope: $scope })) {
if (formHelper.submitForm({ scope: $scope })) {
currentUserResource.changePassword($scope.changePasswordModel.value).then(function (data) {
$scope.changePasswordButtonState = "busy";
currentUserResource.changePassword($scope.changePasswordModel.value).then(function(data) {
//if the password has been reset, then update our model
if (data.value) {
@@ -134,12 +140,28 @@ angular.module("umbraco")
formHelper.resetForm({ scope: $scope, notifications: data.notifications });
$scope.changePasswordButtonState = "success";
}, function (err) {
formHelper.handleError(err);
$scope.changePasswordButtonState = "error";
});
}
};
});
$scope.togglePasswordFields = function() {
clearPasswordFields();
$scope.showPasswordFields = !$scope.showPasswordFields;
}
function clearPasswordFields() {
$scope.changePasswordModel.value.newPassword = "";
$scope.changePasswordModel.confirm = "";
}
});

View File

@@ -19,18 +19,27 @@
<div class="umb-panel-body umb-scrollable">
<div class="tab-content umb-control-group">
<div class="umb-pane" ng-if="canEditProfile">
<h5><localize key="user_yourProfile" /></h5>
<p>
<a href="#/users/framed/%252Fumbraco%252Fusers%252Fedituser.aspx%253Fid%253D{{user.id}}"
class="btn btn-primary"
ng-click="close()">
<localize key="general_edit">Edit</localize>
</a>
</p>
<div class="umb-pane" ng-if="!showPasswordFields">
<h5><localize key="user_yourProfile" /></h5>
<a href="#/users/framed/%252Fumbraco%252Fusers%252Fedituser.aspx%253Fid%253D{{user.id}}"
class="btn btn-primary"
ng-click="close()"
ng-if="canEditProfile">
<localize key="general_edit">Edit</localize>
</a>
<umb-button
type="button"
action="togglePasswordFields()"
label="Change password"
button-style="success">
</umb-button>
</div>
<div class="umb-pane external-logins" ng-if="externalLoginProviders.length > 0">
<div class="umb-pane external-logins" ng-if="externalLoginProviders.length > 0 && !showPasswordFields">
<h5>External login providers</h5>
@@ -63,7 +72,7 @@
</div>
<div class="umb-pane">
<div class="umb-pane" ng-if="!showPasswordFields">
<h5><localize key="user_yourHistory" /></h5>
<ul class="umb-tree">
<li ng-repeat="item in history | orderBy:'time':true">
@@ -74,30 +83,37 @@
</ul>
</div>
<div class="umb-pane change-password">
<h5>Change password</h5>
<div class="umb-pane" ng-show="showPasswordFields">
<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>
<h5>Change password</h5>
<form
name="passwordForm"
class="block-form"
ng-submit="changePassword()"
novalidate
val-form-manager>
<umb-pane>
<umb-editor model="changePasswordModel"></umb-editor>
<umb-editor model="changePasswordModel"></umb-editor>
<umb-button
type="button"
action="togglePasswordFields()"
label="Back"
button-style="Cancel">
</umb-button>
<umb-control-group hidelabel="1">
<button class="btn btn-primary">Change</button>
</umb-control-group>
<umb-button
type="submit"
label="Change password"
state="changePasswordButtonState"
button-style="success">
</umb-button>
</form>
</umb-pane>
</form>
</div>
</div>
<small class="umb-version">Umbraco version {{version}}</small>
</div>
</div>
</div>

View File

@@ -1,17 +0,0 @@
<form novalidate name="passwordForm"
ng-controller="Umbraco.Dashboard.StartupChangePasswordController"
ng-submit="changePassword()"
val-form-manager>
<h3>Change password</h3>
<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>

View File

@@ -209,48 +209,3 @@ function MediaFolderBrowserDashboardController($rootScope, $scope, assetsService
}
angular.module("umbraco").controller("Umbraco.Dashboard.MediaFolderBrowserDashboardController", MediaFolderBrowserDashboardController);
function ChangePasswordDashboardController($scope, xmlhelper, $log, currentUserResource, formHelper) {
//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);
});
}
};
}
angular.module("umbraco").controller("Umbraco.Dashboard.StartupChangePasswordController", ChangePasswordDashboardController);

View File

@@ -75,11 +75,6 @@
views/dashboard/default/startupdashboardintro.html
</control>
</tab>
<tab caption="Change Password">
<control showOnce="false" addPanel="false" panelCaption="">
views/dashboard/ChangePassword.html
</control>
</tab>
</section>
<section alias="StartupMemberDashboardSection">
<areas>
@@ -99,4 +94,4 @@
<control>/umbraco/plugins/umbracocontour/formsdashboard.ascx</control>
</tab>
</section>
</dashBoard>
</dashBoard>