Reference Source
import Session from 'flarum/common/Session'
public class | source

Session

The Session class defines the current user session. It stores a reference to the current authenticated user, and provides methods to log in/out.

Constructor Summary

Public Constructor
public

Member Summary

Public Members
public

The CSRF token.

public

The current authenticated user.

Method Summary

Public Methods
public

login(identification: String, password: String, options: Object): Promise

Attempt to log in a user.

public

logout()

Log the user out.

Public Constructors

public constructor() source

Public Members

public csrfToken: String | null source

The CSRF token.

public user: User | null source

The current authenticated user.

Public Methods

public login(identification: String, password: String, options: Object): Promise source

Attempt to log in a user.

Params:

NameTypeAttributeDescription
identification String

The username/email.

password String
options Object
  • optional

Return:

Promise

public logout() source

Log the user out.