GithubHelp home page GithubHelp logo

zhaoguomin / abp.phonenumberlogin Goto Github PK

View Code? Open in Web Editor NEW

This project forked from easyabp/abp.phonenumberlogin

0.0 0.0 0.0 5.07 MB

An abp module to avoid duplicate user phone numbers being confirmed and providing phone number confirmation and phone number login features and more.

License: MIT License

JavaScript 1.17% C# 96.73% CSS 0.09% HTML 0.98% Smarty 1.04%

abp.phonenumberlogin's Introduction

Abp.PhoneNumberLogin

ABP version NuGet NuGet Download Discord online GitHub stars

An abp module to avoid duplicate user phone numbers being confirmed and providing phone number confirmation and phone number login features and more.

Online Demo

We have launched an online demo for this module: https://phonelogin.samples.easyabp.io

Installation

  1. Install the following NuGet packages. (see how)

    • EasyAbp.Abp.PhoneNumberLogin.Application
    • EasyAbp.Abp.PhoneNumberLogin.Application.Contracts
    • (Exclusive) EasyAbp.Abp.PhoneNumberLogin.Domain.OpenIddict
    • (Exclusive) EasyAbp.Abp.PhoneNumberLogin.Domain.Ids4
    • EasyAbp.Abp.PhoneNumberLogin.Domain.Shared
    • EasyAbp.Abp.PhoneNumberLogin.EntityFrameworkCore
    • EasyAbp.Abp.PhoneNumberLogin.HttpApi
    • EasyAbp.Abp.PhoneNumberLogin.HttpApi.Client
    • (Optional) EasyAbp.Abp.PhoneNumberLogin.MongoDB
    • (Optional) EasyAbp.Abp.PhoneNumberLogin.Web
  2. Add DependsOn(typeof(Abp.PhoneNumberLoginXxxModule)) attribute to configure the module dependencies. (see how)

  3. Add builder.ConfigureAbpPhoneNumberLogin(); to the OnModelCreating() method in MyProjectMigrationsDbContext.cs.

  4. Add EF Core migrations and update your database. See: ABP document.

  5. Specify a auth server in the appsettings.json file of the Web/Host project.

    {
      "AbpPhoneNumberLogin": {
        "AuthServer": {
          "Authority": "https://localhost:44395",
          "ClientId": "MyProjectName_App",
          "ClientSecret": "1q2w3e*"
        }
      }
    }
  6. Add the PhoneNumberLogin_credentials grant type in OpenIddictDataSeedContributor.

    grantTypes: new List<string>
    {
        OpenIddictConstants.GrantTypes.AuthorizationCode,
        OpenIddictConstants.GrantTypes.Password,
        OpenIddictConstants.GrantTypes.ClientCredentials,
        OpenIddictConstants.GrantTypes.RefreshToken,
        PhoneNumberLoginConsts.GrantType // add this grant type
    }
  7. Find these cocdes in OpenIddictDataSeedContributor

    if (grantType == OpenIddictConstants.GrantTypes.ClientCredentials)
    {
        application.Permissions.Add(OpenIddictConstants.Permissions.GrantTypes.ClientCredentials);
    }

    and add these codes on the following line

    if (grantType == WeChatMiniProgramConsts.GrantType)
    {
        application.Permissions.Add($"gt:{WeChatMiniProgramConsts.GrantType}");
    }
  8. Run the DbMigrator project to create the client. Notice that you must manually add the grant type if your client already exists.

Usage

Razor Pages Phone Number Login

Ensure the EasyAbp.Abp.PhoneNumberLogin.Web module was installed.

  1. Customize the default login page (see demo).

  2. Register an account with a confirmed phone number or confirm your phone number of your existing account.

  3. Log out and try to log in by phone number and password (or verification code).

Identity Server Token Endpoint

  • By Password

    1. Request /api/phone-number-login/account/request-token/by-password in POST method. (see input model)
  • By Verification Code

    1. Request /api/phone-number-login/account/send-verification-code in POST method to send and receive a verification code for confirming a phone number. (see input model)
    2. Request /api/phone-number-login/account/request-token/by-verification-code in POST method. (see input model)
  • Refresh a Token

    • Request /api/phone-number-login/account/refresh-token in POST method. (see input model)
    • You can also use /connect/token to refresh a token.

LoginByPhoneNumberAndPassword

Road map

  • Keep allowing users to set a phone number that has been used by others.
  • Only confirmed phone numbers are allowed to be used for login.
  • Avoid setting a non-numeric phone number.
  • Avoid setting a phone number starting with 0.
  • Avoid duplicate user phone numbers being confirmed.
  • Razor pages log in by phone number and password widget.
  • Razor pages log in by phone number and verification code widget.
  • Request token by phone number and password.
  • Request token by phone number and verification code.
  • Simply generate and send verification codes.
  • User confirm Phone number with verification code.
  • Register an account with phone number and verification code.
  • Reset password with phone number and verification code.
  • Using EasyAbp.Abp.VerificationCode module to generate verification codes.
  • Support EasyAbp integrated login module.
  • Unit tests.

abp.phonenumberlogin's People

Contributors

gdlcf88 avatar slarkerino avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.