1.0.5 • Published 4 years ago
quasar-app-extension-vlank-auth v1.0.5
Vlank Auth
Module permettant de géré l'authentification.
Install
quasar ext add vlank-auth
Quasar CLI will retrieve it from NPM and install the extension.
Usage
Just add requieresAuth as meta on route to requiere an auth. exemple
{
path: '/',
meta: { requiresAuth: true },
component: () => import('layouts/MainLayout.vue'),
children: [
{ path: '', component: () => import('pages/Index.vue') }
]
}
Functionality
The authentication logic is performed inside a Vuex store. this.$auth
provides a helper to access the functionality in the store.
Function | Functionality |
---|---|
$auth.login(data) | Makes a POST request to the login route with data as body. Saves the returned token in a cookie |
$auth.logout() | Logs out the current user and removes the Authorixation cookie |
auth.check(right) | Checks if the user belongs to right by checking if it's included in user.rights . |
auth.checkAll(rights) | Checks if the user belongs to rights by checking if they are included in user.rights . |
auth.checkAny(rights) | Checks if the user belongs to rights by checking if one at least is included in user.rights . |
$auth.user() | Returns the current user. |
$auth.fetch() | Fetch the user belonging to the Authorization token from the backend |
$auth.updatePassword(data) | Update current User password |
$auth.updateUser(data) | Update current User informations |
Uninstall
quasar ext remove vlank-auth