A sub-application for adding user capability to a website.
Go to file
Paul Liverman III 4d4a070abc users formsss
2016-08-01 23:48:23 -07:00
models should be drop-in-replaceable-mostly 2016-08-01 16:30:02 -07:00
.gitignore should be drop-in-replaceable-mostly 2016-08-01 16:30:02 -07:00
LICENSE Create LICENSE 2016-08-01 16:31:12 -07:00
ReadMe.md Update ReadMe.md 2016-08-01 16:33:14 -07:00
users.moon users formsss 2016-08-01 23:48:23 -07:00

Installation

  1. From application root: git submodule add https://github.com/lazuscripts/users users

  2. Inside your application: @include "users/users"

  3. In migrations, do the following:

    import create_table, types from require "lapis.db.schema"
    create_table "users", {
        {"id", types.serial primary_key: true}
        {"name", types.varchar unique: true}
        {"salt", types.text}
        {"digest", types.text}
        {"admin", types.boolean default: false}
    }
    

Note: Assumes you have a route named "index" to redirect to when things go wrong.

Config

digest_rounds = 9 must be set. Use a higher or lower number depending on how long it takes to calculate a digest or how paranoid you want to be. See this bit about tuning: https://github.com/mikejsavage/lua-bcrypt#tuning

Access

To get the Users model for use outside of this sub-application:
Users = require "users.models.Users"