Merge pull request #896 from umbraco/temp-U4-3774

Fixes: U4-3774 Change password UX
This commit is contained in:
Claus Jensen
2015-11-12 13:36:36 +01:00
10 changed files with 87 additions and 17 deletions

View File

@@ -155,7 +155,7 @@ body {
}
#speechbubble {
z-index: 1000;
z-index: 1060;
position: absolute;
bottom: 100px;
left: 0;
@@ -266,4 +266,4 @@ body {
margin-left: 40px;
width: 85%!important;
}
}
}

View File

@@ -148,6 +148,11 @@ h5{
padding-top: 5px;
margin-left: 240px;
}
.umb-user-panel .controls-row {
margin-left: 0px;
}
.controls-row label {
display: inline-block
}
@@ -525,4 +530,4 @@ height:1px;
margin: 10px 0;
overflow: hidden;
}
}

View File

@@ -1,5 +1,5 @@
angular.module("umbraco")
.controller("Umbraco.Dialogs.UserController", function ($scope, $location, $timeout, userService, 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;
@@ -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

@@ -18,18 +18,25 @@
<div class="umb-panel-body umb-scrollable">
<div class="tab-content umb-control-group">
<div class="umb-pane" ng-if="canEditProfile">
<div class="umb-pane">
<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()">
ng-click="close()" ng-if="canEditProfile">
<localize key="general_edit">Edit</localize>
</a>
<a href
class="btn"
ng-click="showChangePassword = showChangePassword === true ? false : true;" ng-init="showChangePassword = false;">
<localize key="user_newPassword">Change password</localize>
</a>
</p>
</div>
<div class="umb-pane external-logins" ng-if="externalLoginProviders.length > 0">
<h5>External login providers</h5>
@@ -63,6 +70,24 @@
</div>
<div class="umb-pane" ng-if="showChangePassword">
<form novalidate name="passwordForm"
ng-controller="Umbraco.Dashboard.StartupChangePasswordController"
ng-submit="changePassword()"
val-form-manager>
<h3><localize key="user_changePassword">Change password</localize></h3>
<umb-editor model="changePasswordModel"></umb-editor>
<umb-control-group hideLabel="1">
<button class="btn btn-primary"><localize key="user_change">Change</localize></button>
<!-- Could not get the button to change the showChangePassword scope variable to hide the form again... -->
<!--<button class="btn"><localize key="general_cancel" ng-click="showChangePassword = false;">Cancel</localize></button>-->
</umb-control-group>
</form>
</div>
<div class="umb-pane">
<h5><localize key="user_yourHistory" /></h5>
<ul class="umb-tree">
@@ -78,4 +103,4 @@
<small class="umb-version">Umbraco version {{version}}</small>
</div>
</div>
</div>

View File

@@ -3,15 +3,16 @@
ng-submit="changePassword()"
val-form-manager>
<h3>Change password</h3>
<h3><localize key="user_changePassword">Change password</localize></h3>
<umb-pane>
<umb-editor model="changePasswordModel"></umb-editor>
<umb-control-group hideLabel="1">
<button class="btn btn-primary">Change</button>
<button class="btn btn-primary">
<localize key="user_change">Change</localize>
</button>
</umb-control-group>
</umb-pane>
</form>

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>

View File

@@ -923,6 +923,7 @@ Mange hilsner fra Umbraco robotten
<key alias="userTypes">Brugertyper</key>
<key alias="writer">Forfatter</key>
<key alias="translator">Oversætter</key>
<key alias="change">Skift</key>
<key alias="yourProfile">Din profil</key>
<key alias="yourHistory">Din historik</key>
<key alias="sessionExpires">Session udløber</key>

View File

@@ -1057,6 +1057,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="userTypes">User types</key>
<key alias="writer">Writer</key>
<key alias="translator">Translator</key>
<key alias="change">Change</key>
<key alias="yourProfile" version="7.0">Your profile</key>
<key alias="yourHistory" version="7.0">Your recent history</key>
<key alias="sessionExpires" version="7.0">Session expires in</key>

View File

@@ -1055,6 +1055,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="userTypes">User types</key>
<key alias="writer">Writer</key>
<key alias="translator">Translator</key>
<key alias="change">Change</key>
<key alias="yourProfile" version="7.0">Your profile</key>
<key alias="yourHistory" version="7.0">Your recent history</key>
<key alias="sessionExpires" version="7.0">Session expires in</key>

View File

@@ -985,6 +985,7 @@ Om een vertalingstaak te sluiten, ga aub naar het detailoverzicht en klik op de
<key alias="usertype">Gebruikerstype</key>
<key alias="userTypes">Gebruikerstypes</key>
<key alias="writer">Auteur</key>
<key alias="change">Wijzig</key>
<key alias="yourProfile" version="7.0">Je profiel</key>
<key alias="yourHistory" version="7.0">Je recente historie</key>