Git Product home page Git Product logo

hopon-web's Introduction

#Hop On ##CODES ###Error code in 400

CODE_INCORRECT_USERNAME = 0;
CODE_INCORRECT_PASSWORD = 1;
CODE_INCORRECT_DEVICE = 2;
CODE_UNVERIFIED_EMAIL = 3;
CODE_UNVERIFIED_DEVICE = 4;
CODE_UNVERIFIED_EMAIL_DEVICE = 5;
CODE_INVALID_ACCOUNT = 6;
CODE_DUPLICATE_DEVICE = 7;
CODE_INVALID_PASSWORD = 8;

###Common HTTP status

200 - Success
400 - Bad Request HTTP
401 - Unauthorized
500 - Server error

##API ###POST user/login

=> Login to app

####Header: None ####Request:

{
    username: '1234',
    password: '123456',
    device_hash
}

####Response:

  • Success: 200
{
    token: '3kj2rh3k2rhk2j3hkj42hk43h2kh4j32'
}
  • Error: 400
{
  code: (
    0: CODE_INCORRECT_USERNAME,
    1: CODE_INCORRECT_PASSWORD,
    2: CODE_INCORRECT_DEVICE,
    3: CODE_UNVERIFIED_EMAIL,
    4: CODE_UNVERIFIED_DEVICE,
    5: CODE_UNVERIFIED_EMAIL_DEVICE,
    6: CODE_INVALID_ACCOUNT
  )
}

###POST user/change-password

=> Change password

####Header: None ####Request:

{
    oldPassword: '123456',
    newPassword: '111111'
}

####Response:

  • Success: 200
change password successfully
  • Error: 400
{
  code: (
    1: CODE_INCORRECT_PASSWORD,
    8: CODE_INVALID_PASSWORD
  )
}

###POST user/reset-password

=> Request a new password

####Header: None ####Request:

{
    email: '[email protected]'
}

####Response:

  • Success: 200
reset password successfully

###POST user/signup

=> Sign up new user

####Header: None ####Request:

{
    username: '1234',
    password: '123456',
    email: '[email protected]',
    role: (10: role user, 20: role student, 30: role teacher),
    device_hash
}

####Response:

{
    token: '3kj2rh3k2rhk2j3hkj42hk43h2kh4j32'
}

###GET user/logout

=> Log out app

####Header:

Authorization: 'Bearer <token>'

####Request: None ####Response:

logout successfully

###POST user/register-device

=> Register new device for a user

####Header: None ####Request:

{
    username: '1234',
    password: '123456',
    device_hash
}

####Response:

  • Success: 200
{}
  • Error: 400
{
  code: (
    0: CODE_INCORRECT_USERNAME,
    1: CODE_INCORRECT_PASSWORD,
    6: CODE_INVALID_ACCOUNT,
    7: CODE_DUPLICATE_DEVICE
  )
}

hopon-web's People

Contributors

canhnht avatar qinjie avatar

Watchers

 avatar  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.