waterlock

cycle

engine

utils

Global Instance

Waterlock exposes a global instance inside a Sails app, global.waterlock, which can be used to access various methods/properties to allow you to extend and modify waterlock on the fly. The rest of the api calls in this document are accessible through this global instance. E.g. global.waterlock.cycle
#loginSuccess(req, res, user)
handles successful logins

req

Type: Object

express request object

res

Type: Object

expresss response object

user

Type: Object

the user instance

#loginFailure(req, res, user, error)
handles login failures

req

Type: Object

express request object

res

Type: Object

expresss response object

user

Type: Object

the user instance

error

Type: Object or String

the error that caused the failure

#logout(req, res)
handles logout events

req

Type: Object

express request object

res

Type: Object

expresss response object

#findAuth(criteria, cb)
Simple wrapper for Auth find/populate method

criteria

Type: Object or String

should be id to find the auth by

cb

Type: Function(String err, Object user)

function to be called when the auth has been found or an error has occurred

#findOrCreateAuth(criteria, attributes, cb)
This will create a user and auth object if one is not found

criteria

Type: Object or String

should be id to find the auth by

attributes

Type: Object

auth attributes

cb

Type: Function(String err, Object user)

function to be called when the auth has been found or an error has occurred

#attachAuthToUser(attributes, user, cb)
Attach given auth attributes to user

attributes

Type: Object

auth attributes

user

Type: Object

user instance

cb

Type: Function(String err, Object user)

function to be called when the auth has been attached or an error has occurred

#allParams(req)
gathers all params for this request

req

Type: Object

express request object

return: Object all params