Members
session_object
Create session object for user
- Source:
Methods
(async, static) authenticate(uo) → {Promise.<(boolean|User)>}
Authenticate User
Parameters:
Name | Type | Description |
---|---|---|
uo |
user object |
- Source:
Returns:
- Type
- Promise.<(boolean|User)>
(async, static) count(where) → {Promise.<number>}
Count users in database
Parameters:
Name | Type | Description |
---|---|---|
where |
- Source:
Returns:
- Type
- Promise.<number>
(async, static) create(uo) → {Promise.<({error: string}|User)>}
Create user
Parameters:
Name | Type | Description |
---|---|---|
uo |
user object |
- Source:
Returns:
(async, static) find(where, selectopts) → {Promise.<*>}
Find users list
Parameters:
Name | Type | Description |
---|---|---|
where |
where object | |
selectopts |
select options |
- Source:
Returns:
- Type
- Promise.<*>
(async, static) findOne(where) → {Promise.<(User|*)>}
Find one user
Parameters:
Name | Type | Description |
---|---|---|
where |
where object |
- Source:
Returns:
- Type
- Promise.<(User|*)>
(async, static) findOrCreateByAttribute(k, v, uo) → {Promise.<({session_object: {_attributes: {}}, _attributes: {}}|User|*|boolean|{error: string}|User)>}
Find or Create User
Parameters:
Name | Type | Description |
---|---|---|
k |
||
v |
||
uo |
- Source:
Returns:
- Type
- Promise.<({session_object: {_attributes: {}}, _attributes: {}}|User|*|boolean|{error: string}|User)>
(static) generate_password() → {*}
Generate password
- Source:
Returns:
- Type
- *
(async, static) get_roles() → {Promise.<*>}
Get available roles
- Source:
Returns:
- Type
- Promise.<*>
(async, static) hashPassword(pw) → {Promise.<*>}
Get bcrypt hash for Password
Parameters:
Name | Type | Description |
---|---|---|
pw |
password string |
- Source:
Returns:
- Type
- Promise.<*>
(async, static) nonEmpty() → {Promise.<boolean>}
Check that user table is not empty in database
- Deprecated:
- use method count()
- Source:
Returns:
true if there are users in db
- Type
- Promise.<boolean>
(async, static) resetPasswordWithToken(email, reset_password_token, password) → {Promise.<({error: string}|{success: boolean})>}
Reset password using token
Parameters:
Name | Type | Description |
---|---|---|
email |
email address string | |
reset_password_token |
reset password token string | |
password |
- Source:
Returns:
- Type
- Promise.<({error: string}|{success: boolean})>
(static) unacceptable_password_reason(pw) → {string}
Validate password
Parameters:
Name | Type | Description |
---|---|---|
pw |
- Source:
Returns:
- Type
- string
(static) valid_email(email) → {boolean}
Validate email
Parameters:
Name | Type | Description |
---|---|---|
email |
- Source:
Returns:
- Type
- boolean
(async, static) verifyWithToken(email, verification_token) → {Promise.<({error: string}|boolean)>}
Verification with token
Parameters:
Name | Type | Description |
---|---|---|
email |
email sting | |
verification_token |
verification token string |
- Source:
Returns:
true if verification passed, error string if not
- Type
- Promise.<({error: string}|boolean)>
(async) changePasswordTo(newpw, expireToken) → {Promise.<void>}
Change password
Parameters:
Name | Type | Description |
---|---|---|
newpw |
new password string | |
expireToken |
if true than force reset password token |
- Source:
Returns:
no result
- Type
- Promise.<void>
checkPassword(pw) → {*}
Check password
Parameters:
Name | Type | Description |
---|---|---|
pw |
password string |
- Source:
Returns:
- Type
- *
(async) delete() → {Promise.<void>}
Delete user based on session object
- Source:
Returns:
- Type
- Promise.<void>
(async) getNewAPIToken() → {Promise.<(*|string)>}
Add new API token to user
- Source:
Returns:
- Type
- Promise.<(*|string)>
(async) getNewResetToken() → {Promise.<(*|string)>}
Get new reset token
- Source:
Returns:
- Type
- Promise.<(*|string)>
(async) removeAPIToken() → {Promise.<null>}
Remove API token for user
- Source:
Returns:
- Type
- Promise.<null>
(async) set_language(language) → {Promise.<void>}
Set language for User in database
Parameters:
Name | Type | Description |
---|---|---|
language |
- Source:
Returns:
- Type
- Promise.<void>
(async) update(row) → {Promise.<void>}
Update User
Parameters:
Name | Type | Description |
---|---|---|
row |
- Source:
Returns:
- Type
- Promise.<void>