uzu-accounts-app is a generic django application tailored to Single Page Applications that abstracts user authentication and verification from the rest of your project.
Project description
uzu-account-app
This is the official API documentation for the uzu-accounts-app Django Application.
uzu-accounts-app is a generic django application tailored to Single Page Applications that abstracts user authentication and verification from the rest of your project.
uzu-accounts-app will use the model set with AUTH_USER_MODEL
in settings.py of your django project or the default user model of django.contrib.auth
Installation
Download and install the package from PyPi:
pip install uzu-accounts-app
Add AccountsApp.urls
to your project's URLConf
urlpatterns = [
...
path("accounts/", include("AccountsApp.urls"))
]
Add the AccountsApp to your INSTALLED_APPS
:
INSTALLED_APPS = [
...
"AccountsApp.apps.AccountsappConfig"
]
Setup the ACCOUNTS_APP
settings variable in settings.py
ACCOUNTS_APP = {
"base_url": "", # Base url pattern for the AccountsApp urls
"redirect_link": "", # Link redirected to after link verification
"code_length": 3, # specifies the length of the verification code
"sign_in_after_verification": False # Specify if to sign in after verification is successful
}
Then apply migrations
python manage.py migrate
API
The app communicates with the client-side using basic api calls.
API responses have the following basic format:
{
status: Boolean, // status of the API call
data: Object, // payload
error: String // error string in case an error occurs (status == False)
}
API List
NB: The illustrations below assume that the app's urls were mapped to the accounts/
path.
1. sign-in
axios.post("/accounts/sign-in/", {
...accountFields,
keep_signed_in: true // keeps the user signed in (optional)
})
2. sign-up
axios.post("/accounts/sign-up/", {
...accountFields,
keep_signed_in: true // keeps the user signed in (optional)
})
3. sign-out
axios.get("/accounts/sign-out/")
4. authenticate
axios.post("/accounts/authenticate/", {
password: ""
})
5. reset-password
axios.post("/accounts/reset-password/", {
username: "", // field value used for authentication as set by user_model.USERNAME_FIELD
code: "", // verification code. This comes from send-verification-code
new_password: "",
})
6. change-password
axios.post("/accounts/change-password/", {
new_password: "",
old_password: ""
})
7. send-verification-code
axios.post("/accounts/send-verification-code/", {
username: "", // optional username (will use request.user.username if a user is signed in when this field is not specified. Fails otherwise)
mode: "", // (send || resend) optional mode (will use 'resend' by default, if set to 'send', the verification code is updated before sending)
})
8. send-verification-link
axios.post("/accounts/send-verification-link/", {
username: "", // optional username (will use request.user.username if a user is signed in when this field is not specified. Fails otherwise)
mode: "", // (send || resend) optional mode (will use 'resend' by default, if set to 'send', the verification code is updated before sending)
})
9. verify-code
axios.post("/accounts/verify-code/", {
username: "",
code: "",
})
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file uzu-accounts-app-1.1.6.tar.gz
.
File metadata
- Download URL: uzu-accounts-app-1.1.6.tar.gz
- Upload date:
- Size: 8.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/42.0.2 requests-toolbelt/0.9.1 tqdm/4.40.2 CPython/3.6.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
45381961c4586d80dec13fdef17f8f3e539857b032179ad8dd60d0bdbf8f3c37
|
|
MD5 |
32cfab1518757dcabb4cbba297627439
|
|
BLAKE2b-256 |
cb82fc03d589867cb9a5260687e29e84c96e11b3db064811544abaf5a2a65cbc
|