AuthenticationService

This service class contains various methods for authenticating customers and related tasks.
All public functions are available in the Twig template renderer.

Namespace

IO\Services

Properties
Type Name Description

ContactAuthenticationRepositoryContract

$contactAuthRepository

The repository used for authenticating contacts

SessionStorageRepositoryContract

$sessionStorageRepository

The repository used for storing data in the session

CustomerService

$customerService

This service is used for various tasks relating to customers

string

$pluginNamespace

Methods
public __construct($contactAuthRepository, $sessionStorageRepository, $customerService)

AuthenticationService constructor.

Parameters

Type

Name

Description

ContactAuthenticationRepositoryContract

$contactAuthRepository

The repository used for authenticating contacts

SessionStorageRepositoryContract

$sessionStorageRepository

The repository used for storing data in the session

CustomerService

$customerService

This service is used for various tasks relating to customers

public login($email, $password):int

Perform the login with email and password

Parameters

Type

Name

Description

string

$email

Contains the customers email address

string

$password

Contains the password used for this login attempt

public loginWithContactId($contactId, $password)

Perform the login with customer ID and password

Parameters

Type

Name

Description

int

$contactId

Contains a id linked to a specific customer

string

$password

Contains the password used for this login attempt

public logout()

Log out the customer

public checkPassword($password):bool

Check if a password is valid. The customer is logged in as a side effect, if password is valid

Parameters

Type

Name

Description

string

$password

Contains the password

public isLoggedIn():bool

Check if the current user is logged in.