dologin
dologin
Attempts to log a user in using the given login form values (i.e. logs in the current session)
at the conclusion of which, it affects the following variables
according to success/failure of the login:
| Variable |
Type |
Description |
| logged_in | boolean | says if login was successful or not |
| login_error | string | set if login failed. gives the error message |
| user_name | string | set if login succeeded. name of the user |
| user_email | string | set set if login succeeded and there is a user email (if any) |
| user_organization | string | set if login succeeded and there is a: string name of the user's organization i.e. company |
| user_id | string | set if login succeeded. id of the user |
| user_type | string | set if login succeeded. type of the user |
| user_is_admin | boolean | set if login succeeded. true if the logged in user is an admin. false otherwise |
Don't use user_is_admin to decide weather to allow critical operations
This function sets the user_is_admin variable as a convenience for use when deciding what options to present to the user, how to display information etc.
It should Not be used to determine weather sensitive operations should be allowed. For proper security, always use the is_admin_user() function call
to make such decisions
dologin(formdata)
Parameters:
| Parameter |
Type |
Description |
| formdata |
object |
This will be the data associated with a login form. fields are username and password |
Returned Value:
| Type |
Description |
| boolean |
true if login successful, false otherwise |
Examples
my_login_form_data = get_form_values("my_login_form")
if (!dologin(my_login_form_data)) {
alert(login_error)
}