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.
ViewData["ReturnUrl"] = returnUrl;
ViewData["LoginProvider"] = info.LoginProvider;
ViewData["ProviderDisplayName"] = info.ProviderDisplayName;
var email = info.Principal.FindFirstValue(ClaimTypes.Email);
return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = email });
}

View File

@ -12,7 +12,7 @@
<div asp-validation-summary="All" class="text-danger"></div>
<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
logging in.
</p>

View File

@ -15,7 +15,7 @@
@for (var index = 0; index < Model.CurrentLogins.Count; index++)
{
<tr>
<td>@Model.CurrentLogins[index].LoginProvider</td>
<td>@Model.CurrentLogins[index].ProviderDisplayName²</td>
<td>
@if ((bool)ViewData["ShowRemoveButton"])
{
@ -23,7 +23,7 @@
<div>
<input asp-for="@Model.CurrentLogins[index].LoginProvider" name="LoginProvider" 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>
</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.
ViewData["ReturnUrl"] = returnUrl;
ViewData["LoginProvider"] = info.LoginProvider;
ViewData["ProviderDisplayName"] = info.ProviderDisplayName;
var email = info.Principal.FindFirstValue(ClaimTypes.Email);
return View("ExternalLoginConfirmation", new ExternalLoginConfirmationViewModel { Email = email });
}

View File

@ -4,7 +4,7 @@
}
<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">
<h4>Association Form</h4>
@ -12,7 +12,7 @@
<div asp-validation-summary="All" class="text-danger"></div>
<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
logging in.
</p>

View File

@ -15,7 +15,7 @@
@for (var index = 0; index < Model.CurrentLogins.Count; index++)
{
<tr>
<td>@Model.CurrentLogins[index].LoginProvider</td>
<td>@Model.CurrentLogins[index].ProviderDisplayName</td>
<td>
@if ((bool)ViewData["ShowRemoveButton"])
{
@ -23,7 +23,7 @@
<div>
<input asp-for="@Model.CurrentLogins[index].LoginProvider" name="LoginProvider" 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>
</form>
}

View File

@ -5,11 +5,11 @@
}
<h2>@ViewData["Title"]</h2>
<h4>Associate your @Model.LoginProvider account.</h4>
<h4>Associate your @Model.ProviderDisplayName account.</h4>
<hr />
<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
logging in.
</p>

View File

@ -20,7 +20,7 @@ namespace Microsoft.AspNetCore.Identity.UI.Pages.Account.Internal
[BindProperty]
public InputModel Input { get; set; }
public string LoginProvider { get; set; }
public string ProviderDisplayName { 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.
ReturnUrl = returnUrl;
LoginProvider = info.LoginProvider;
ProviderDisplayName = info.ProviderDisplayName;
if (info.Principal.HasClaim(c => c.Type == ClaimTypes.Email))
{
Input = new InputModel
@ -154,7 +154,7 @@ namespace Microsoft.AspNetCore.Identity.UI.Pages.Account.Internal
}
}
LoginProvider = info.LoginProvider;
ProviderDisplayName = info.ProviderDisplayName;
ReturnUrl = returnUrl;
return Page();
}

View File

@ -14,7 +14,7 @@
@foreach (var login in Model.CurrentLogins)
{
<tr>
<td>@login.LoginProvider</td>
<td>@login.ProviderDisplayName</td>
<td>
@if (Model.ShowRemoveButton)
{
@ -22,7 +22,7 @@
<div>
<input asp-for="@login.LoginProvider" name="LoginProvider" 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>
</form>
}