Compare commits

..

8 Commits

Author SHA1 Message Date
Kenn Jacobsen 0150b97278 Show password change validation errors at the correct fields (#3918)
* Show password change validation errors at the correct password fields + remove the redundant "Could not reset password, errors: " message text

* Explicitly find the user instead of mapping it.
2018-12-31 14:02:59 +00:00
Kenn Jacobsen af2f531d31 Add missing localization of dialogs (#3844) 2018-12-31 13:37:58 +00:00
Sebastiaan Janssen 5e680e80e6 Deletes commented out code 2018-12-31 12:49:54 +00:00
Dave Woestenborghs ee8b4c5884 #3916 fix multiple enumerations of ienumerable...so usernames and avatars are displayed correctly 2018-12-31 12:49:54 +00:00
Dave Woestenborghs 0ce54847b0 #3916 mapping to a IEnumerable resulted in all items in the result list being the same. Now map items indiviually. Could be caused by this : https://stackoverflow.com/questions/17268362/automapper-for-a-list-scenario-only-seems-to-repeat-mapping-the-first-object-in 2018-12-31 12:49:54 +00:00
Callum Whyte b852c78861 Fixing spelling mistakes in helveticons CSS class names
The icon picker uses these class names as labels, kept the old class names for backwards compatibility
2018-12-31 12:47:04 +00:00
Kenn Jacobsen debbf87a04 Support image crop data set when overwriting files using the API 2018-12-31 12:43:06 +00:00
Brian Juul Andersen b2a1b11a5b Fixed minor grammatical error 2018-12-29 20:20:02 +00:00
16 changed files with 94 additions and 50 deletions
+1 -1
View File
@@ -16,7 +16,7 @@ This document gives you a quick overview on how to get started, we will link to
## Guidelines for contributions we welcome
Not all changes are wanted, so on occassion we might close a PR without merging it. We will give you feedback why we can't accept your changes and we'll be nice about it, thanking you for spending your valueable time.
Not all changes are wanted, so on occassion we might close a PR without merging it. We will give you feedback why we can't accept your changes and we'll be nice about it, thanking you for spending your valuable time.
We have [documented what we consider small and large changes](CONTRIBUTION_GUIDELINES.md). Make sure to talk to us before making large changes.
+9 -1
View File
@@ -1,4 +1,6 @@
using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
@@ -293,6 +295,12 @@ namespace Umbraco.Core.IO
{
var property = GetProperty(content, propertyTypeAlias);
var svalue = property.Value as string;
if (svalue != null && svalue.DetectIsJson())
{
// the property value is a JSON serialized image crop data set - grab the "src" property as the file source
var jObject = JsonConvert.DeserializeObject<JObject>(svalue);
svalue = jObject != null ? jObject.GetValueAsString("src") : svalue;
}
var oldpath = svalue == null ? null : GetRelativePath(svalue);
var filepath = StoreFile(content, property.PropertyType, filename, filestream, oldpath);
property.Value = GetUrl(filepath);
@@ -17,12 +17,14 @@
-webkit-font-smoothing: antialiased;
*margin-right: .3em;
}
[class^="icon-"]:before,
[class*=" icon-"]:before {
text-decoration: inherit;
display: inline-block;
speak: none;
}
/*
[class^="icon-"]:before, [class*=" icon-"]:before {
font-family: 'icomoon';
@@ -38,7 +40,6 @@
i.large{
font-size: 32px;
}
i.medium{
font-size: 24px;
}
@@ -187,8 +188,6 @@ i.small{
.icon-umb-translation:before, .traytranslation:before {
content: "\e1fd";
}
.icon-tv:before {
content: "\e02e";
}
@@ -213,7 +212,8 @@ i.small{
.icon-train:before {
content: "\e035";
}
.icon-trafic:before {
.icon-trafic:before,
.icon-traffic:before {
content: "\e036";
}
.icon-traffic-alt:before {
@@ -255,6 +255,7 @@ i.small{
.icon-target:before {
content: "\e043";
}
.icon-temperature-alt:before,
.icon-temperatrure-alt:before {
content: "\e044";
}
@@ -267,6 +268,7 @@ i.small{
.icon-theater:before {
content: "\e047";
}
.icon-thief:before,
.icon-theif:before {
content: "\e048";
}
@@ -375,6 +377,7 @@ i.small{
.icon-shuffle:before {
content: "\e06b";
}
.icon-science:before,
.icon-sience:before {
content: "\e06c";
}
@@ -747,6 +750,7 @@ i.small{
.icon-pictures-alt-2:before {
content: "\e0e7";
}
.icon-panel-close:before,
.icon-pannel-close:before {
content: "\e0e8";
}
@@ -1627,6 +1631,7 @@ i.small{
.icon-alarm-clock:before {
content: "\e20c";
}
.icon-addressbook:before,
.icon-adressbook:before {
content: "\e20d";
}
@@ -1,7 +0,0 @@
<div>
<form ng-submit="model.submit(model)">
<umb-property property="property" ng-repeat="property in model.properties">
<umb-property-editor model="property"></umb-property-editor>
</umb-property>
</form>
</div>
@@ -3,7 +3,8 @@
$scope,
contentResource,
navigationService,
angularHelper) {
angularHelper,
localizationService) {
var vm = this;
var currentForm;
vm.notifyOptions = [];
@@ -11,7 +12,8 @@
vm.cancel = cancel;
vm.message = {
name: $scope.currentNode.name
};;
};
vm.labels = {};
function onInit() {
vm.loading = true;
contentResource.getNotifySettingsById($scope.currentNode.id).then(function (options) {
@@ -19,6 +21,9 @@
vm.loading = false;
vm.notifyOptions = options;
});
localizationService.localize("notifications_editNotifications", [$scope.currentNode.name]).then(function(value) {
vm.labels.headline = value;
});
}
function cancel() {
navigationService.hideMenu();
@@ -11,14 +11,17 @@
<div ng-show="success">
<div class="alert alert-success">
<strong>{{currentNode.name}}</strong> was copied to
<strong>{{currentNode.name}}</strong>
<localize key="actions_wasCopiedTo">was copied to</localize>
<strong>{{target.name}}</strong>
</div>
<button class="btn btn-primary" ng-click="nav.hideDialog()">Ok</button>
</div>
<p class="abstract" ng-hide="success">
Choose where to copy <strong>{{currentNode.name}}</strong> to in the tree structure below
<localize key="actions_chooseWhereToCopy">Choose where to copy</localize>
<strong>{{currentNode.name}}</strong>
<localize key="actions_toInTheTreeStructureBelow">to in the tree structure below</localize>
</p>
<div class="umb-loader-wrapper" ng-show="busy">
@@ -11,7 +11,9 @@
<div ng-show="success">
<div class="alert alert-success">
<strong>{{currentNode.name}}</strong> was moved underneath&nbsp;<strong>{{target.name}}</strong>
<strong>{{currentNode.name}}</strong>
<localize key="actions_wasMovedTo">was moved to</localize>
<strong>{{target.name}}</strong>
</div>
<button class="btn btn-primary" ng-click="nav.hideDialog()">Ok</button>
</div>
@@ -13,13 +13,13 @@
</div>
<div ng-show="vm.saveSuccces" ng-cloak>
<div class="alert alert-success">
<localize key="notify_notificationsSavedFor"></localize><strong> {{currentNode.name}}</strong>
<localize key="notifications_notificationsSavedFor"></localize> <strong>{{currentNode.name}}</strong>
</div>
<button class="btn btn-primary" ng-click="vm.cancel()"><localize key="general_ok">Ok</localize></button>
</div>
<div ng-hide="vm.saveSuccces || vm.saveError" ng-cloak>
<div class="block-form" ng-show="!vm.loading">
<localize key="notify_notifySet">Set your notification for</localize> <strong>{{ currentNode.name }}</strong>
<span ng-bind-html="vm.labels.headline"></span>
<umb-control-group>
<umb-permission ng-repeat="option in vm.notifyOptions"
name="option.name"
@@ -11,7 +11,9 @@
<div ng-show="success">
<div class="alert alert-success">
<strong>{{currentNode.name}}</strong> was moved underneath <strong>{{target.name}}</strong>
<strong>{{currentNode.name}}</strong>
<localize key="actions_wasMovedTo">was moved to</localize>
<strong>{{target.name}}</strong>
</div>
<button class="btn btn-primary" ng-click="nav.hideDialog()">Ok</button>
</div>
@@ -32,8 +32,11 @@
<key alias="rename" version="7.3.0">Omdøb</key>
<key alias="restore" version="7.3.0">Gendan</key>
<key alias="SetPermissionsForThePage">Sæt rettigheder for siden %0%</key>
<key alias="chooseWhereToCopy">Vælg hvor du vil kopiere</key>
<key alias="chooseWhereToMove">Vælg hvortil du vil flytte</key>
<key alias="toInTheTreeStructureBelow">I træstrukturen nedenfor</key>
<key alias="toInTheTreeStructureBelow">til i træstrukturen nedenfor</key>
<key alias="wasMovedTo">blev flyttet til</key>
<key alias="wasCopiedTo">blev kopieret til</key>
<key alias="rights">Rettigheder</key>
<key alias="rollback">Fortryd ændringer</key>
<key alias="sendtopublish">Send til udgivelse</key>
@@ -830,7 +833,8 @@
<key alias="relateToOriginal">Relater det kopierede element til originalen</key>
</area>
<area alias="notifications">
<key alias="editNotifications">Rediger dine notificeringer for %0%</key>
<key alias="editNotifications"><![CDATA[Vælg dine notificeringer for <strong>%0%</strong>]]></key>
<key alias="notificationsSavedFor">Notificeringer er gemt for</key>
<key alias="mailBody">
<![CDATA[
Hej %0%
@@ -1004,6 +1008,7 @@ Mange hilsner fra Umbraco robotten
<area alias="rollback">
<key alias="headline">Vælg en version at sammenligne med den nuværende version</key>
<key alias="currentVersion">Nuværende version</key>
<key alias="diffHelp"><![CDATA[Her vises forskellene mellem den nuværende version og den valgte version<br /><del>Rød</del> tekst vil ikke blive vist i den valgte version. <ins>Grøn betyder tilføjet</ins>]]></key>
<key alias="documentRolledBack">Dokument tilbagerullet</key>
@@ -33,8 +33,11 @@
<key alias="rename" version="7.3.0">Rename</key>
<key alias="restore" version="7.3.0">Restore</key>
<key alias="SetPermissionsForThePage">Set permissions for the page %0%</key>
<key alias="chooseWhereToCopy">Choose where to copy</key>
<key alias="chooseWhereToMove">Choose where to move</key>
<key alias="toInTheTreeStructureBelow">In the tree structure below</key>
<key alias="toInTheTreeStructureBelow">to in the tree structure below</key>
<key alias="wasMovedTo">was moved to</key>
<key alias="wasCopiedTo">was copied to</key>
<key alias="rights">Permissions</key>
<key alias="rollback">Rollback</key>
<key alias="sendtopublish">Send To Publish</key>
@@ -1038,7 +1041,8 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="relateToOriginal">Relate copied items to original</key>
</area>
<area alias="notifications">
<key alias="editNotifications">Edit your notification for %0%</key>
<key alias="editNotifications"><![CDATA[Select your notification for <strong>%0%</strong>]]></key>
<key alias="notificationsSavedFor">Notification settings saved for</key>
<key alias="mailBody">
<![CDATA[
Hi %0%
@@ -1310,6 +1314,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="undoEditCrop">Undo edits</key>
</area>
<area alias="rollback">
<key alias="headline">Select a version to compare with the current version</key>
<key alias="currentVersion">Current version</key>
<key alias="diffHelp"><![CDATA[This shows the differences between the current version and the selected version<br /><del>Red</del> text will not be shown in the selected version. , <ins>green means added</ins>]]></key>
<key alias="documentRolledBack">Document has been rolled back</key>
@@ -33,8 +33,11 @@
<key alias="rename" version="7.3.0">Rename</key>
<key alias="restore" version="7.3.0">Restore</key>
<key alias="SetPermissionsForThePage">Set permissions for the page %0%</key>
<key alias="chooseWhereToCopy">Choose where to copy</key>
<key alias="chooseWhereToMove">Choose where to move</key>
<key alias="toInTheTreeStructureBelow">In the tree structure below</key>
<key alias="toInTheTreeStructureBelow">to in the tree structure below</key>
<key alias="wasMovedTo">was moved to</key>
<key alias="wasCopiedTo">was copied to</key>
<key alias="rights">Permissions</key>
<key alias="rollback">Rollback</key>
<key alias="sendtopublish">Send To Publish</key>
@@ -1037,7 +1040,8 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="relateToOriginal">Relate copied items to original</key>
</area>
<area alias="notifications">
<key alias="editNotifications">Edit your notification for %0%</key>
<key alias="editNotifications"><![CDATA[Select your notification for <strong>%0%</strong>]]></key>
<key alias="notificationsSavedFor">Notification settings saved for</key>
<key alias="mailBody">
<![CDATA[
Hi %0%
@@ -1309,6 +1313,7 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="undoEditCrop">Undo edits</key>
</area>
<area alias="rollback">
<key alias="headline">Select a version to compare with the current version</key>
<key alias="currentVersion">Current version</key>
<key alias="diffHelp"><![CDATA[This shows the differences between the current version and the selected version<br /><del>Red</del> text will not be shown in the selected version. , <ins>green means added</ins>]]></key>
<key alias="documentRolledBack">Document has been rolled back</key>
@@ -2220,8 +2225,4 @@ To manage your website, simply open the Umbraco back office and start adding con
<key alias="itemCannotBeRestoredHelpText">There is no location where this item can be automatically restored. You can move the item manually using the tree below.</key>
<key alias="wasRestored">was restored under</key>
</area>
<area alias="notify">
<key alias="notifySet">Select your notifications for</key>
<key alias="notificationsSavedFor">Notification settings saved for </key>
</area>
</language>
@@ -55,7 +55,7 @@
</div>
<div runat="server" id="pl_buttons" class="umb-dialog-footer btn-toolbar umb-btn-toolbar">
<a href="#" class="btn btn-link" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("general", "cancel")%></a>
<a href="#" class="btn btn-link" onclick="UmbClientMgr.closeModalWindow()"><%=umbraco.ui.Text("general", "close")%></a>
<asp:Button ID="Button1" runat="server" visible="false" CssClass="btn btn-primary" OnClick="doRollback_Click"></asp:Button>
</div>
</asp:Content>
+5 -4
View File
@@ -27,7 +27,7 @@ namespace Umbraco.Web.Editors
long totalRecords;
var dateQuery = sinceDate.HasValue ? Query<IAuditItem>.Builder.Where(x => x.CreateDate >= sinceDate) : null;
var result = Services.AuditService.GetPagedItemsByEntity(id, pageNumber - 1, pageSize, out totalRecords, orderDirection, customFilter: dateQuery);
var mapped = Mapper.Map<IEnumerable<AuditLog>>(result);
var mapped = result.Select(item => Mapper.Map<AuditLog>(item));
var page = new PagedResult<AuditLog>(totalRecords, pageNumber, pageSize)
{
@@ -85,16 +85,17 @@ namespace Umbraco.Web.Editors
private IEnumerable<AuditLog> MapAvatarsAndNames(IEnumerable<AuditLog> items)
{
var userIds = items.Select(x => x.UserId).ToArray();
var mappedItems = items.ToList();
var userIds = mappedItems.Select(x => x.UserId).ToArray();
var users = Services.UserService.GetUsersById(userIds)
.ToDictionary(x => x.Id, x => x.GetUserAvatarUrls(ApplicationContext.ApplicationCache.RuntimeCache));
var userNames = Services.UserService.GetUsersById(userIds).ToDictionary(x => x.Id, x => x.Name);
foreach (var item in items)
foreach (var item in mappedItems)
{
item.UserAvatars = users[item.UserId];
item.UserName = userNames[item.UserId];
}
return items;
return mappedItems;
}
}
}
+23 -14
View File
@@ -100,7 +100,7 @@ namespace Umbraco.Web.Editors
{
var errors = string.Join(". ", resetResult.Errors);
_logger.Warn<PasswordChanger>(string.Format("Could not reset user password {0}", errors));
return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Could not reset password, errors: " + errors, new[] { "resetPassword" }) });
return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult(errors, new[] { "resetPassword" }) });
}
return Attempt.Succeed(new PasswordChangedModel());
@@ -120,21 +120,30 @@ namespace Umbraco.Web.Editors
return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Password cannot be changed without the old password", new[] { "oldPassword" }) });
}
if (passwordModel.OldPassword.IsNullOrWhiteSpace() == false)
//get the user
var backOfficeIdentityUser = await userMgr.FindByIdAsync(savingUser.Id);
if (backOfficeIdentityUser == null)
{
//if an old password is suplied try to change it
var changeResult = await userMgr.ChangePasswordAsync(savingUser.Id, passwordModel.OldPassword, passwordModel.NewPassword);
if (changeResult.Succeeded == false)
{
var errors = string.Join(". ", changeResult.Errors);
_logger.Warn<PasswordChanger>(string.Format("Could not change user password {0}", errors));
return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Could not change password, errors: " + errors, new[] { "oldPassword" }) });
}
return Attempt.Succeed(new PasswordChangedModel());
//this really shouldn't ever happen... but just in case
return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Password could not be verified", new[] { "oldPassword" }) });
}
//We shouldn't really get here
return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Could not change password, invalid information supplied", new[] { "value" }) });
//is the old password correct?
var validateResult = await userMgr.CheckPasswordAsync(backOfficeIdentityUser, passwordModel.OldPassword);
if(validateResult == false)
{
//no, fail with an error message for "oldPassword"
return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult("Incorrect password", new[] { "oldPassword" }) });
}
//can we change to the new password?
var changeResult = await userMgr.ChangePasswordAsync(savingUser.Id, passwordModel.OldPassword, passwordModel.NewPassword);
if (changeResult.Succeeded == false)
{
//no, fail with error messages for "password"
var errors = string.Join(". ", changeResult.Errors);
_logger.Warn<PasswordChanger>(string.Format("Could not change user password {0}", errors));
return Attempt.Fail(new PasswordChangedModel { ChangeError = new ValidationResult(errors, new[] { "password" }) });
}
return Attempt.Succeed(new PasswordChangedModel());
}
/// <summary>
@@ -116,6 +116,11 @@ namespace umbraco.presentation.dialogs
currentVersionTitle.Text = currentDoc.Text;
currentVersionMeta.Text = ui.Text("content", "createDate") + ": " + currentDoc.VersionDate.ToShortDateString() + " " + currentDoc.VersionDate.ToShortTimeString();
pp_selectVersion.Text = ui.Text("rollback", "headline");
pp_currentVersion.Text = ui.Text("rollback", "currentVersion");
pp_view.Text = ui.Text("rollback", "view");
pp_rollBackTo.Text = ui.Text("rollback", "rollbackTo");
if (!IsPostBack) {
allVersions.Items.Add(new ListItem(ui.Text("rollback", "selectVersion")+ "...", ""));