gpt4 book ai didi

Umbraco 覆盖或扩展默认成员资格提供者

转载 作者:行者123 更新时间:2023-12-01 08:39:35 25 4
gpt4 key购买 nike

我想在 Umbraco 6.1.6 中使用不同的提供程序,例如我有这个

    <membership defaultProvider="UmbracoMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear />
<add name="UmbracoMembershipProvider" type="umbraco.providers.members.UmbracoMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Website" passwordFormat="Hashed" umbracoApprovePropertyTypeAlias="isActive" umbracoLastLoginPropertyTypeAlias="loginDate" />
<add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" />
</providers>
</membership>

但我想用这个

<membership defaultProvider="TechBureauMembershipProvider" userIsOnlineTimeWindow="15">
<providers>
<clear/>
<add name="TechBureauMembershipProvider" type="TechBureau.Web.providers.TechBureauMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Website" passwordFormat="Hashed" umbracoApprovePropertyTypeAlias="isActive" umbracoLastLoginPropertyTypeAlias="loginDate"/>
<add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false"/>
</providers>
</membership>

因为我想覆盖 ResetPassword 密码函数不做任何事情。

public class TechBureauMembershipProvider : UmbracoMembershipProvider
{
/// <summary>
/// Overriding this so that it does nothing, reseting a password to a random password isn't cool for anyone.
/// </summary>
/// <param name="username"></param>
/// <param name="answer"></param>
/// <returns></returns>
public override string ResetPassword(string username, string answer)
{
return string.Empty; //base.ResetPassword(username, answer);
}
}

但问题是,如果我这样做,“成员”选项卡不会加载。

最佳答案

David 走在正确的道路上,但我认为这里不需要反射覆盖。更改 UmbracoMembershipProvider 的类型,但名称保持不变。

        <membership defaultProvider="TechBureauMembershipProvider" userIsOnlineTimeWindow="2880">
<providers>
<clear/>
<add name="UmbracoMembershipProvider" type="TechBureau.Web.providers.TechBureauMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" defaultMemberTypeAlias="Member" passwordFormat="Hashed"/>
<add name="UsersMembershipProvider" type="umbraco.providers.UsersMembershipProvider" enablePasswordRetrieval="false" enablePasswordReset="false" requiresQuestionAndAnswer="false" passwordFormat="Hashed"/>

关于Umbraco 覆盖或扩展默认成员资格提供者,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22705072/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com