Giter Site home page Giter Site logo

rbhushan90 / django-rest-framework-user-registration Goto Github PK

View Code? Open in Web Editor NEW

This project forked from beingaskar/django-rest-framework-user-registration

0.0 2.0 0.0 20 KB

A Django REST based project demonstrating the User registration, and team handling.

Python 100.00%

django-rest-framework-user-registration's Introduction

Features:

  • User registration

  • User email verification

  • Change password - with password reset email.

  • View user profile

  • Create team

  • Invite people to team

API Documentation

Postman collection : https://www.getpostman.com/collections/f803c13bd223791d1b21

i. User - Registration Create/ Register a new user.

Endpoint 	: /api/accounts/register/
Request Type 	: POST
Request Params 	: username, email, password, password_2, first_name, last_name, invite_code
Non-mandatory params : invite_code

Response Http status codes : HTTP_200_OK or HTTP_400_BAD_REQUEST

Sample Input 	: https://api.myjson.com/bins/o1id5
Sample Output 	: https://api.myjson.com/bins/v6pmh

ii. User - Email Verification Verify the email inorder to activate the user account.

User will recieve an email on successful registration with the verification_code.

Endpoint 	: /api/accounts/verify/<verification_code>/
Request Type 	: GET
Request Params 	: invite_code

Response Http status codes : HTTP_200_OK or HTTP_404_NO_CONTENT

iii. User - Login Obtain authentication token given the user credentials.

Endpoint 	: /api/accounts/login/
Request Type 	: POST
Request Params 	: email (or username) and password

Response 	: { "token": <token> }
HTTP status code: HTTP_200_OK or HTTP_400_BAD_REQUEST

iv. User - Request for Password Reset Receive an email with password reset link.

Endpoint 	: /api/accounts/password_reset/
Request Type 	: POST
Request Params 	: email
Request Sample : {"email": "[email protected]"}

HTTP status code: HTTP_200_OK

v. User - Password Change Change the password. Link as recieved from email by above request (iv).

Endpoint 	: /api/accounts/reset/<reset_code>/
Request Type 	: POST
Request Sample : {"new_password": "33441122", "new_password_2": "33441122"}

HTTP status code: HTTP_200_OK or HTTP_400_BAD_REQUEST

vi. User - Retrieve Profile Retrieve logged in users profile.

Endpoint 	: /api/accounts/user-profile/
Request Type 	: GET
Request Headers : 
	Authorization : Token <token>

HTTP status code: HTTP_200_OK or HTTP_401_UNAUTHORISED
Response Sample : https://api.myjson.com/bins/18zyux

vii. Team - Create Create a new team.

Endpoint 	: /api/teams/create/
Request Type 	: POST
Request Headers : 
	Authorization : Token <token>
Request Payload	: {"name": <team_name>, "description": <team_description>}

HTTP status code: HTTP_200_OK or HTTP_400_BAD_REQUEST or HTTP_401_UNAUTHORISED

viii. Team - Invite Invite people to join the team.

Endpoint 	: /api/teams/<team_id>/invite/
Request Type 	: POST
Request Headers : 
	Authorization : Token <token>
Request Payload	: {"emails": ["[email protected]"]}

HTTP status code: HTTP_200_OK or HTTP_400_BAD_REQUEST or HTTP_401_UNAUTHORISED

Run the project Locally

i. Clone the repository.

ii. Go to directory of manage.py and install the requirements.

pip install -r requirements.txt

Note: You may configure the virtual environment if required.

For instructions, click here : https://virtualenv.pypa.io/en/latest/installation/

iii. Create local_settings.py inside i2x_demo directory.

EMAIL_HOST_USER = '<to_be_filled>'

EMAIL_HOST_PASSWORD = '<to_be_filled>'

DEFAULT_FROM_EMAIL = '<to_be_filled>'

Note: By default, Sqlite3 database is used. You may also use different database in local_settings file if required.

iv. Run migrations

python manage.py migrate

v. Ready to run the server.

python manage.py runserver

Configuration Variables

VERIFICATION_KEY_EXPIRY_DAYS

Validity (in days) of user account activation email. Defaulted to 2

SITE_NAME

Name of Website to be displayed on outgoing emails and elsewhere. Defauled to i2x Demo

PASSWORD_MIN_LENGTH

A constraint that defines minimum length of password. Defaulted to 8

INVITATION_VALIDITY_DAYS

Validity (in days) of user team invitation email. Defaulted to 7

Try it online:

https://dry-stream-50652.herokuapp.com/

django-rest-framework-user-registration's People

Watchers

James Cloos avatar Ravi Bhushan 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.