Skip to content

Commit

Permalink
Merge pull request #8 from huychau/release/0.1.2
Browse files Browse the repository at this point in the history
Update README and upgrade to 0.1.2
  • Loading branch information
huychau authored May 13, 2021
2 parents e1404b1 + eb787e6 commit 5327a33
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 65 deletions.
106 changes: 43 additions & 63 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,73 +2,39 @@

[![Downloads](https://static.pepy.tech/personalized-badge/drf-registration?period=total&units=international_system&left_color=black&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/drf-registration)

User registration base on Django Rest Framework.
Simple user registration package based on Django Rest Framework. DRF Registration - The easy way to generate registration RESTful APIs.

Check the document at https://drf-registration.readthedocs.io/


## Requirements
- Django (>=2.0)
- Django REST Framework (>=3.8.2)
- Python (>=3.6)

## Features
- [x] Register
- [x] Verify/activate account by token sent to email
- [x] Login use token
- [x] Logout
- [x] User profile
- [x] Change password
- [x] Reset password

## Future Features
- [x] Login by socials (Facebook, Google)
- [x] Set password when login by social
- [x] Sync user account with socials
- [x] HTML email configuration
- [x] Test coverage (98%)

## Base APIs Design

Assuming that base resource is `/api/v1/accounts/`

### Regsiter
#### POST: `/register/`
Register new user

### Verify account
#### POST: `/verify/`
Verify account by email

### Login
#### POST: `/login/`
Login to the system use username/email and password

### Logout
#### POST: `/logout/`
Logout of the system

### Profile
#### GET: `/profile/`
Get user profile

#### PUT: `/profile/`
Update user profile

### Change password
#### PUT: `/change-password/`
Change user password
## Features
- Register
- Verify/activate account by token sent to email
- Login use token
- Logout
- User profile
- Change password
- Reset password
- Login by socials (Facebook, Google)
- Set password when login by social
- Sync user account with socials
- HTML email configuration
- Test coverage (98%)

### Set password
#### PUT: `/set-password/`
Set user password when login with social account

## Installation & Configuration
- Install by use `pip`:
Install by use `pip`:
```
pip install drf-regisration
pip install drf-registration
```

- Add `drf_registration` in `INSTALLED_APPS`
Add `drf_registration` in `INSTALLED_APPS`
```
INSTALLED_APPS = [
...
Expand All @@ -79,7 +45,7 @@ INSTALLED_APPS = [
]
```

- Include urls of `drf_registration` in `urls.py`
Include urls of `drf_registration` in `urls.py`
```
urlpatterns = [
...
Expand All @@ -88,8 +54,9 @@ urlpatterns = [
]
```


## Settings
- Set `AUTHENTICATION_BACKEND` for support login by multiple custom fields and check inactivate user when login:
Set `AUTHENTICATION_BACKEND` for support login by multiple custom fields and check inactivate user when login:

```
AUTHENTICATION_BACKENDS = [
Expand All @@ -116,31 +83,44 @@ DRF_REGISTRATION = {
}
```

Check default settings [here](https://drf-registration.readthedocs.io/en/latest/settings/index.html).


## Base APIs Design

Assuming that base resource is `/api/v1/accounts/`

- `POST: /register/`: Register new user
- `POST: /verify/`: Verify account by email
- `POST: /login/`: Login to the system use username/email and password
- `POST: /logout/`: Logout of the system
- `GET: /profile/`: Get user profile
- `PUT: /profile/`: Update user profile
- `PUT: /change-password/`: Change user password
- `PUT: /set-password/`: Set user password when login with social account

Check more APIs Design at [here](https://drf-registration.readthedocs.io/en/latest/apis.html).

## Command line

- Unit Test
Unit Test
```
make test
```
*You can add `ARGS="specific_folder/"` or `ARGS="specific_file.py"` to run specific test cases.*

- Run pylint
Run pylint
```
make pylint
```

- Build & run docs local server
Build & run docs local server
```
make docs
```
Access docs server at http://localhost:8080

- Clean
Clean
```
make clean
```

## Test coverage

![Test coverage](coverage.png)

Binary file removed coverage.png
Binary file not shown.
2 changes: 1 addition & 1 deletion drf_registration/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.1.1'
__version__ = '0.1.2'
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
name = drf-registration
author = Huy Chau
author-email = huychau.dev@gmail.com
description = User registration base on Django Rest Framework
description = Simple user registration package based on Django Rest Framework. DRF Registration - The easy way to generate registration RESTful APIs.
description-file = README.md
long-description = file:README.md
long-description-content-type = text/markdown; charset=UTF-8
Expand Down

0 comments on commit 5327a33

Please sign in to comment.