> For the complete documentation index, see [llms.txt](https://cherrycake.tin.cat/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://cherrycake.tin.cat/version-0.x/reference/core-modules/login/login-methods.md).

# Login methods

## doLogin( userName, password ) <a href="#dologin" id="dologin"></a>

Checks the given credentials in the database, and logs in the user if they're found to be correct.

* **`userName`** The string field that uniquely identifies the user on the database, the one used by the user to login. Usually, an email or a username.
* **`password`** The password entered by the user to login.

**Returns:** One of the available [`LOGIN_RESULT_?`](/version-0.x/reference/core-modules/login.md#constants) constants signifying the result of the login operation.

## encryptPassword( password ) <a href="#encryptpassword" id="encryptpassword"></a>

Encrypts the given password with the configured password encryption method.

* **`password`** The password to encrypt

**Returns:** The encrypted string, or false if the password could not be encrypted

## isLogged

Checks whether there is a logged user or not.

**Returns:** True if the current user is logged or false if it's not.

## logoutUser

Logs out the current user.

**Returns:** One of the available [`LOGOUT_RESULT_?`](/version-0.x/reference/core-modules/login.md#constants) constants signifying the result of the logout operation.
