Share via

LoginDisplay without Register

Cenk 1,051 Reputation points
2022-08-07T18:58:29.673+00:00

Hello,

Is there a way to use LoginDisplay without the Register on Mainlayout? And also I want to customize the style of the Login link.

@inherits LayoutComponentBase  
  
<PageTitle>Test</PageTitle>  
  
<div class="page">  
    <div class="sidebar @NavMenuCssClass" @onclick="ToggleNavMenu">  
        <NavMenu />  
    </div>  
  
    <main>  
        <div class="top-row px-4 auth navbar-light">  
            <div class="container-fluid toggler-container">  
                <button title="Navigation menu" class="navbar-toggler custom-toggler" @onclick="ToggleNavMenu">  
                    <span class="navbar-toggler-icon"></span>  
                </button>  
                <span class="navbar-brand mb-0 h2" href="#">  
                    <img src="/css/images/v.png" alt="" width="30" height="24" class="d-inline-block align-text-top">  
                    Test  
                </span>  
                  
            </div>   
            @*<a href="" target="" class="mb-0 h2 d-flex justify-content-end">Login</a>*@  
            <LoginDisplay />  
        </div>  
  
        <article class="content px-4">  
            @Body  
        </article>  
    </main>  
</div>  
@code {  
    private bool collapseNavMenu = true;  
  
    private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;  
  
    private void ToggleNavMenu()  
    {  
        collapseNavMenu = !collapseNavMenu;  
    }  
}  

Thanks in advance.

Developer technologies | .NET | Blazor

2 answers

Sort by: Most helpful
  1. AgaveJoe 31,361 Reputation points
    2022-08-08T19:06:37.863+00:00

    Is the problem you can't find the login markup created by the "Individual Account" template? If so, scaffold the Identity pages you wish to update.

    Scaffold Identity in ASP.NET Core projects

    Was this answer helpful?

    0 comments No comments

  2. Cenk 1,051 Reputation points
    2022-08-08T11:35:48.633+00:00

    Here is my sample, I want to customize log in.

    @inherits LayoutComponentBase  
      
    <PageTitle>Test</PageTitle>  
      
    <div class="page">  
        <div class="sidebar @NavMenuCssClass" @onclick="ToggleNavMenu">  
            <NavMenu />  
        </div>  
      
        <main>  
            <div class="top-row px-4 auth navbar-light">  
                <div class="container-fluid toggler-container">  
                    <button title="Navigation menu" class="navbar-toggler custom-toggler" @onclick="ToggleNavMenu">  
                        <span class="navbar-toggler-icon"></span>  
                    </button>  
                    <span class="navbar-brand mb-0 h2" href="#">  
                        <img src="/css/images/v.png" alt="" width="30" height="24" class="d-inline-block align-text-top">  
                        Vorlance  
                    </span>  
                      
                </div>   
                  
                <a href="Identity/Account/Login">Log in</a>  
               
            </div>  
      
            <article class="content px-4">  
                @Body  
            </article>  
        </main>  
    </div>  
    @code {  
        private bool collapseNavMenu = true;  
      
        private string? NavMenuCssClass => collapseNavMenu ? "collapse" : null;  
      
        private void ToggleNavMenu()  
        {  
            collapseNavMenu = !collapseNavMenu;  
        }  
    }  
          
      
      
    

    Was this answer helpful?

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.