Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields
AccountManagementInterface Interface Reference
Inheritance diagram for AccountManagementInterface:
AccountManagement

Public Member Functions

 createAccount (\Magento\Customer\Api\Data\CustomerInterface $customer, $password=null, $redirectUrl='')
 
 createAccountWithPasswordHash (\Magento\Customer\Api\Data\CustomerInterface $customer, $hash, $redirectUrl='')
 
 validate (\Magento\Customer\Api\Data\CustomerInterface $customer)
 
 isReadonly ($customerId)
 
 activate ($email, $confirmationKey)
 
 activateById ($customerId, $confirmationKey)
 
 authenticate ($email, $password)
 
 changePassword ($email, $currentPassword, $newPassword)
 
 changePasswordById ($customerId, $currentPassword, $newPassword)
 
 initiatePasswordReset ($email, $template, $websiteId=null)
 
 resetPassword ($email, $resetToken, $newPassword)
 
 validateResetPasswordLinkToken ($customerId, $resetPasswordLinkToken)
 
 getConfirmationStatus ($customerId)
 
 resendConfirmation ($email, $websiteId, $redirectUrl='')
 
 isEmailAvailable ($customerEmail, $websiteId=null)
 
 isCustomerInStore ($customerWebsiteId, $storeId)
 
 getDefaultBillingAddress ($customerId)
 
 getDefaultShippingAddress ($customerId)
 
 getPasswordHash ($password)
 

Data Fields

const ACCOUNT_CONFIRMED = 'account_confirmed'
 
const ACCOUNT_CONFIRMATION_REQUIRED = 'account_confirmation_required'
 
const ACCOUNT_CONFIRMATION_NOT_REQUIRED = 'account_confirmation_not_required'
 
const MAX_PASSWORD_LENGTH = 256
 

Detailed Description

Interface for managing customers accounts. @api

Since
100.0.2

Definition at line 17 of file AccountManagementInterface.php.

Member Function Documentation

◆ activate()

activate (   $email,
  $confirmationKey 
)

Activate a customer account using a key that was sent in a confirmation email.

Parameters
string$email
string$confirmationKey
Returns
\Magento\Customer\Api\Data\CustomerInterface
Exceptions

Implemented in AccountManagement.

◆ activateById()

activateById (   $customerId,
  $confirmationKey 
)

Activate a customer account using a key that was sent in a confirmation email.

@api

Parameters
int$customerId
string$confirmationKey
Returns
\Magento\Customer\Api\Data\CustomerInterface
Exceptions

Implemented in AccountManagement.

◆ authenticate()

authenticate (   $email,
  $password 
)

Authenticate a customer by username and password

Parameters
string$email
string$password
Returns
\Magento\Customer\Api\Data\CustomerInterface
Exceptions

Implemented in AccountManagement.

◆ changePassword()

changePassword (   $email,
  $currentPassword,
  $newPassword 
)

Change customer password.

Parameters
string$email
string$currentPassword
string$newPassword
Returns
bool true on success
Exceptions

Implemented in AccountManagement.

◆ changePasswordById()

changePasswordById (   $customerId,
  $currentPassword,
  $newPassword 
)

Change customer password.

Parameters
int$customerId
string$currentPassword
string$newPassword
Returns
bool true on success
Exceptions

Implemented in AccountManagement.

◆ createAccount()

createAccount ( \Magento\Customer\Api\Data\CustomerInterface  $customer,
  $password = null,
  $redirectUrl = '' 
)

#- Create customer account. Perform necessary business operations like sending email.

Parameters
\Magento\Customer\Api\Data\CustomerInterface$customer
string$password
string$redirectUrl
Returns
\Magento\Customer\Api\Data\CustomerInterface
Exceptions

◆ createAccountWithPasswordHash()

createAccountWithPasswordHash ( \Magento\Customer\Api\Data\CustomerInterface  $customer,
  $hash,
  $redirectUrl = '' 
)

Create customer account using provided hashed password. Should not be exposed as a webapi.

@api

Parameters
\Magento\Customer\Api\Data\CustomerInterface$customer
string$hashPassword hash that we can save directly
string$redirectUrlURL fed to welcome email templates. Can be used by templates to, for example, direct the customer to a product they were looking at after pressing confirmation link.
Returns
\Magento\Customer\Api\Data\CustomerInterface
Exceptions

