Wt: Wt::Auth::Login Class Reference

Wt 3.3.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions
Wt::Auth::Login Class Reference
Authentication module (Wt::Auth)

A class that manages the current login state. More...

`#include <Wt/Auth/Login>`

Inheritance diagram for Wt::Auth::Login:
[legend]

List of all members.

## Public Member Functions
| Login ()
| Default constructor.
void | login (const User &user, LoginState state=StrongLogin)
| Logs a user in.
void | logout ()
| Logs the current user out.
LoginState | state () const
| Returns the current login state.
bool | loggedIn () const
| Returns whether a user has successfully logged in.
const User & | user () const
| Returns the user currently identified.
Signal & | changed ()
| Signal that indicates login changes.

## Detailed Description

A class that manages the current login state.

This is a model class which is typically associated with a single session, for the duration of the session.

Widgets that implement authentication (and thus produce authentication changes), will indicate their result in this object using the login() or logout() methods.

Widgets that want to react to login state changes (typically, as user logging in or out) should listen to the changed() signal of this object.

See also:
  AuthWidget

## Constructor & Destructor Documentation

Wt::Auth::Login::Login | ( |  | ) |

Default constructor.

Creates a login object in the LoggedOut state.

## Member Function Documentation

Signal& Wt::Auth::Login::changed | ( |  | ) |

Signal that indicates login changes.

This signal is emitted as a result of login() or logout().

bool Wt::Auth::Login::loggedIn | ( |  | ) | const

Returns whether a user has successfully logged in.

This returns `true` only if the state is WeakLogin or StrongLogin.

See also:
  state()

void Wt::Auth::Login::login | ( | const User & | user,
|  | LoginState | state = `StrongLogin`
| ) |  |

Logs a user in.

A user can be logged in using either a DisabledLogin, WeakLogin or StrongLogin `state`. The login state is forced to DisabledLogin if User::status() returns Disabled.

See also:
  logout(), loggedIn()

void Wt::Auth::Login::logout | ( |  | ) |

Logs the current user out.

Sets the state to LoggedOut.

LoginState Wt::Auth::Login::state | ( |  | ) | const

Returns the current login state.

See also:
  login(), logout()

const User & Wt::Auth::Login::user | ( |  | ) | const

Returns the user currently identified.

Returns the user currently identified.

Note:
  This may also be a user whose account is currently disabled.

All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator