Single sign on 身份服务器3密码重置

Single sign on 身份服务器3密码重置,single-sign-on,identityserver4,identityserver3,Single Sign On,Identityserver4,Identityserver3,我是Identity Server 3的新手,正在实施密码重置功能。下面是我试过的 public class AppUserService : UserServiceBase { public override Task AuthenticateLocalAsync(LocalAuthenticationContext context) { try { if (context == null) ret

我是Identity Server 3的新手,正在实施密码重置功能。下面是我试过的

public class AppUserService : UserServiceBase
{
public override Task AuthenticateLocalAsync(LocalAuthenticationContext context)
        {
            try
            {
                if (context == null) return Task.FromResult<LocalAuthenticationContext>(null);

                 if(passwordexpired)
                {
                  throw exception("Your Password is expired")
                }

                context.AuthenticateResult = new AuthenticateResult(token.ToString(), context.UserName);
            }

            catch (Exception exception)
            {
                context.AuthenticateResult = new AuthenticateResult(exception.Message);
            }
            return Task.FromResult(0);
}
-----------------------------------------------

public class CustomViewService : DefaultViewService
    {
        public CustomViewService(DefaultViewServiceOptions config, IViewLoader viewLoader)
         : base(config, viewLoader)
        {
        }

    public override Task<Stream> Login(LoginViewModel model, SignInMessage message)
    {
        if (model.ErrorMessage == "Your Password is expired.")
        {
            return base.Render(model, "resetPassword");
        }
        else
        {
            model.Custom = new
            {
                newpassword = "",
                confirmpassword = ""
            };

            return base.Login(model, message);
        }
    }
公共类AppUserService:UserServiceBase
{
公共覆盖任务AuthenticateLocalAsync(LocalAuthenticationContext)
{
尝试
{
if(context==null)返回Task.FromResult(null);
如果(密码过期)
{
抛出异常(“您的密码已过期”)
}
context.AuthenticateResult=新的AuthenticateResult(token.ToString(),context.UserName);
}
捕获(异常)
{
context.AuthenticateResult=新的AuthenticateResult(exception.Message);
}
返回Task.FromResult(0);
}
-----------------------------------------------
公共类CustomViewService:DefaultViewService
{
公共CustomViewService(默认ViewServiceOptions配置,IViewLoader viewLoader)
:base(配置,视图加载程序)
{
}
公共覆盖任务登录(LoginViewModel、SignInMessage消息)
{
如果(model.ErrorMessage==“您的密码已过期。”)
{
返回base.Render(模型“resetPassword”);
}
其他的
{
model.Custom=new
{
newpassword=“”,
confirmpassword=“”
};
返回base.Login(模型、消息);
}
}
我在Templates文件夹中创建了自定义视图“resetPassword”,以在密码过期时重置密码。我正在尝试使用模型中的自定义对象将值从CustomView传递到模型

以下是我的看法

<div class="form-group">
                            <label for="New Password">New Password</label>
                            <input required id="newpassword" name="newpassword" type="password" class="form-control" placeholder="New Password" ng-model="model.custom.newpassword" autocomplete="off" maxlength="100">
                        </div>
                        <div class="form-group">
                            <label for="Confirm Password">Confirm Password</label>
                            <input required id="confirmpassword" name="confirmpassword" type="password" class="form-control" placeholder="Confirm Password" ng-model="model.custom.confirmpassword" maxlength="100">
                        </div>

新密码
确认密码
但是model.Custom在CustomViewService(Login())中始终为空

您能否帮助找到一种将值从CustomView传递到CustomViewService(Login())模型的方法

谢谢你的帮助