Update default UI and samples to use provider display name

This commit is contained in:
Thomas Levesque 2018-07-30 13:57:23 +02:00 committed by Hao Kung
parent fec946759c
commit 373a9c5eb2
9 changed files with 16 additions and 16 deletions

View File

@ -196,7 +196,7 @@ namespace IdentityOIDCWebApplicationSample.Identity.Controllers
{ {
// If the user does not have an account, then ask the user to create an account. // If the user does not have an account, then ask the user to create an account.
ViewData["ReturnUrl"] = returnUrl; ViewData["ReturnUrl"] = returnUrl;
ViewData["LoginProvider"] = info.LoginProvider; ViewData["ProviderDisplayName"] = info.ProviderDisplayName;
var email = info.Principal.FindFirstValue(ClaimTypes.Email); var email = info.Principal.FindFirstValue(ClaimTypes.Email);
return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = email }); return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = email });
} }

View File

@ -12,7 +12,7 @@
<div asp-validation-summary="All" class="text-danger"></div> <div asp-validation-summary="All" class="text-danger"></div>
<p class="text-info"> <p class="text-info">
You've successfully authenticated with <strong>@ViewData["LoginProvider"]</strong>. You've successfully authenticated with <strong>@ViewData["ProviderDisplayName"]</strong>.
Please enter an email address for this site below and click the Register button to finish Please enter an email address for this site below and click the Register button to finish
logging in. logging in.
</p> </p>

View File

@ -15,7 +15,7 @@
@for (var index = 0; index < Model.CurrentLogins.Count; index++) @for (var index = 0; index < Model.CurrentLogins.Count; index++)
{ {
<tr> <tr>
<td>@Model.CurrentLogins[index].LoginProvider</td> <td>@Model.CurrentLogins[index].ProviderDisplayName²</td>
<td> <td>
@if ((bool)ViewData["ShowRemoveButton"]) @if ((bool)ViewData["ShowRemoveButton"])
{ {
@ -23,7 +23,7 @@
<div> <div>
<input asp-for="@Model.CurrentLogins[index].LoginProvider" name="LoginProvider" type="hidden" /> <input asp-for="@Model.CurrentLogins[index].LoginProvider" name="LoginProvider" type="hidden" />
<input asp-for="@Model.CurrentLogins[index].ProviderKey" name="ProviderKey" type="hidden" /> <input asp-for="@Model.CurrentLogins[index].ProviderKey" name="ProviderKey" type="hidden" />
<input type="submit" class="btn btn-default" value="Remove" title="Remove this @Model.CurrentLogins[index].LoginProvider login from your account" /> <input type="submit" class="btn btn-default" value="Remove" title="Remove this @Model.CurrentLogins[index].ProviderDisplayName login from your account" />
</div> </div>
</form> </form>
} }

View File

@ -187,7 +187,7 @@ namespace IdentitySample.Controllers
{ {
// If the user does not have an account, then ask the user to create an account. // If the user does not have an account, then ask the user to create an account.
ViewData["ReturnUrl"] = returnUrl; ViewData["ReturnUrl"] = returnUrl;
ViewData["LoginProvider"] = info.LoginProvider; ViewData["ProviderDisplayName"] = info.ProviderDisplayName;
var email = info.Principal.FindFirstValue(ClaimTypes.Email); var email = info.Principal.FindFirstValue(ClaimTypes.Email);
return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = email }); return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = email });
} }

View File

@ -4,7 +4,7 @@
} }
<h2>@ViewData["Title"].</h2> <h2>@ViewData["Title"].</h2>
<h3>Associate your @ViewData["LoginProvider"] account.</h3> <h3>Associate your @ViewData["ProviderDisplayName"] account.</h3>
<form asp-controller="Account" asp-action="ExternalLoginConfirmation" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal" role="form"> <form asp-controller="Account" asp-action="ExternalLoginConfirmation" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal" role="form">
<h4>Association Form</h4> <h4>Association Form</h4>
@ -12,7 +12,7 @@
<div asp-validation-summary="All" class="text-danger"></div> <div asp-validation-summary="All" class="text-danger"></div>
<p class="text-info"> <p class="text-info">
You've successfully authenticated with <strong>@ViewData["LoginProvider"]</strong>. You've successfully authenticated with <strong>@ViewData["ProviderDisplayName"]</strong>.
Please enter a user name for this site below and click the Register button to finish Please enter a user name for this site below and click the Register button to finish
logging in. logging in.
</p> </p>

