0.3.0 • Published 7 years ago

ceri-login-modal v0.3.0

Weekly downloads
3
License
MIT
Repository
github
Last release
7 years ago

ceri-login-modal

A simple, themed login-modal

Demo

Install

npm install --save-dev ceri-login-modal ceri-toaster ceri-progress ceri-modal ceri-icon

Usage

LoginModal = require("ceri-login-modal")
# load the theme (see below)
loginModal = LoginModal(
  require("ceri-login-modal/materialize"), #theme
  { # optional localization
    header: "Login"
    name: "Username"
    pw: "Password"
    button: "login"
    error: "Login failed"
    timeout: "Login failed"
  }
  )
# setup your login validation
loginModal.login = (name, pw, cb) ->
  # check login
  # call cb with the result/false for success/failed

loginModal.timeout = 2000 # change the timeout
# To open
loginModal.open((result) ->
  # result will be result from login function above
  # or false if modal got closed without proper login
)

Using Promises

# Provide your Promise constructor
LoginModal.Promise = Promise # if you have polyfilled Promise
# your login function must return a promise
loginModal.login = (name, pw) ->
  return new Promise((resolve,reject) ->
    # check login
    # if success
    resolve(result)
    # if failed
    reject()
  )
# open will return a promise
loginModal.open().then((result)->
  # login success
  # result equals result from login function
).catch(->
  # abort by user
)

Themes

Materialize

loginModal = LoginModal(require("ceri-login-modal/materialize"))

For example see dev/materialize.

Development

Clone repository.

npm install
npm run dev

Browse to http://localhost:8080/.

Notable changes

0.3.0

  • use ceri-materialize@2

License

Copyright (c) 2017 Paul Pflugradt Licensed under the MIT license.

0.3.0

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago