-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from umbraco/dev-v7
merge from umbraco/
- Loading branch information
Showing
50 changed files
with
721 additions
and
370 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
...ersistence/Migrations/Upgrades/TargetVersionSevenThreeOne/UpdateUserLanguagesToIsoCode.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System.Linq; | ||
using Umbraco.Core.Configuration; | ||
using Umbraco.Core.Logging; | ||
using Umbraco.Core.Models.Rdbms; | ||
using Umbraco.Core.Persistence.SqlSyntax; | ||
|
||
namespace Umbraco.Core.Persistence.Migrations.Upgrades.TargetVersionSevenThreeOne | ||
{ | ||
/// <summary> | ||
/// This fixes the storage of user languages from the old format like en_us to en-US | ||
/// </summary> | ||
[Migration("7.3.1", 0, GlobalSettings.UmbracoMigrationName)] | ||
public class UpdateUserLanguagesToIsoCode : MigrationBase | ||
{ | ||
public UpdateUserLanguagesToIsoCode(ISqlSyntaxProvider sqlSyntax, ILogger logger) : base(sqlSyntax, logger) | ||
{ | ||
} | ||
|
||
public override void Up() | ||
{ | ||
var userData = Context.Database.Fetch<UserDto>(new Sql().Select("*").From<UserDto>(SqlSyntax)); | ||
foreach (var user in userData.Where(x => x.UserLanguage.Contains("_"))) | ||
{ | ||
var languageParts = user.UserLanguage.Split('_'); | ||
if (languageParts.Length == 2) | ||
{ | ||
Update.Table("umbracoUser") | ||
.Set(new {userLanguage = languageParts[0] + "-" + languageParts[1].ToUpperInvariant()}) | ||
.Where(new {id = user.Id}); | ||
} | ||
} | ||
} | ||
|
||
public override void Down() | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
src/Umbraco.Core/Security/BackOfficeUserPasswordCheckerResult.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
namespace Umbraco.Core.Security | ||
{ | ||
/// <summary> | ||
/// The result returned from the IBackOfficeUserPasswordChecker | ||
/// </summary> | ||
public enum BackOfficeUserPasswordCheckerResult | ||
{ | ||
ValidCredentials, | ||
InvalidCredentials, | ||
FallbackToDefaultChecker | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Umbraco.Core/Security/IBackOfficeUserPasswordChecker.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Threading.Tasks; | ||
using Umbraco.Core.Models.Identity; | ||
|
||
namespace Umbraco.Core.Security | ||
{ | ||
/// <summary> | ||
/// Used by the BackOfficeUserManager to check the username/password which allows for developers to more easily | ||
/// set the logic for this procedure. | ||
/// </summary> | ||
public interface IBackOfficeUserPasswordChecker | ||
{ | ||
Task<BackOfficeUserPasswordCheckerResult> CheckPasswordAsync(BackOfficeIdentityUser user, string password); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.