View File

@ -15,7 +15,7 @@
@for (var index = 0; index < Model.CurrentLogins.Count; index++) @for (var index = 0; index < Model.CurrentLogins.Count; index++)
{ {
<tr> <tr>
<td>@Model.CurrentLogins[index].LoginProvider</td> <td>@Model.CurrentLogins[index].ProviderDisplayName</td>
<td> <td>
@if ((bool)ViewData["ShowRemoveButton"]) @if ((bool)ViewData["ShowRemoveButton"])
{ {
@ -23,7 +23,7 @@
<div> <div>
<input asp-for="@Model.CurrentLogins[index].LoginProvider" name="LoginProvider" type="hidden"/> <input asp-for="@Model.CurrentLogins[index].LoginProvider" name="LoginProvider" type="hidden"/>
<input asp-for="@Model.CurrentLogins[index].ProviderKey" name="ProviderKey" type="hidden"/> <input asp-for="@Model.CurrentLogins[index].ProviderKey" name="ProviderKey" type="hidden"/>
<input type="submit" class="btn btn-default" value="Remove" title="Remove this @Model.CurrentLogins[index].LoginProvider login from your account" /> <input type="submit" class="btn btn-default" value="Remove" title="Remove this @Model.CurrentLogins[index].ProviderDisplayName login from your account" />
</div> </div>
</form> </form>
} }

View File

@ -5,11 +5,11 @@
} }
<h2>@ViewData["Title"]</h2> <h2>@ViewData["Title"]</h2>
<h4>Associate your @Model.LoginProvider account.</h4> <h4>Associate your @Model.ProviderDisplayName account.</h4>
<hr /> <hr />
<p class="text-info"> <p class="text-info">
You've successfully authenticated with <strong>@Model.LoginProvider</strong>. You've successfully authenticated with <strong>@Model.ProviderDisplayName</strong>.
Please enter an email address for this site below and click the Register button to finish Please enter an email address for this site below and click the Register button to finish
logging in. logging in.
</p> </p>

View File

@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Identity.UI.Pages.Account.Internal
[BindProperty] [BindProperty]
public InputModel Input { get; set; } public InputModel Input { get; set; }
public string LoginProvider { get; set; } public string ProviderDisplayName { get; set; }
public string ReturnUrl { get; set; } public string ReturnUrl { get; set; }
@ -107,7 +107,7 @@ namespace Microsoft.AspNetCore.Identity.UI.Pages.Account.Internal
{ {
// If the user does not have an account, then ask the user to create an account. // If the user does not have an account, then ask the user to create an account.
ReturnUrl = returnUrl; ReturnUrl = returnUrl;
LoginProvider = info.LoginProvider; ProviderDisplayName = info.ProviderDisplayName;
if (info.Principal.HasClaim(c => c.Type == ClaimTypes.Email)) if (info.Principal.HasClaim(c => c.Type == ClaimTypes.Email))
{ {
Input = new InputModel Input = new InputModel
@ -154,7 +154,7 @@ namespace Microsoft.AspNetCore.Identity.UI.Pages.Account.Internal
} }
} }
LoginProvider = info.LoginProvider; ProviderDisplayName = info.ProviderDisplayName;
ReturnUrl = returnUrl; ReturnUrl = returnUrl;
return Page(); return Page();
} }

View File

@ -14,7 +14,7 @@
@foreach (var login in Model.CurrentLogins) @foreach (var login in Model.CurrentLogins)
{ {
<tr> <tr>
<td>@login.LoginProvider</td> <td>@login.ProviderDisplayName</td>
<td> <td>
@if (Model.ShowRemoveButton) @if (Model.ShowRemoveButton)
{ {
@ -22,7 +22,7 @@
<div> <div>
<input asp-for="@login.LoginProvider" name="LoginProvider" type="hidden" /> <input asp-for="@login.LoginProvider" name="LoginProvider" type="hidden" />
<input asp-for="@login.ProviderKey" name="ProviderKey" type="hidden" /> <input asp-for="@login.ProviderKey" name="ProviderKey" type="hidden" />
<button type="submit" class="btn btn-primary" title="Remove this @login.LoginProvider login from your account">Remove</button> <button type="submit" class="btn btn-primary" title="Remove this @login.ProviderDisplayName login from your account">Remove</button>
</div> </div>
</form> </form>
} }