nuxt-website-lock
v0.2.1
Published
Add a middleware to be able to lock pages behind a password
Downloads
30
Readme
nuxt-website-lock
Setup
- Add
nuxt-website-lock
dependency to your project
yarn add nuxt-website-lock # or npm install nuxt-website-lock
- Add
nuxt-website-lock
to themodules
section ofnuxt.config.js
{
modules: [
// Simple usage
'nuxt-website-lock',
// website-lock has to be before axios so axios instance is available at websitelock module
// to enable validation of token on BE change "enableServerValidation" to true
['nuxt-website-lock', {enableServerValidation: false, enabled: true, password: 'superSecretPassword'}],
'@nuxtjs/axios',
]
}
Module options
| Option name | Description | Default value | Possible values |
|--------------------------|---------------------------------------------------------------------------------------------------------------------------|-------------------------------|-------------------------------------------|
| enabled
| whether website lock should be enabled | default: null
| options: true
/false
|
| password
| password which unlocks website | default: null
| any string (will be simply hashed to md5) |
| formPath
| url at which the form for website lock will be | default: /website-lock
| any string starting with slash |
| enableServerValidation
| whether password should be validated against BE (tailor fitted for personal use, will be expanded upon in later versions) | default: false
| options: true
/false
|
| cookieName
| name of the cookie under which the hashed token will be stored | default: websiteLock._token
| any string, cannot be null
|
| cookie
| object storing some cookie | | |
| cookie.prefix
| prefix of cookieName
being stored | default: ''
| any string, cannot be null
|
| cookie.expires
| number of days in which the cookie will expire | default: 2
| any unsigned integer |
Todo
- [ ] better customizability
Development
- Clone this repository
- Install dependencies using
yarn install
ornpm install
- Start development server using
npm run dev
License
Copyright (c) Patrik Jánosdeák