项目作者: potato4d

项目描述 :
Provide basic auth your Nuxt.js application
高级语言: JavaScript
项目地址: git://github.com/potato4d/nuxt-basic-auth-module.git
创建时间: 2018-10-04T05:42:29Z
项目社区:https://github.com/potato4d/nuxt-basic-auth-module

开源协议:MIT License

下载


Nuxt.js basic auth module

code style: prettier
donate: Patreon
License: MIT
NPM version
All Contributors
NPM downloads
codecov

f2653ad0d131606c49edb3f605cbf547

Provide basic authentication to your Nuxt.js application

https://www.npmjs.com/package/nuxt-basic-auth-module

Installation

  1. $ yarn add nuxt-basic-auth-module # or npm install

Usage

Edit your nuxt.config.js

  1. export default {
  2. // ...
  3. modules: [
  4. 'nuxt-basic-auth-module'
  5. ],
  6. basic: {
  7. name: 'AUTH USER NAME HERE',
  8. pass: 'AUTH PASSWORD HERE',
  9. enabled: process.env.BASIC_ENABLED === 'true' // require boolean value(nullable)
  10. },
  11. // ...
  12. }

Arguments

enabled

  • type: Boolean
  • default: false
  • required: false

Whether to activate this module.
If false, module registration is skipped.

name

  • type: String | Function
  • required: true

Basic Auth user name.

The function passes req as an argument and must return the username as string.

pass

  • type: String | Function
  • required: true

Basic Auth user password.

The function passes req as an argument and must return the password as string.

message

  • type: String,
  • default: ‘Please enter username and password’
  • required: false

Message to be displayed during basic authentication.

match

  • type: String(regex literal) | Function
  • required: false

The target path.
This allows you to set up basic authentication that is limited to routes that match regular expression literals or where the function returns true.

The function passes req as an argument.

License

MIT

https://github.com/potato4d/nuxt-basic-auth-module/blob/master/LICENSE

Contributors

Thanks goes to these wonderful people (emoji key):








Takuma HANATANI

💻 🚧 📖 🐛

Anthony Fu

💻

Jleroy

💻

This project follows the all-contributors specification. Contributions of any kind welcome!