◆ getConfirmationStatus()

getConfirmationStatus (   $customerId)

Gets the account confirmation status.

Parameters
int$customerId
Returns
string
Exceptions

Implemented in AccountManagement.

◆ getDefaultBillingAddress()

getDefaultBillingAddress (   $customerId)

Retrieve default billing address for the given customerId.

Parameters
int$customerId
Returns
\Magento\Customer\Api\Data\AddressInterface
Exceptions

Implemented in AccountManagement.

◆ getDefaultShippingAddress()

getDefaultShippingAddress (   $customerId)

Retrieve default shipping address for the given customerId.

Parameters
int$customerId
Returns
\Magento\Customer\Api\Data\AddressInterface
Exceptions

Implemented in AccountManagement.

◆ getPasswordHash()

getPasswordHash (   $password)

Return hashed password, which can be directly saved to database.

Parameters
string$password
Returns
string

Implemented in AccountManagement.

◆ initiatePasswordReset()

initiatePasswordReset (   $email,
  $template,
  $websiteId = null 
)

Send an email to the customer with a password reset link.

Parameters
string$email
string$template
int$websiteId
Returns
bool true on success
Exceptions

Implemented in AccountManagement.

◆ isCustomerInStore()

isCustomerInStore (   $customerWebsiteId,
  $storeId 
)

Check store availability for customer given the customerId.

Parameters
int$customerWebsiteId
int$storeId
Returns
bool
Exceptions

Implemented in AccountManagement.

◆ isEmailAvailable()

isEmailAvailable (   $customerEmail,
  $websiteId = null 
)

Check if given email is associated with a customer account in given website.

Parameters
string$customerEmail
int$websiteIdIf not set, will use the current websiteId
Returns
bool
Exceptions

Implemented in AccountManagement.

◆ isReadonly()

isReadonly (   $customerId)

Check if customer can be deleted.

@api

Parameters
int$customerId
Returns
bool
Exceptions

Implemented in AccountManagement.

◆ resendConfirmation()

resendConfirmation (   $email,
  $websiteId,
  $redirectUrl = '' 
)

Resend confirmation email.

Parameters
string$email
int$websiteId
string$redirectUrl
Returns
bool true on success
Exceptions

Implemented in AccountManagement.

◆ resetPassword()

resetPassword (   $email,
  $resetToken,
  $newPassword 
)

Reset customer password.

Parameters
string$emailIf empty value given then the customer will be matched by the RP token.
string$resetToken
string$newPassword
Returns
bool true on success
Exceptions

Implemented in AccountManagement.

◆ validate()

Validate customer data.

Parameters
\Magento\Customer\Api\Data\CustomerInterface$customer
Returns
\Magento\Customer\Api\Data\ValidationResultsInterface
Exceptions

◆ validateResetPasswordLinkToken()

validateResetPasswordLinkToken (   $customerId,
  $resetPasswordLinkToken 
)

Check if password reset token is valid.

Parameters
int$customerIdIf null is given then a customer will be matched by the RP token.
string$resetPasswordLinkToken
Returns
bool True if the token is valid
Exceptions

Implemented in AccountManagement.

Field Documentation

◆ ACCOUNT_CONFIRMATION_NOT_REQUIRED

const ACCOUNT_CONFIRMATION_NOT_REQUIRED = 'account_confirmation_not_required'

Definition at line 24 of file AccountManagementInterface.php.

◆ ACCOUNT_CONFIRMATION_REQUIRED

const ACCOUNT_CONFIRMATION_REQUIRED = 'account_confirmation_required'

Definition at line 23 of file AccountManagementInterface.php.

◆ ACCOUNT_CONFIRMED

const ACCOUNT_CONFIRMED = 'account_confirmed'

#+ Constant for confirmation status

Definition at line 22 of file AccountManagementInterface.php.

◆ MAX_PASSWORD_LENGTH

const MAX_PASSWORD_LENGTH = 256

Definition at line 25 of file AccountManagementInterface.php.


The documentation for this interface was generated from the following file: