skip to Main Content

I am following along the tutorial at: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/identity?view=aspnetcore-7.0&tabs=visual-studio

I would like to get rid of the "Use another service to log in." message that shows up on the Log In and Register pages.

enter image description here

All the documentation I have seen talks about adding but never removing this message.

2

Answers


  1. You need to edit the cshtml file in Areas -> Identity -> Pages -> Account -> login.cshtml

    Login or Signup to reply.
  2. You need to delete related code by yourself in ~AreasIdentityPagesAccountLogin.cshtml

    Delete this code

    <div class="col-md-6 col-md-offset-2">
            <section>
                <h3>Use another service to log in.</h3>
                <hr />
                @{
                    if ((Model.ExternalLogins?.Count ?? 0) == 0)
                    {
                        <div>
                            <p>
                                There are no external authentication services configured. See this <a href="https://go.microsoft.com/fwlink/?LinkID=532715">article
                                about setting up this ASP.NET application to support logging in via external services</a>.
                            </p>
                        </div>
                    }
                    else
                    {
                        <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>
                    }
                }
            </section>
        </div>
    

    Now the Use another service to log in section will not show in the view.

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search