Skip to content
This repository has been archived by the owner on Oct 11, 2019. It is now read-only.

fix change password doesn't work #289

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions VirtoCommerce.Platform.Core/PlatformConstants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public static class Setup
ValueType = SettingValueType.ShortText,
DefaultValue = null
};

public static SettingDescriptor SampleDataState = new SettingDescriptor
{
Name = "VirtoCommerce.SampleDataState",
Expand All @@ -140,14 +139,22 @@ public static class Setup
ValueType = SettingValueType.ShortText,
DefaultValue = AutoInstallState.Undefined
};

public static SettingDescriptor ModulesAutoInstalled = new SettingDescriptor
{
Name = "VirtoCommerce.ModulesAutoInstalled",
GroupName = "Platform|Setup",
ValueType = SettingValueType.Boolean,
DefaultValue = false
};
public static SettingDescriptor NonEditableUsers = new SettingDescriptor
{
Name = "VirtoCommerce.NonEditableUsers",
GroupName = "Platform|Setup",
ValueType = SettingValueType.ShortText,
DefaultValue = null,
RestartRequired = true
};

public static IEnumerable<SettingDescriptor> AllSettings
{
get
Expand All @@ -156,6 +163,7 @@ public static IEnumerable<SettingDescriptor> AllSettings
yield return SampleDataState;
yield return ModulesAutoInstallState;
yield return ModulesAutoInstalled;
yield return NonEditableUsers;
}
}
}
Expand Down
12 changes: 7 additions & 5 deletions VirtoCommerce.Platform.Web/Startup.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.IO;
using System.Linq;
using System.Net;
Expand Down Expand Up @@ -30,6 +31,7 @@
using VirtoCommerce.Platform.Core.Jobs;
using VirtoCommerce.Platform.Core.Modularity;
using VirtoCommerce.Platform.Core.Security;
using VirtoCommerce.Platform.Core.Settings;
using VirtoCommerce.Platform.Data.Extensions;
using VirtoCommerce.Platform.Data.PushNotifications;
using VirtoCommerce.Platform.Data.Repositories;
Expand Down Expand Up @@ -143,10 +145,7 @@ public void ConfigureServices(IServiceCollection services)
});

services.AddAuthentication().AddCookie();
services.AddSecurityServices(options =>
{
options.NonEditableUsers = new[] { "admin" };
});
services.AddSecurityServices();

services.AddIdentity<ApplicationUser, Role>(options => options.Stores.MaxLengthForKeys = 128)
.AddEntityFrameworkStores<SecurityDbContext>()
Expand Down Expand Up @@ -320,7 +319,7 @@ public void ConfigureServices(IServiceCollection services)
}

// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
public void Configure(IApplicationBuilder app, IHostingEnvironment env)
public void Configure(IApplicationBuilder app, IHostingEnvironment env, IServiceCollection services, ISettingsManager settingManager, IOptions<Core.Security.AuthorizationOptions> securityOptions)
{

if (env.IsDevelopment())
Expand Down Expand Up @@ -397,6 +396,9 @@ public void Configure(IApplicationBuilder app, IHostingEnvironment env)
app.UseDbTriggers();
//Register platform settings
app.UsePlatformSettings();
var nonEditableUsers = settingManager.GetValue(PlatformConstants.Settings.Setup.NonEditableUsers.Name, string.Empty);
securityOptions.Value.NonEditableUsers = nonEditableUsers.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);

app.UseModules();
//Register platform permissions
app.UsePlatformPermissions();
Expand Down