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_inbooleansays if login was successful or not
login_errorstringset if login failed. gives the error message
user_namestringset if login succeeded. name of the user
user_emailstringset set if login succeeded and there is a user email (if any)
user_organizationstringset if login succeeded and there is a: string name of the user's organization i.e. company
user_idstringset if login succeeded. id of the user
user_typestringset if login succeeded. type of the user
user_is_adminbooleanset if login succeeded. true if the logged in user is an admin. false otherwise

Format:

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)
 }