我使用IdentityServer3进行身份验证。用户使用AspnetIdentity框架存储。我想为用户提供重置密码功能。我想在IdentityServer托管应用程序中提供此功能。我已经阅读了几篇帖子here here here,这就是我迄今所做的:
1>我创建了从AspNetIdentityUserService
派生的自定义用户服务
2>创建resetpassword.html
并将其放在模板文件夹中。 (documentation)
3>没有必要创建CustomViewService,因此我在AuthenticationOptions中添加了LoginPageLink
,现在该链接在登录页面上可用。
4>创建ResetPasswordController
public class ResetPasswordController : Controller
{
public ActionResult Index()
{
return View();
}
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult ResetPassword(string username)
{
// call customservice here and reset password
return View();
}
}
问题
当我点击resetpassword链接时,我收到错误
视图'索引'或者没有找到它的主人或没有查看引擎 支持搜索的位置。以下地点是 搜索:〜/ Views / resetpassword / Index.aspx
〜/ Views / resetpassword / Index.ascx~ / Views / Shared / Index.aspx
〜/ Views / Shared / Index.ascx~ / Views / resetpassword / Index.cshtml
〜/ Views / resetpassword / Index.vbhtml~ / Views / Shared / Index.cshtml
〜/ Views / Shared / Index.vbhtml
我知道错误的原因,因为我们在找不到MVC框架的Views
文件夹中没有相应的视图。我的观点resetpassword.html
位于模板文件夹中。这就是混乱。身份服务器正在使用Angular
来构建其视图。
如果我决定使用angular,那么
1>如何创建并将模型传递给resetpassword.html 2>如何将CustomUserService连接到控制器。
如果我使用ASP.NET MVC那么
1>我需要在
resetpassword.cshtml
文件夹中添加Views
,在共享文件夹中添加新的Layout.cshtml
。 2>这样做MVC scafolding将添加bootstrap资源(css,js,jquery)。该版本可能与IdentityServer的嵌入式资源不匹配。 我很乐意编写ASP.NET MVC,但担心在解决方案中添加两次bootstrap资源。
这里最好和最简单的方法是什么。任何示例都将非常感谢。