Adds notification for 404 errors, updates password changer to use new provider property for legacy backwards compatibility. Fixes validation logic on post.

This commit is contained in:
Shannon
2013-10-23 11:31:13 +11:00
parent 00486eeaa7
commit 2325052d69
5 changed files with 28 additions and 8 deletions

View File

@@ -29,6 +29,24 @@ angular.module('umbraco.security.interceptor', ['umbraco.security.retryQueue'])
return $injector.get('$http')(originalResponse.config);
});
}
else if (originalResponse.status === 404) {
//a 404 indicates that the request was not found - this could be due to a non existing url, or it could
//be due to accessing a url with a parameter that doesn't exist, either way we should notifiy the user about it
var errMsg = "The URL returned a 404 (not found): <br/><i>" + originalResponse.config.url.split('?')[0] + "</i>";
if (originalResponse.data && originalResponse.data.ExceptionMessage) {
errMsg += "<br/> with error: <br/><i>" + originalResponse.data.ExceptionMessage + "</i>";
}
if (originalResponse.config.data) {
errMsg += "<br/> with data: <br/><i>" + angular.toJson(originalResponse.config.data) + "</i><br/>Contact your administrator for information.";
}
notifications.error(
"Request error",
errMsg);
}
else if (originalResponse.status === 403) {
//if the status was a 403 it means the user didn't have permission to do what the request was trying to do.
//How do we deal with this now, need to tell the user somehow that they don't have permission to do the thing that was

View File

@@ -102,7 +102,9 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.ChangePasswordCont
};
$scope.showOldPass = function() {
return $scope.model.config.hasPassword && !$scope.model.config.enablePasswordRetrieval && !$scope.model.value.reset;
return $scope.model.config.hasPassword &&
!$scope.model.config.allowManuallyChangingPassword &&
!$scope.model.config.enablePasswordRetrieval && !$scope.model.value.reset;
};
$scope.showNewPass = function () {
@@ -117,8 +119,4 @@ angular.module("umbraco").controller("Umbraco.PropertyEditors.ChangePasswordCont
return $scope.model.config.disableToggle !== true && $scope.model.config.hasPassword;
};
$scope.oldPassRequired = function() {
return !$scope.model.value.reset && $scope.model.config.hasPassword && !$scope.model.config.enablePasswordRetrieval;
};
});

View File

@@ -22,7 +22,7 @@
<umb-control-group alias="oldPassword" label="Old password" ng-show="$parent.showOldPass()">
<input type="text" name="oldPassword" ng-model="$parent.model.value.oldPassword"
class="input-large umb-textstring textstring"
ng-required="$parent.oldPassRequired()"
ng-required="$parent.showOldPass()"
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>

View File

@@ -4,6 +4,7 @@ using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Security;
using Umbraco.Core.Security;
namespace Umbraco.Web
{
@@ -17,12 +18,15 @@ namespace Umbraco.Web
public static IDictionary<string, object> GetConfiguration(
this MembershipProvider membershipProvider)
{
var baseProvider = membershipProvider as MembershipProviderBase;
return new Dictionary<string, object>
{
{"minPasswordLength", membershipProvider.MinRequiredPasswordLength},
{"enableReset", membershipProvider.EnablePasswordReset},
{"enablePasswordRetrieval", membershipProvider.EnablePasswordRetrieval},
{"requiresQuestionAnswer", membershipProvider.RequiresQuestionAndAnswer}
{"requiresQuestionAnswer", membershipProvider.RequiresQuestionAndAnswer},
{"allowManuallyChangingPassword", baseProvider != null && baseProvider.AllowManuallyChangingPassword}
//TODO: Inject the other parameters in here to change the behavior of this control - based on the membership provider settings.
};
}

View File

@@ -90,7 +90,7 @@ namespace Umbraco.Web.WebApi.Filters
foreach (var p in postedItem.Properties)
{
if (postedItem.PersistedContent.Properties.Contains(p.Alias))
if (postedItem.PersistedContent.Properties.Contains(p.Alias) == false)
{
//TODO: Do we return errors here ? If someone deletes a property whilst their editing then should we just
//save the property data that remains? Or inform them they need to reload... not sure. This problem exists currently too i think.