Passwords 如何在Umbraco中重置管理员或任何用户密码?
无法在umbraco 8中重置密码。 我在umbraco论坛和堆栈溢出中搜索了所有解决方案。Passwords 如何在Umbraco中重置管理员或任何用户密码?,passwords,umbraco,umbraco7,reset-password,umbraco8,Passwords,Umbraco,Umbraco7,Reset Password,Umbraco8,无法在umbraco 8中重置密码。 我在umbraco论坛和堆栈溢出中搜索了所有解决方案。 正在尝试解决方案,但什么都没有。创建一个类,如下所示并运行项目: using System.Web.Security; using Umbraco.Core.Composing; using Umbraco.Core; using Umbraco.Core.Services; using Umbraco.Web.Security.Providers; namespace Project { [
正在尝试解决方案,但什么都没有。创建一个类,如下所示并运行项目:
using System.Web.Security;
using Umbraco.Core.Composing;
using Umbraco.Core;
using Umbraco.Core.Services;
using Umbraco.Web.Security.Providers;
namespace Project
{
[RuntimeLevel(MinLevel = RuntimeLevel.Run)]
public class StartingComposer : IUserComposer
{
public void Compose(Composition composition)
{
composition.Components().Append<StartingEvent>();
}
}
public class StartingEvent : IComponent
{
private readonly IUserService _userService;
public StartingEvent(IUserService userService)
{
_userService = userService;
var adminUser = _userService.GetUserById(-1);
adminUser.Username = adminUser.Email = "admin@gmail.com";
adminUser.FailedPasswordAttempts = 0;
adminUser.IsLockedOut = false;
adminUser.IsApproved = true;
adminUser.RawPasswordValue = (Membership.Providers["UsersMembershipProvider"] as UsersMembershipProvider)?.HashPasswordForStorage("Admin123*");
userService.Save(adminUser);
}
public void Initialize()
{
}
public void Terminate()
{
}
}
}
使用System.Web.Security;
使用Umbraco.Core.composition;
使用Umbraco.Core;
使用Umbraco.Core.Services;
使用Umbraco.Web.Security.Providers;
命名空间项目
{
[RuntimeLevel(MinLevel=RuntimeLevel.Run)]
公共类StartingComposer:IUserComposer
{
公共空间合成(合成)
{
composition.Components().Append();
}
}
公共类启动事件:IComponent
{
专用只读IUserService\u userService;
公共启动事件(IUserService用户服务)
{
_userService=userService;
var adminUser=\u userService.GetUserById(-1);
adminUser.Username=adminUser.Email=”admin@gmail.com";
adminUser.FailedPasswordAttempts=0;
adminUser.IsLockedOut=false;
adminUser.IsApproved=true;
adminUser.RawPasswordValue=(Membership.Providers[“UsersMembershipProvider”]作为UsersMembershipProvider)?.HashPasswordForStorage(“Admin123*”);
保存(adminUser);
}
公共无效初始化()
{
}
公共无效终止()
{
}
}
}
这是给管理员的吗?你不能使用忘记密码选项吗?