Is possible to have the buttons "External Registration" placed inside .razor page (server side)?
The below code is from ExternalRegister.cshtml but I would like to have that two registration buttons (Google, Facebook) as part of the Start.razor page. Is that possible?
@model Aplication.Areas.Identity.Pages.Account.ExternalRegisterModel
<form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post" class="form-horizontal">
<div>
<p>
@foreach (var provider in Model.ExternalLogins)
{
<button type="submit" class="btn btn-primary" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">@provider.DisplayName</button>
}
</p>
</div>
</form>
I think the best strategy is to define two OnPost method in your Razor PageModel (Code-Behind). For example:
public void OnPostFaceBook(ExternalLogin provider)
{
//your code here
}
public void OnPostGoogle(ExternalLogin provider)
{
//your code here
}
And in your .cshtml file place two separate form for each one, and add parameter asp-page-handler to each submit button. For example:
<button type="submit" class="btn btn-primary" value="FaceBook" value="FaceBook" asp-page-handler="FaceBook">Log in using your FaceBook account</button>
and in other form:
<button type="submit" class="btn btn-primary" value="Google" value="Google" asp-page-handler="Google">Log in using your Google account</button>