Base solution for your next web application
Open Closed

Login With Extended Columns #10118


User avatar
0
billyteng created
  • 10.1.0
  • Angular
  • .net core

I'm thinking to extend columns in User Table (RoomNo,DocNo) Your default Login is (usernameORemail and Password). It check match (username column or email column) and password column in User Table. Then Login success or not result out. Now, I want to change that logic. My Login logic is (usernameOrEmail and roomnoOrdocno). It check match (username column or email column) and (roomno column or docno column) in User Table. Then Login success or not result out. Is that logic can be success? If so that, please guid me step by step. Which methods I have change? Which controller, class I have to need change? Please ......help me

At the moment, I have not extended above two columns in user table. In user table have username same multiple rows. when i login show 'Mvc.ExceptionHandling.AbpExceptionFilter - Sequence contains more than one element System.InvalidOperationException: Sequence contains more than one element'. So that i must to extend above two columns for user identity login. Is it login ok?

Thanks


4 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    You can overwrite https://github.com/aspnetboilerplate/aspnetboilerplate/blob/dev/src/Abp.ZeroCore/Authorization/AbpLoginManager.cs#L129 method in LoginManager in your project and check necessary fields.

  • User Avatar
    0
    musa.demir created

    Hi @billyteng

    As you can see in TokenAuthController, Authenticate endpoint uses (LogInManager).LoginAsync method.

    https://github.com/aspnetzero/aspnet-zero-core/blob/859a0132610e6a578ecd4857c59461008d8d5cd8/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Core/Controllers/TokenAuthController.cs#L137

    https://github.com/aspnetzero/aspnet-zero-core/blob/859a0132610e6a578ecd4857c59461008d8d5cd8/aspnet-core/src/MyCompanyName.AbpZeroTemplate.Web.Core/Controllers/TokenAuthController.cs#L751

    You should go to LogInManager.cs and override LoginAsync method with your requirements.

    Here is the original content of the LoginAsync https://github.com/aspnetboilerplate/aspnetboilerplate/blob/27387722eadd16712aee6c26a3331df885952b0c/src/Abp.Zero/Authorization/AbpLoginManager.cs#L66

  • User Avatar
    0
    billyteng created

    Hi ismcagdas , musa.demir

    Thanks for your infomation.

    Thanks

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @billyteng

    Let us know if you face any problems.