如何自定义 AspNetCore 3.x 身份视图?
How To Customize AspNetCore 3.x Identity Views?
我正在使用脚手架身份开发 AspNetCore 3.1 应用程序。我成功地使用了外部身份提供者,我可以使用我自己的样式自定义 Login.cshtml
和 Register.cshtml
,我现在想做的是更改下面的图片页面以适合我的样式,但我找不到视图在哪里,我知道 aspnet core 3.x 身份不再是 mvc 模式,并且代码在所有剃须刀页面内,但我找不到产生所示元素的任何视图或操作。如果是这个原因,请帮助并原谅我对剃刀页面的无知:)。谢谢!
我要自定义的视图:
我的身份文件:
I am aware that aspnet core 3.x identity is not an mvc patterned anymore and that the code is inside all razor pages but I couldn't find any view or action that produce the shown elements.
ASP.NET Core Identity 在 ASP.NET Core 中作为 Razor Class 库提供。包含 Identity 的应用程序可以 apply the scaffolder 选择性地添加包含在 Identity Razor Class 库 (RCL) 中的源代码。
what I want to do now is changing the pictured page below to fit my styling but I couldn't find where the view is.
要实现您的要求,您可以添加和覆盖 Account\ExternalLogin
,如下所示。
而ExternalLogin.cshtml
的内容与下图相同,您可以根据自己的实际需求,自定义您想要的样式。
@page
@model ExternalLoginModel
@{
ViewData["Title"] = "Register";
}
<h1>@ViewData["Title"]</h1>
<h4>Associate your @Model.LoginProvider account.</h4>
<hr />
<p class="text-info">
You've successfully authenticated with <strong>@Model.LoginProvider</strong>.
Please enter an email address for this site below and click the Register button to finish
logging in.
</p>
<div class="row">
<div class="col-md-4">
<form asp-page-handler="Confirmation" asp-route-returnUrl="@Model.ReturnUrl" method="post">
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-primary">Register</button>
</form>
</div>
</div>
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}
我正在使用脚手架身份开发 AspNetCore 3.1 应用程序。我成功地使用了外部身份提供者,我可以使用我自己的样式自定义 Login.cshtml
和 Register.cshtml
,我现在想做的是更改下面的图片页面以适合我的样式,但我找不到视图在哪里,我知道 aspnet core 3.x 身份不再是 mvc 模式,并且代码在所有剃须刀页面内,但我找不到产生所示元素的任何视图或操作。如果是这个原因,请帮助并原谅我对剃刀页面的无知:)。谢谢!
我要自定义的视图:
我的身份文件:
I am aware that aspnet core 3.x identity is not an mvc patterned anymore and that the code is inside all razor pages but I couldn't find any view or action that produce the shown elements.
ASP.NET Core Identity 在 ASP.NET Core 中作为 Razor Class 库提供。包含 Identity 的应用程序可以 apply the scaffolder 选择性地添加包含在 Identity Razor Class 库 (RCL) 中的源代码。
what I want to do now is changing the pictured page below to fit my styling but I couldn't find where the view is.
要实现您的要求,您可以添加和覆盖 Account\ExternalLogin
,如下所示。
而ExternalLogin.cshtml
的内容与下图相同,您可以根据自己的实际需求,自定义您想要的样式。
@page
@model ExternalLoginModel
@{
ViewData["Title"] = "Register";
}
<h1>@ViewData["Title"]</h1>
<h4>Associate your @Model.LoginProvider account.</h4>
<hr />
<p class="text-info">
You've successfully authenticated with <strong>@Model.LoginProvider</strong>.
Please enter an email address for this site below and click the Register button to finish
logging in.
</p>
<div class="row">
<div class="col-md-4">
<form asp-page-handler="Confirmation" asp-route-returnUrl="@Model.ReturnUrl" method="post">
<div asp-validation-summary="All" class="text-danger"></div>
<div class="form-group">
<label asp-for="Input.Email"></label>
<input asp-for="Input.Email" class="form-control" />
<span asp-validation-for="Input.Email" class="text-danger"></span>
</div>
<button type="submit" class="btn btn-primary">Register</button>
</form>
</div>
</div>
@section Scripts {
<partial name="_ValidationScriptsPartial" />
}