Merge branch 'dev-v7' into 7.3.0
Conflicts: src/Umbraco.Core/packages.config src/Umbraco.Web.UI/packages.config src/Umbraco.Web.UI/umbraco/config/lang/en_us.xml src/Umbraco.Web/Editors/AuthenticationController.cs src/Umbraco.Web/packages.config
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
45
src/Umbraco.Core/HttpContextExtensions.cs
Normal file
45
src/Umbraco.Core/HttpContextExtensions.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System.Web;
|
||||
|
||||
namespace Umbraco.Core
|
||||
{
|
||||
public static class HttpContextExtensions
|
||||
{
|
||||
public static string GetCurrentRequestIpAddress(this HttpContextBase httpContext)
|
||||
{
|
||||
if (httpContext == null)
|
||||
{
|
||||
return "Unknown, httpContext is null";
|
||||
}
|
||||
if (httpContext.Request == null)
|
||||
{
|
||||
return "Unknown, httpContext.Request is null";
|
||||
}
|
||||
if (httpContext.Request.ServerVariables == null)
|
||||
{
|
||||
return "Unknown, httpContext.Request.ServerVariables is null";
|
||||
}
|
||||
|
||||
// From: http://stackoverflow.com/a/740431/5018
|
||||
|
||||
try
|
||||
{
|
||||
var ipAddress = httpContext.Request.ServerVariables["HTTP_X_FORWARDED_FOR"];
|
||||
|
||||
if (string.IsNullOrEmpty(ipAddress))
|
||||
return httpContext.Request.ServerVariables["REMOTE_ADDR"];
|
||||
|
||||
var addresses = ipAddress.Split(',');
|
||||
if (addresses.Length != 0)
|
||||
return addresses[0];
|
||||
|
||||
return httpContext.Request.ServerVariables["REMOTE_ADDR"];
|
||||
}
|
||||
catch (System.Exception ex)
|
||||
{
|
||||
//This try catch is to just always ensure that no matter what we're not getting any exceptions caused since
|
||||
// that would cause people to not be able to login
|
||||
return string.Format("Unknown, exception occurred trying to resolve IP {0}", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,7 @@ using System.Configuration.Provider;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using System.Web.Configuration;
|
||||
using System.Web.Hosting;
|
||||
using System.Web.Security;
|
||||
@@ -906,5 +907,15 @@ namespace Umbraco.Core.Security
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the current request IP address for logging if there is one
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
protected string GetCurrentRequestIpAddress()
|
||||
{
|
||||
var httpContext = HttpContext.Current == null ? (HttpContextBase) null : new HttpContextWrapper(HttpContext.Current);
|
||||
return httpContext.GetCurrentRequestIpAddress();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -132,9 +132,9 @@
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.40804.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
@@ -344,6 +344,7 @@
|
||||
<Compile Include="Events\SendToPublishEventArgs.cs" />
|
||||
<Compile Include="Exceptions\InvalidCompositionException.cs" />
|
||||
<Compile Include="HideFromTypeFinderAttribute.cs" />
|
||||
<Compile Include="HttpContextExtensions.cs" />
|
||||
<Compile Include="IApplicationEventHandler.cs" />
|
||||
<Compile Include="IDisposeOnRequestEnd.cs" />
|
||||
<Compile Include="Logging\OwinLogger.cs" />
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
|
||||
</dependentAssembly>
|
||||
|
||||
|
||||
@@ -135,9 +135,9 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.40804.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<package id="Examine" version="0.1.63.0" targetFramework="net45" />
|
||||
<package id="log4net-mediumtrust" version="2.0.0" targetFramework="net40" />
|
||||
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.40804.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.Mvc.FixedDisplayModes" version="1.0.1" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net45" />
|
||||
|
||||
@@ -263,9 +263,9 @@
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc">
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.40804.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
|
||||
@@ -245,8 +245,8 @@
|
||||
<key alias="nameentity">Name the %0%...</key>
|
||||
<key alias="entername">Enter a name...</key>
|
||||
<key alias="search">Type to search...</key>
|
||||
<key alias="filter">Type to filter...</key>
|
||||
<key alias="enterTags">Type to add tags (press enter after each tag)...</key>
|
||||
<key alias="filter">Type to filter...</key>
|
||||
<key alias="enterTags">Type to add tags (press enter after each tag)...</key>
|
||||
</area>
|
||||
<area alias="editcontenttype">
|
||||
<key alias="allowAtRoot" version="7.2">Allow at root</key>
|
||||
@@ -680,9 +680,11 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="paSimpleHelp">If you just want to setup simple protection using a single login and password</key>
|
||||
</area>
|
||||
<area alias="publish">
|
||||
<key alias="contentPublishedFailedAwaitingRelease"><![CDATA[
|
||||
<key alias="contentPublishedFailedAwaitingRelease">
|
||||
<![CDATA[
|
||||
%0% could not be published because the item is scheduled for release.
|
||||
]]></key>
|
||||
]]>
|
||||
</key>
|
||||
<key alias="contentPublishedFailedInvalid"><![CDATA[
|
||||
%0% could not be published because these properties: %1% did not pass validation rules.
|
||||
]]></key>
|
||||
|
||||
@@ -45,16 +45,16 @@
|
||||
<key alias="invalidNode">Invalid node.</key>
|
||||
<key alias="invalidDomain">Invalid domain format.</key>
|
||||
<key alias="duplicateDomain">Domain has already been assigned.</key>
|
||||
<key alias="domain">Domain</key>
|
||||
<key alias="language">Language</key>
|
||||
<key alias="domain">Domain</key>
|
||||
<key alias="domainCreated">New domain '%0%' has been created</key>
|
||||
<key alias="domainDeleted">Domain '%0%' is deleted</key>
|
||||
<key alias="domainExists">Domain '%0%' has already been assigned</key>
|
||||
<key alias="domainUpdated">Domain '%0%' has been updated</key>
|
||||
<key alias="orEdit">Edit Current Domains</key>
|
||||
<key alias="domainHelp"><![CDATA[Valid domain names are: "example.com", "www.example.com", "example.com:8080" or
|
||||
"https://www.example.com/".<br /><br />One-level paths in domains are supported, eg. "example.com/en". However, they
|
||||
should be avoided. Better use the culture setting above.]]></key>
|
||||
<key alias="domainUpdated">Domain '%0%' has been updated</key>
|
||||
<key alias="orEdit">Edit Current Domains</key>
|
||||
<key alias="inherit">Inherit</key>
|
||||
<key alias="setLanguage">Culture</key>
|
||||
<key alias="setLanguageHelp"><![CDATA[Set the culture for nodes below the current node,<br /> or inherit culture from parent nodes. Will also apply<br />
|
||||
@@ -64,8 +64,6 @@
|
||||
<area alias="auditTrails">
|
||||
<key alias="atViewingFor">Viewing for</key>
|
||||
</area>
|
||||
|
||||
|
||||
<area alias="buttons">
|
||||
<key alias="select">Select</key>
|
||||
<key alias="selectCurrentFolder">Select current folder</key>
|
||||
@@ -135,7 +133,7 @@
|
||||
<key alias="itemChanged">This item has been changed after publication</key>
|
||||
<key alias="itemNotPublished">This item is not published</key>
|
||||
<key alias="lastPublished">Last published</key>
|
||||
<key alias="listViewNoItems" version="7.1.5">There are no items show in the list.</key>
|
||||
<key alias="listViewNoItems" version="7.1.5">There are no items to show in the list.</key>
|
||||
<key alias="mediatype">Media Type</key>
|
||||
<key alias="mediaLinks">Link to media item(s)</key>
|
||||
<key alias="membergroup">Member Group</key>
|
||||
@@ -163,8 +161,7 @@
|
||||
<key alias="uploadClear">Remove file(s)</key>
|
||||
<key alias="urls">Link to document</key>
|
||||
<key alias="memberof">Member of group(s)</key>
|
||||
<key alias="notmemberof">Not a member of group(s)</key>
|
||||
|
||||
<key alias="notmemberof">Not a member of group(s)</key>
|
||||
<key alias="childItems" version="7.0">Child items</key>
|
||||
<key alias="target" version="7.0">Target</key>
|
||||
</area>
|
||||
@@ -176,9 +173,7 @@
|
||||
<key alias="chooseNode">Where do you want to create the new %0%</key>
|
||||
<key alias="createUnder">Create an item under</key>
|
||||
<key alias="updateData">Choose a type and a title</key>
|
||||
|
||||
<key alias="noDocumentTypes" version="7.0"><![CDATA[There are no allowed document types available. You must enable these in the settings section under <strong>"document types"</strong>.]]></key>
|
||||
|
||||
<key alias="noMediaTypes" version="7.0"><![CDATA[There are no allowed media types available. You must enable these in the settings section under <strong>"media types"</strong>.]]></key>
|
||||
</area>
|
||||
<area alias="dashboard">
|
||||
@@ -251,6 +246,7 @@
|
||||
<key alias="entername">Enter a name...</key>
|
||||
<key alias="search">Type to search...</key>
|
||||
<key alias="filter">Type to filter...</key>
|
||||
<key alias="enterTags">Type to add tags (press enter after each tag)...</key>
|
||||
</area>
|
||||
|
||||
<area alias="editcontenttype">
|
||||
@@ -413,7 +409,6 @@
|
||||
<key alias="width">Width</key>
|
||||
<key alias="yes">Yes</key>
|
||||
<key alias="folder">Folder</key>
|
||||
|
||||
<key alias="searchResults">Search results</key>
|
||||
</area>
|
||||
<area alias="graphicheadline">
|
||||
@@ -561,11 +556,9 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="greeting4">Happy thunderous Thursday</key>
|
||||
<key alias="greeting5">Happy funky Friday</key>
|
||||
<key alias="greeting6">Happy Caturday</key>
|
||||
|
||||
<key alias="instruction">log in below</key>
|
||||
<key alias="instruction">Log in below</key>
|
||||
<key alias="timeout">Session timed out</key>
|
||||
<key alias="bottomText"><![CDATA[<p style="text-align:right;">© 2001 - %0% <br /><a href="http://umbraco.com" style="text-decoration: none" target="_blank">Umbraco.com</a></p> ]]></key>
|
||||
|
||||
<key alias="bottomText"><![CDATA[<p style="text-align:right;">© 2001 - %0% <br /><a href="http://umbraco.com" style="text-decoration: none" target="_blank">Umbraco.com</a></p> ]]></key>
|
||||
</area>
|
||||
<area alias="main">
|
||||
<key alias="dashboard">Dashboard</key>
|
||||
@@ -716,16 +709,16 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="noColors">You have not configured any approved colors</key>
|
||||
</area>
|
||||
<area alias="relatedlinks">
|
||||
<key alias="addExternal">Add external link</key>
|
||||
<key alias="addInternal">Add internal link</key>
|
||||
<key alias="addlink">Add</key>
|
||||
<key alias="enterExternal">enter external link</key>
|
||||
<key alias="chooseInternal">choose internal page</key>
|
||||
<key alias="caption">Caption</key>
|
||||
<key alias="internalPage">Internal page</key>
|
||||
<key alias="linkurl">URL</key>
|
||||
<key alias="modeDown">Move Down</key>
|
||||
<key alias="modeUp">Move Up</key>
|
||||
<key alias="link">Link</key>
|
||||
<key alias="newWindow">Open in new window</key>
|
||||
<key alias="removeLink">Remove link</key>
|
||||
<key alias="captionPlaceholder">enter the display caption</key>
|
||||
<key alias="externalLinkPlaceholder">Enter the link</key>
|
||||
</area>
|
||||
<area alias="imagecropper">
|
||||
<key alias="reset">Reset</key>
|
||||
</area>
|
||||
<area alias="rollback">
|
||||
<key alias="currentVersion">Current version</key>
|
||||
@@ -752,8 +745,8 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="statistics">Statistics</key>
|
||||
<key alias="translation">Translation</key>
|
||||
<key alias="users">Users</key>
|
||||
|
||||
<key alias="help" version="7.0">Help</key>
|
||||
<key alias="forms">Forms</key>
|
||||
<key alias="analytics">Analytics</key>
|
||||
</area>
|
||||
<area alias="settings">
|
||||
@@ -860,6 +853,10 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="addRows">Add rows to your layout</key>
|
||||
<key alias="addElement"><![CDATA[To start, click the <i class="icon icon-add blue"></i> below and add your first element]]></key>
|
||||
|
||||
<key alias="clickToEmbed">Click to embed</key>
|
||||
<key alias="clickToInsertImage">Click to insert image</key>
|
||||
<key alias="placeholderImageCaption">Image caption...</key>
|
||||
<key alias="placeholderWriteHere">Write here...</key>
|
||||
<key alias="gridLayouts">Grid layouts</key>
|
||||
<key alias="gridLayoutsDetail">Layouts are the overall work area for the grid editor, usually you only need one or two different layouts</key>
|
||||
<key alias="addGridLayout">Add grid layout</key>
|
||||
@@ -1033,7 +1030,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="permissionSelectPages">Select pages to modify their permissions</key>
|
||||
<key alias="searchAllChildren">Search all children</key>
|
||||
<key alias="startnode">Start Node in Content</key>
|
||||
<key alias="username">Username</key>
|
||||
<key alias="username">Name</key>
|
||||
<key alias="userPermissions">User permissions</key>
|
||||
<key alias="usertype">User type</key>
|
||||
<key alias="userTypes">User types</key>
|
||||
|
||||
@@ -133,7 +133,14 @@
|
||||
xdt:Locator="Condition(_defaultNamespace:assemblyIdentity[@name='System.Web.Mvc']])" />
|
||||
<dependentAssembly xdt:Transform="Insert">
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="1.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly xdt:Transform="Remove"
|
||||
xdt:Locator="Condition(_defaultNamespace:assemblyIdentity[@name='System.Net.Http']])"/>
|
||||
<dependentAssembly xdt:Transform="Insert">
|
||||
<assemblyIdentity name="System.Net.Http" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly xdt:Transform="Remove"
|
||||
|
||||
@@ -257,10 +257,10 @@
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
|
||||
</dependentAssembly>
|
||||
|
||||
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0-4.0.0.1" newVersion="4.0.0.1"/>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
|
||||
<dependentAssembly>
|
||||
|
||||
@@ -28,6 +28,7 @@ using Umbraco.Web.WebApi;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
using umbraco.providers;
|
||||
using Microsoft.AspNet.Identity.Owin;
|
||||
using Umbraco.Core.Logging;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using Umbraco.Core.Models.Identity;
|
||||
using IUser = Umbraco.Core.Models.Membership.IUser;
|
||||
@@ -161,6 +162,10 @@ namespace Umbraco.Web.Editors
|
||||
[SetAngularAntiForgeryTokens]
|
||||
public async Task<HttpResponseMessage> PostLogin(LoginModel loginModel)
|
||||
{
|
||||
var http = this.TryGetHttpContext();
|
||||
if (http.Success == false)
|
||||
throw new InvalidOperationException("This method requires that an HttpContext be active");
|
||||
|
||||
if (UmbracoContext.Security.ValidateBackOfficeCredentials(loginModel.Username, loginModel.Password))
|
||||
{
|
||||
//get the user
|
||||
@@ -177,12 +182,6 @@ namespace Umbraco.Web.Editors
|
||||
//Identity does some of it's own checks as well so we need to use it's sign in process too... this will essentially re-create the
|
||||
// ticket/cookie above but we need to create the ticket now so we can assign the Current Thread User/IPrinciple below
|
||||
await SignInAsync(Mapper.Map<IUser, BackOfficeIdentityUser>(user), isPersistent: true);
|
||||
|
||||
var http = this.TryGetHttpContext();
|
||||
if (http.Success == false)
|
||||
{
|
||||
throw new InvalidOperationException("This method requires that an HttpContext be active");
|
||||
}
|
||||
//This ensure the current principal is set, otherwise any logic executing after this wouldn't actually be authenticated
|
||||
http.Result.AuthenticateCurrentRequest(ticket, false);
|
||||
|
||||
@@ -195,7 +194,7 @@ namespace Umbraco.Web.Editors
|
||||
//return BadRequest (400), we don't want to return a 401 because that get's intercepted
|
||||
// by our angular helper because it thinks that we need to re-perform the request once we are
|
||||
// authorized and we don't want to return a 403 because angular will show a warning msg indicating
|
||||
// that the user doesn't have access to perform this function, we just want to return a normal invalid msg.
|
||||
// that the user doesn't have access to perform this function, we just want to return a normal invalid msg.
|
||||
throw new HttpResponseException(HttpStatusCode.BadRequest);
|
||||
}
|
||||
|
||||
|
||||
@@ -511,16 +511,35 @@ namespace Umbraco.Web.Security.Providers
|
||||
{
|
||||
var member = MemberService.GetByUsername(username);
|
||||
|
||||
if (member == null) return false;
|
||||
if (member == null)
|
||||
{
|
||||
LogHelper.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}, the user does not exist",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (member.IsApproved == false)
|
||||
{
|
||||
LogHelper.Info<UmbracoMembershipProvider<T, TEntity>>("Cannot validate member " + username + " because they are not approved");
|
||||
LogHelper.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}, the user is not approved",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
|
||||
return false;
|
||||
}
|
||||
if (member.IsLockedOut)
|
||||
{
|
||||
LogHelper.Info<UmbracoMembershipProvider<T, TEntity>>("Cannot validate member " + username + " because they are currently locked out");
|
||||
LogHelper.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}, the user is locked",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -538,18 +557,39 @@ namespace Umbraco.Web.Security.Providers
|
||||
{
|
||||
member.IsLockedOut = true;
|
||||
member.LastLockoutDate = DateTime.Now;
|
||||
LogHelper.Info<UmbracoMembershipProvider<T, TEntity>>("Member " + username + " is now locked out, max invalid password attempts exceeded");
|
||||
|
||||
LogHelper.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}, the user is now locked out, max invalid password attempts exceeded",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
member.FailedPasswordAttempts = 0;
|
||||
member.LastLoginDate = DateTime.Now;
|
||||
|
||||
LogHelper.Info<UmbracoMembershipProviderBase>(
|
||||
string.Format(
|
||||
"Login attempt succeeded for username {0} from IP address {1}",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
}
|
||||
|
||||
//don't raise events for this! It just sets the member dates, if we do raise events this will
|
||||
// cause all distributed cache to execute - which will clear out some caches we don't want.
|
||||
// http://issues.umbraco.org/issue/U4-3451
|
||||
//TODO: In v8 we aren't going to have an overload to disable events, so we'll need to make a different method
|
||||
// for this type of thing (i.e. UpdateLastLogin or similar).
|
||||
MemberService.Save(member, false);
|
||||
|
||||
return authenticated;
|
||||
|
||||
@@ -230,9 +230,9 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.40804.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="MiniProfiler" publicKeyToken="b44f9351044011a3" culture="neutral" />
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<package id="Examine" version="0.1.63.0" targetFramework="net45" />
|
||||
<package id="HtmlAgilityPack" version="1.4.6" targetFramework="net40" />
|
||||
<package id="Lucene.Net" version="2.9.4.1" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.40804.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.WebApi" version="5.2.3" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.WebApi.Client" version="5.2.3" targetFramework="net45" />
|
||||
|
||||
@@ -92,9 +92,9 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebApi.WebHost.5.2.3\lib\net45\System.Web.Http.WebHost.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.40804.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="AutoMapper" version="3.0.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.40804.0" targetFramework="net45" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="4.0.30506.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.Razor" version="2.0.30506.0" targetFramework="net40" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="2.0.30506.0" targetFramework="net40" />
|
||||
<package id="Microsoft.Owin" version="3.0.1" targetFramework="net45" />
|
||||
|
||||
@@ -143,9 +143,9 @@
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.WebPages.2.0.30506.0\lib\net40\System.Web.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.1, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Reference Include="System.Web.Mvc, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.40804.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
<HintPath>..\packages\Microsoft.AspNet.Mvc.4.0.30506.0\lib\net40\System.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>True</Private>
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
@@ -9,6 +9,8 @@ using umbraco.BusinessLogic;
|
||||
using System.Web.Util;
|
||||
using System.Configuration.Provider;
|
||||
using System.Linq;
|
||||
using Umbraco.Core.Logging;
|
||||
|
||||
#endregion
|
||||
|
||||
namespace umbraco.providers
|
||||
@@ -491,10 +493,33 @@ namespace umbraco.providers
|
||||
{
|
||||
if (user.Disabled)
|
||||
{
|
||||
LogHelper.Info<UsersMembershipProvider>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}, the user is locked",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return CheckPassword(password, user.Password);
|
||||
var result = CheckPassword(password, user.Password);
|
||||
if (result == false)
|
||||
{
|
||||
LogHelper.Info<UsersMembershipProvider>(
|
||||
string.Format(
|
||||
"Login attempt failed for username {0} from IP address {1}",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogHelper.Info<UsersMembershipProvider>(
|
||||
string.Format(
|
||||
"Login attempt succeeded for username {0} from IP address {1}",
|
||||
username,
|
||||
GetCurrentRequestIpAddress()));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.1" newVersion="4.0.0.1" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.WebPages" publicKeyToken="31bf3856ad364e35" culture="neutral" />
|
||||
|
||||
Reference in New Issue
Block a user