Open Closed

How To use Abp Account/Login Source Code #7573


User avatar
0
WilliamT created
  • ABP Framework version: v8.2.0
  • UI Type: MVC
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hi I want to add extra verification code input field on my login. I tried to modify the page and model using this https://github.com/abpframework/abp/blob/dev/source-code/Volo.Abp.Account.SourceCode/Volo.Abp.Account.SourceCode.zip

however i got error "ThereAreNoLoginSchemesConfiguredForThisClient"

how do i actually use this source code?


7 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I tried to modify the page and model using this https://github.com/abpframework/abp/blob/dev/source-code/Volo.Abp.Account.SourceCode/Volo.Abp.Account.SourceCode.zip

    This is open source,

    you can use suite to download the commercial module source Code

  • User Avatar
    0
    WilliamT created

    yep, got it working now.

    and how do I make the app redirect to login if the user isn't logged in?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    you can try

    public class IndexModel : ...
    {
        public ActionResult OnGet()
        {
            if (!CurrentUser.IsAuthenticated)
            {
                return Redirect("/Account/Login");
            }
    
            return Page();
        }
    }
    
    
  • User Avatar
    0
    WilliamT created

    Do I need to apply that to all pages?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    yes,

    another simple way is

    @attribute [Authorize]
    ..
    
    page code...
    
  • User Avatar
    0
    WilliamT created

    thanks,

    seems like adding the code only to Index.cshtml.cs under Pages folder seem to be applied for all subfolder as well.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    :)

Made with ❤️ on ABP v9.1.0-preview. Updated on November 11, 2024, 11:11