> ## Documentation Index
> Fetch the complete documentation index at: https://dokumentation.websale.de/llms.txt
> Use this file to discover all available pages before exploring further.

# Account

> Actions for customer accounts: create accounts and addresses, change login data and passwords, and manage B2B employee accounts and permission groups.

This section describes the available actions in the customer account area. With these actions, accounts can be created, addresses managed, and login credentials changed, for example.

***

## Actions overview

| **Action**                     | **Description**                                                                           |
| ------------------------------ | ----------------------------------------------------------------------------------------- |
| `AccountRegister`              | Creates a new customer account.                                                           |
| `AccountActivate`              | Activates an existing customer account via an email address.                              |
| `AccountActivateOptIn`         | Activates an existing customer account via opt-in token.                                  |
| `AccountDelete`                | Deletes the account of the logged-in user.                                                |
| `AccountDeleteOptIn`           | Confirms the deletion of a customer account via opt-in token.                             |
| `SubAccountCreate`             | Creates a new employee account and sends an email with the link for setting the password. |
| `AcceptInvitation`             | Accepts an invitation to a customer account via opt-in token.                             |
| `UnlockLogin`                  | Unlocks a locked login access.                                                            |
| `Login`                        | Logs in a user.                                                                           |
| `Logout`                       | Logs out a logged-in user.                                                                |
| `PasswordForgotten`            | Sends a password-forgotten email.                                                         |
| `ResetPassword`                | Resets the password of a user account.                                                    |
| `EmailUpdate`                  | Changes the stored email address of a user account.                                       |
| `EMailUpdateOptIn`             | Confirms the change of the email address via opt-in token.                                |
| `EmailVerify`                  | Verifies an email address via double opt-in.                                              |
| `AddressCreate`                | Creates a new address for the logged-in user.                                             |
| `AddressUpdate`                | Edits an existing address of the logged-in user.                                          |
| `AddressDelete`                | Deletes an address of the logged-in user.                                                 |
| `SetMainAddress`               | Sets an address as the main address.                                                      |
| `SetDefaultBillAddress`        | Sets an address as the default billing address.                                           |
| `SetDefaultDeliveryAddress`    | Sets an address as the default shipping address.                                          |
| `RemoveDefaultBillAddress`     | Removes the set default billing address.                                                  |
| `RemoveDefaultDeliveryAddress` | Removes the set default shipping address.                                                 |
| `CreditCardDelete`             | Deletes a saved credit card from the customer account.                                    |
| `CheckPasswordStrength`        | Checks the strength of an entered password in real time via AJAX.                         |
| `SaveGuestDataToUser`          | Creates a fully-fledged customer account from a guest checkout.                           |
| `SubAccountDelete`             | Deletes an existing employee account.                                                     |
| `UpdateSubAccount`             | Updates the settings of an employee account.                                              |
| `UpdatePrivileges`             | Creates or updates a privilege group with defined rights.                                 |
| `CreatePrivilegeGroup`         | Creates a new privilege group.                                                            |
| `DeletePrivilegeGroup`         | Deletes an existing privilege group.                                                      |

***

## Actions

### AccountRegister

This action creates a new customer account. The user specifies their email address and a password.

**Usage example**\
Can be used on a registration page where new customers can create an account, e.g., to view their order history or manage addresses.

**Parameters**

| **Name**         | **Description**                                                |
| ---------------- | -------------------------------------------------------------- |
| `email`          | Identifier of the user account (the email address by default). |
| `password`       | Password of the user account.                                  |
| `passwordRepeat` | Repeated entry of the password — must match `password`.        |

**Error codes**

| **Code**               | **Description**                                               |
| ---------------------- | ------------------------------------------------------------- |
| `missingId`            | Parameter `id` is empty.                                      |
| `missingPassword`      | Parameter `password` is empty.                                |
| `passwordMismatch`     | Parameters `password` and `passwordRepeat` are not identical. |
| `emailCheckFailed`     | Parameter `id` contains an invalid email address.             |
| `passwordCheckFailed`  | Password does not meet the required guidelines.               |
| `accountAlreadyExists` | An account with the given `id` already exists.                |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how the action is created and embedded in a form.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionAccountRegister = $wsActions.create("AccountRegister") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $cActionAccountRegister.id }}">
    <input type="hidden" name="wscsrf" value="{{= $cActionAccountRegister.csrf }}">

    <input type="email" name="email">
    <input type="password" name="password">
    <input type="password" name="passwordRepeat">

    <button type="submit">Register</button>
</form>
```

***

### AccountActivate

This action activates an existing customer account. The action is typically triggered via a form.

**Usage example**\
Can be used on the confirmation page where the customer enters their email address to activate their account.

**Parameters**

| **Name** | **Description**                                                |
| -------- | -------------------------------------------------------------- |
| `id`     | Identifier of the user account (the email address by default). |

**Error codes**

| **Error code**         | **Description**                                       |
| ---------------------- | ----------------------------------------------------- |
| `missingId`            | Parameter `id` is empty.                              |
| `emailCheckFailed`     | Parameter `id` contains an invalid email address.     |
| `accountAlreadyExists` | An active account with the given `id` already exists. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isAccountVerified](/en/frontend/referenz/module/wsAccount#%24wsaccount-isaccountverified)

**Example** showing how the action is created and embedded in a form through which the customer activates their account with their email address.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionAccountActivate = $wsActions.create("AccountActivate") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $cActionAccountActivate.id }}">
    <input type="hidden" name="wscsrf" value="{{= $cActionAccountActivate.csrf }}">
    <input type="email" name="id">
    <button type="submit">Activate account</button>
</form>
```

***

### AccountActivateOptIn

This action activates an existing customer account via an opt-in token. The token is transmitted to the user via a link in a confirmation email.

**Usage example**\
Can be used on the confirmation page to which the customer is redirected after clicking the opt-in link in the registration email.

**Error codes**

| **Error code** | **Description**                   |
| -------------- | --------------------------------- |
| `unauthorized` | No valid opt-in token was passed. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isAccountVerified](/en/frontend/referenz/module/wsAccount#%24wsaccount-isaccountverified)

**Example** showing how a confirmation message is displayed after successful execution of the action.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ if $wsActions.current.name == "AccountActivateOptIn" and $wsActions.current.success }}
    <div class="alert alert-info">Account was activated.</div>
{{ /if }}
```

***

### AccountDelete

This action permanently deletes the account of the currently logged-in user.

**Usage example**\
Can be used on an account management page where logged-in customers can delete their own account if desired.

**Error codes**

| **Code**        | **Description**            |
| --------------- | -------------------------- |
| **notLoggedIn** | The user is not logged in. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how the action is created and triggered via a confirmation button.

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionAccountDelete = $wsActions.create("AccountDelete") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $cActionAccountDelete.id }}">
    <input type="hidden" name="wscsrf" value="{{= $cActionAccountDelete.csrf }}">

    <button type="submit">Delete account</button>
</form>
```

***

### AccountDeleteOptIn

This action confirms the deletion of a customer account via an opt-in token. The token is transmitted to the user via a link in a confirmation email.

**Usage example**\
Can be used on the confirmation page to which the customer is redirected after clicking the opt-in link in the deletion email.

**Error codes**

| **Error code** | **Description**                   |
| -------------- | --------------------------------- |
| `unauthorized` | No valid opt-in token was passed. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how a confirmation message is displayed after successful execution of the action.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ if $wsActions.current.name == "AccountDeleteOptIn" and $wsActions.current.success }}
    <div class="alert alert-info">Account was deleted.</div>
{{ /if }}
```

***

### SubAccountCreate

This action creates a new employee account. An [email](https://dokumentation.websale.de/konfiguration/b2b-business-to-business-b2b#b2b-userinvitation-benutzereinladung) containing a link to set the password is automatically sent to the specified email address. Admin rights are required for this action.

**Usage example**\
Can be used on the account management page where administrators can create new employee accounts.

**Parameters**

| **Name** | **Description**                                                                                        |
| -------- | ------------------------------------------------------------------------------------------------------ |
| `email`  | Email address of the new employee account. <br />The link to set the password is sent to this address. |

**Error codes**

| **Error code**         | **Description**                                         |
| ---------------------- | ------------------------------------------------------- |
| `notLoggedIn`          | The user is not logged in.                              |
| `unauthorized`         | The user does not have admin rights.                    |
| `missingId`            | Parameter `email` is empty.                             |
| `emailCheckFailed`     | Parameter `email` contains an invalid email address.    |
| `accountAlreadyExists` | An account with the given email address already exists. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how the action is created and embedded in a form through which a new employee account can be created.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionSubAccountCreate = $wsActions.create("SubAccountCreate") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionSubAccountCreate.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionSubAccountCreate.csrf }}">
    <input type="email" name="email">
    <button type="submit">Create employee account</button>
</form>
```

***

### SubAccountDelete

This action deletes an existing employee account. Your own account as well as accounts with admin rights cannot be deleted. Admin rights are required for this action.

**Usage example**\
Can be used on the employee management page where administrators can remove employee accounts that are no longer needed.

**Parameters**

| Name       | Description                                   |
| ---------- | --------------------------------------------- |
| `memberId` | The ID of the employee account to be deleted. |

**Error codes**

| Error code           | Description                                                                                  |
| -------------------- | -------------------------------------------------------------------------------------------- |
| `notLoggedIn`        | The user is not logged in.                                                                   |
| `unauthorized`       | The user does not have admin rights.                                                         |
| `missingMemberId`    | Parameter `memberId` is missing.                                                             |
| `invalidMemberId`    | Invalid `memberId` — the employee account does not exist or does not belong to this account. |
| `deletionNotAllowed` | The account may not be deleted because it is your own account or an admin account.           |

**Related modules, variables & methods**

* [\$wsAccount](https://dokumentation.websale.de/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](https://dokumentation.websale.de/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how an employee account is deleted by its ID.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionSubAccountDelete = $wsActions.create("SubAccountDelete") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionSubAccountDelete.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionSubAccountDelete.csrf }}">
    <input type="hidden" name="memberId" value="{{= $myMember.id }}">
    <button type="submit">Delete employee account.</button>
</form>
```

***

### UpdateSubAccount

This action updates the settings of an existing employee account. Deactivating your own account or removing admin rights from it is not possible. Admin rights are required for this action.

**Usage example**\
Can be used on the employee management page where administrators can adjust roles and other settings of employee accounts.

**Parameters**

| Name                       | Description                                                                                                                                                                                                                                                 |
| -------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `memberId`                 | The ID of the employee account to be updated.                                                                                                                                                                                                               |
| `displayName`              | Display name of the employee account.                                                                                                                                                                                                                       |
| `active`                   | Indicates whether the employee account is allowed to log in (`true` / `false`).<br />Your own account cannot be deactivated.                                                                                                                                |
| `admin`                    | Indicates whether the account has admin rights (`true` / `false`).<br />Admin rights cannot be removed from your own account.                                                                                                                               |
| `privilegeGroupId`         | ID of the privilege group assigned to the employee account.                                                                                                                                                                                                 |
| `defaultAddressVisibility` | Specifies which visibility is preselected by default when creating new addresses.<br />Possible values:<br />- `private` (only visible for this account)<br />- `shared` (shared company-wide)                                                              |
| `allowedSubshops`          | Specifies which subshops the employee account has access to. <br />The [subshop IDs](https://dokumentation.websale.de/frontend/referenz/module/wssubshop#\$wssubshop-subshops) are passed as keys of a JSON object, e.g., `{"shop1": true, "shop2": true}.` |

**Error codes**

| Error code                 | Description                                                                                  |
| -------------------------- | -------------------------------------------------------------------------------------------- |
| notLoggedIn                | The user is not logged in.                                                                   |
| unauthorized               | The user does not have admin rights.                                                         |
| missingMemberId            | Parameter `memberId` is missing.                                                             |
| invalidMemberId            | Invalid `memberId` — the employee account does not exist or does not belong to this account. |
| selfDeactivationNotAllowed | Your own account cannot be deactivated.                                                      |
| selfAdminRemovalNotallowed | Admin rights cannot be removed from your own account.                                        |

**Related modules, variables & methods**

* [\$wsAccount](https://dokumentation.websale.de/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](https://dokumentation.websale.de/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)
* [\$wsSubshop.subshops](https://dokumentation.websale.de/frontend/referenz/module/wssubshop#\$wssubshop-subshops)

**Example** showing how the settings of an employee account are updated via a form.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionUpdateSubAccount = $wsActions.create("UpdateSubAccount") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionUpdateSubAccount.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionUpdateSubAccount.csrf }}">
    <input type="hidden" name="memberId" value="{{= $myMember.id }}">
    <input type="text" name="displayName" value="{{= $myMember.displayName }}">
    <input type="hidden" name="privilegeGroupId" value="{{= $myMember.privilegeGroupId }}">
    <input type="hidden" name="defaultAddressVisibility" value="private">
    <input type="hidden" name="allowedSubshops" value='{"shop1": true, "shop2": true}'>
    <label>
        <input type="checkbox" name="active" value="true" {{ if $myMember.active }}checked{{ /if }}>
        Active
    </label>
    <label>
        <input type="checkbox" name="admin" value="true" {{ if $myMember.admin }}checked{{ /if }}>
        Admin
    </label>
    <button type="submit">Save employee account.</button>
</form>
```

***

### UpdatePrivileges

This action updates a privilege group. Admin rights are required for this action.

**Usage example**\
Can be used on the privilege management page where administrators can define rights and restrictions for privilege groups.

**Parameters**

| Name            | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       |
| --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `privilegeId`   | The ID of the privilege group to be updated.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `createMissing` | Indicates whether the group should be created automatically if it does not exist.<br />Possible values:<br />- `yes`                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              |
| `type`          | Type of the privilege group: <br />- `global` (shop-wide)<br />- `account` (account-related)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      |
| `privileges`    | JSON object with the privilege fields. <br />Possible fields:<br />- `allowedPaymentMethods` (JSON object with allowed payment methods: payment method ID as key, `"1"` as value enables the payment method, all other values are ignored)<br />- `paymentLimitPerOrder` (maximum order value per order)<br />- `paymentLimit` (global budget limit across all orders since the limit was set)<br />- `blockedTemplates` (blocked templates / pages of the group) <br />- `blockedUrls` (blocked URLs of the group)<br />- `editableFields` (editable fields of the group)<br />- `groupName` (only relevant for `type = global`) |

Via `allowedPaymentMethods`, only payment methods that are also available to the company account itself can be enabled: payment methods that are blocked for the account (`blockedPaymentMethods`) or that are configured with `availableByDefault: false` in the shop configuration and have not been specifically enabled for the account (`enabledPaymentMethods`) cannot be assigned to a privilege group (see [Configuration payment methods](/en/konfiguration/payment-zahlungsmethoden)).

**Error codes**

| Error code                         | Description                                                                                                          |
| ---------------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| `notLoggedIn`                      | The user is not logged in.                                                                                           |
| `unauthorized`                     | The user does not have admin rights.                                                                                 |
| `missingPrivilegeId`               | Parameter `privilegeId` is missing.                                                                                  |
| `invalidPrivilegeId`               | Invalid `privilegeId` — the group does not exist and `createMissing` is not set.                                     |
| `invalidType`                      | Parameter `type` contains an invalid value.                                                                          |
| `paymentMethodNotAllowedByAccount` | A payment method in `allowedPaymentMethods` is not available to the company account itself (blocked or not enabled). |

**Related modules, variables & methods**

* [\$wsAccount](https://dokumentation.websale.de/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](https://dokumentation.websale.de/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how the privileges of a group are updated.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionUpdatePrivileges = $wsActions.create("UpdatePrivileges") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionUpdatePrivileges.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionUpdatePrivileges.csrf }}">
    <input type="hidden" name="privilegeId" value="{{= $myPrivilegeGroup.id }}">
    <input type="hidden" name="createMissing" value="yes">
    <input type="hidden" name="type" value="global">
    <input type="hidden" name="privileges" value='{"groupName": "Purchasing", "allowedPaymentMethods": {"invoice": "1", "prepayment": "1"}, "paymentLimitPerOrder": 500, "paymentLimit": 5000}'>
    <button type="submit">Save privileges.</button>
</form>
```

***

### CreatePrivilegeGroup

This action creates a new privilege group. Admin rights are required for this action.

**Usage example**\
Can be used on the privilege management page where administrators can create new groups with defined rights for employee accounts.

**Parameters**

| Name   | Description                      |
| ------ | -------------------------------- |
| `name` | Name of the new privilege group. |

**Error codes**

| Error code     | Description                           |
| -------------- | ------------------------------------- |
| `notLoggedIn`  | The user is not logged in.            |
| `unauthorized` | The user does not have admin rights.  |
| `missingName`  | Parameter `name` is missing or empty. |

**Related modules, variables & methods**

* [\$wsAccount](https://dokumentation.websale.de/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](https://dokumentation.websale.de/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how a new privilege group is created via a form.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionCreatePrivilegeGroup = $wsActions.create("CreatePrivilegeGroup") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionCreatePrivilegeGroup.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionCreatePrivilegeGroup.csrf }}">
    <input type="text" name="name">
    <button type="submit">Create privilege group.</button>
</form>
```

***

### DeletePrivilegeGroup

This action deletes an existing privilege group. However, a group cannot be deleted as long as employee accounts are still assigned to it. Admin rights are required for this action.

**Usage example**\
Can be used on the privilege management page when a privilege group that is no longer needed should be removed.

**Parameters**

| Name | Description                                  |
| ---- | -------------------------------------------- |
| `id` | The ID of the privilege group to be deleted. |

**Error codes**

| Error code        | Description                                                                               |
| ----------------- | ----------------------------------------------------------------------------------------- |
| `notLoggedIn`     | The user is not logged in.                                                                |
| `unauthorized`    | The user does not have admin rights.                                                      |
| `missingId`       | Parameter `id` is missing.                                                                |
| `invalidId`       | Invalid `id` — the privilege group does not exist.                                        |
| `groupHasMembers` | The privilege group cannot be deleted because employee accounts are still assigned to it. |

**Related modules, variables & methods**

* [\$wsAccount](https://dokumentation.websale.de/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](https://dokumentation.websale.de/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how a privilege group is deleted by its ID.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionDeletePrivilegeGroup = $wsActions.create("DeletePrivilegeGroup") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionDeletePrivilegeGroup.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionDeletePrivilegeGroup.csrf }}">
    <input type="hidden" name="id" value="{{= $myPrivilegeGroup.id }}">
    <button type="submit">Delete privilege group.</button>
</form>
```

***

### AcceptInvitation

With this action, a B2B corporate customer accepts an invitation via the double opt-in procedure. The invitation is contained in a link that the customer receives by email. After successful verification, the account has full access to the shop.

**Usage example**\
Can be used on the confirmation page to which the invited customer is redirected after clicking the invitation link in the email.

**Error codes**

| **Error code**     | **Description**                                                        |
| ------------------ | ---------------------------------------------------------------------- |
| `unauthorized`     | No valid opt-in token was passed.                                      |
| `invalidAccountId` | The double opt-in token could not be assigned to any customer account. |
| `actionNotAllowed` | The double opt-in token is invalid or does not match the account.      |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isAccountVerified](/en/frontend/referenz/module/wsAccount#%24wsaccount-isaccountverified)

**Example** showing how a confirmation message is displayed after the invitation has been successfully accepted.

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ if $wsActions.current.name == "AcceptInvitation" and $wsActions.current.success }}
    <div class="alert alert-info">Invitation was accepted.</div>
{{ /if }}
```

***

### UnlockLogin

This action unlocks a login access that has been locked due to too many failed login attempts. The action can be executed by a logged-in user as well as via an opt-in token.

**Usage example**\
Useful when a customer has been locked out of their account after several incorrect entries and has received an unlock link by email.

**Error codes**

| **Code**       | **Description**                                                |
| -------------- | -------------------------------------------------------------- |
| `unauthorized` | The user is not logged in or no valid opt-in token was passed. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)
* [\$wsAccount.isAccountVerified](/en/frontend/referenz/module/wsAccount#%24wsaccount-isaccountverified)

**Example** showing how a confirmation message is displayed after successful execution of the action. The action itself is typically triggered via an opt-in link in an email and does not require a form.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ if $wsActions.current.name == "UnlockLogin" and $wsActions.current.success }}
    <div class="alert alert-info">Account was unlocked</div>
{{ /if }}
```

***

### Login

This action logs in a user with their access credentials.

**Usage example**\
Can be used on the login page where customers can log in to their account with their email address and password.

**Parameters**

| **Name**   | **Description**                                                |
| ---------- | -------------------------------------------------------------- |
| `id`       | Identifier of the user account (the email address by default). |
| `password` | Password of the user account.                                  |

**Error codes**

| **Code**             | **Description**                                            |
| -------------------- | ---------------------------------------------------------- |
| `missingId`          | Parameter `id` is empty.                                   |
| `missingPassword`    | Parameter `password` is empty.                             |
| `emailCheckFailed`   | Parameter `id` contains an invalid email address.          |
| `loginBlocked`       | Too many invalid login attempts.                           |
| `invalidCredentials` | Invalid login attempt — `id` or `password` is not correct. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** that creates a login form with email and password as well as a general error output for invalid entries.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionLogin = $wsActions.create("Login") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $cActionLogin.id }}">
    <input type="hidden" name="wscsrf" value="{{= $cActionLogin.csrf }}">

    {{ if $cActionLogin.error }}
        <div class="alert alert-danger">An error occurred</div>
    {{ /if }}

    <input type="email" name="id" value="{{= $cActionLogin.params.id|ifNull('') }}">
    <input type="password" name="password">

    <button type="submit">Log in</button>
</form>
```

***

### Logout

This action logs out a logged-in user.

**Usage example**\
Can be used as a logout button in the header or on the account overview page.

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how the action is triggered via a simple link that redirects the user to a defined page after logout.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
<a href="{{= $wsActions.url('Logout'
, $wsViews.viewUrl('account/overview.htm'), {}) }}">Log out</a>
```

***

### PasswordForgotten

This action sends a password-forgotten email to the specified email address. The email contains an opt-in link that allows the execution of the `ResetPassword` action.

**Usage example**\
Can be used on a "Password forgotten" page where customers enter their email address to receive a recovery link.

**Parameters**

| **Name** | **Description**                                                     |
| -------- | ------------------------------------------------------------------- |
| `email`  | Email address of the user account to which the opt-in link is sent. |

**Error codes**

| **Error code**           | **Description**                                           |
| ------------------------ | --------------------------------------------------------- |
| `missingEmail`           | Parameter `email` is empty.                               |
| `emailCheckFailed`       | Parameter `email` does not contain a valid email address. |
| `passwordRecoveryFailed` | No user account exists for the specified email address.   |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)

**Example** that creates a form through which the customer enters their email address and receives a confirmation after successful execution.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionPasswordForgotten = $wsActions.create("PasswordForgotten") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $cActionPasswordForgotten.id }}">
    <input type="hidden" name="wscsrf" value="{{= $cActionPasswordForgotten.csrf }}">

    {{ if $cActionPasswordForgotten.success }}
        <div>Password successfully reset</div>
    {{ /if }}

    <input type="email" name="email">
    <button type="submit">Request new password</button>
</form>
```

***

### ResetPassword

This action resets the password of a user account. After successful execution, the user is automatically logged out. By default, the action applies to the logged-in user — if an opt-in token is sent along with it, it applies to the user associated with the token.

**Usage example**\
Can be used on the page to which the customer is redirected via the password-forgotten link to set a new password.

**Parameters**

| **Name**            | **Description**                                                                 |
| ------------------- | ------------------------------------------------------------------------------- |
| `newPassword`       | The new password to be set for the user account.                                |
| `newPasswordRepeat` | Repetition of the new password to avoid typos.                                  |
| `passwordAuth`      | Previous password of the user account. Not required if an opt-in token is used. |

**Error codes**

| **Error code**        | **Description**                                                         |
| --------------------- | ----------------------------------------------------------------------- |
| `notLoggedIn`         | Neither an opt-in token nor a logged-in session is present.             |
| `missingPassword`     | Parameter `newPassword` is empty.                                       |
| `passwordMismatch`    | Parameters `newPassword` and `newPasswordRepeat` are not identical.     |
| `missingPasswordAuth` | Parameter `passwordAuth` is empty. Only occurs without an opt-in token. |
| `failedPasswordAuth`  | Parameter `passwordAuth` does not match the previous password.          |
| `passwordCheckFailed` | `newPassword` does not meet the password rules.                         |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)
* [\$wsAccount.isPasswordResetRequired](/en/frontend/referenz/module/wsAccount#%24wsaccount-ispasswordresetrequired)

**Example** showing how a confirmation is output after a successful reset, the form for setting the password is displayed for a valid opt-in token, and a notice about the expired link is displayed for an invalid token.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ if $wsOptIn.current.valid }}
    {{ var $cActionResetPassword = $wsActions.create("ResetPassword") }}
    <form action="{{= $wsViews.current.url() }}" method="post">
        <input type="hidden" name="wsact" value="{{= $cActionResetPassword.id }}">
        <input type="hidden" name="wscsrf" value="{{= $cActionResetPassword.csrf }}">

        <input type="password" name="newPassword">
        <input type="password" name="newPasswordRepeat">

        <button type="submit">Reset password.</button>
    </form>
{{ else }}
    <div>The link has expired.</div>
{{ /if }}
```

***

### EmailUpdate

This action changes the stored email address of a user account.

**Usage example**\
Can be used on the account management page where logged-in customers can update their email address.

**Parameters**

| **Name** | **Description**                                      |
| -------- | ---------------------------------------------------- |
| `email`  | New email address to be stored for the user account. |

**Error codes**

| **Error code**         | **Description**                                           |
| ---------------------- | --------------------------------------------------------- |
| `missingEmail`         | Parameter `email` is missing.                             |
| `emailCheckFailed`     | Parameter `email` does not contain a valid email address. |
| `accountAlreadyExists` | Another account with this email address already exists.   |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.email](/en/frontend/referenz/module/wsAccount#%24wsaccount-email)

**Example** that provides a form for entering a new email address and outputs a confirmation after successful execution.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionEmailUpdate = $wsActions.create("EmailUpdate") }}

{{ if $cActionEmailUpdate.success }}
    <div>Email address successfully updated.</div>
{{ else }}
    <form action="{{= $wsViews.current.url() }}" method="post">
        <input type="hidden" name="wsact" value="{{= $cActionEmailUpdate.id }}">
        <input type="hidden" name="wscsrf" value="{{= $cActionEmailUpdate.csrf }}">

        <input type="email" name="email">

        <button type="submit">Change email address.</button>
    </form>
{{ /if }}
```

***

### EmailUpdateOptIn

This action confirms the change of the email address via opt-in token. The token is transmitted to the new email address via a link in a confirmation email.

**Usage example**\
Can be used on the confirmation page to which the customer is redirected after clicking the opt-in link in the confirmation email.

**Error codes**

| **Error code** | **Description**                   |
| -------------- | --------------------------------- |
| `unauthorized` | No valid opt-in token was passed. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)

**Example** showing how a confirmation form is displayed for a valid opt-in token, a success message appears after successful execution, and a corresponding notice is output for an expired token.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionEmailUpdateOptIn = $wsActions.create("EmailUpdateOptIn") }}

{{ if $wsActions.current.success and $wsActions.current.name == "EmailUpdateOptIn" }}
    <div class="alert alert-success">Email address was successfully changed.</div>
{{ elseif $wsOptIn.current.valid }}
    <form method="post" action="{{= $wsViews.current.url() }}">
        <input type="hidden" name="wscsrf" value="{{= $cActionEmailUpdateOptIn.csrf }}">
        <input type="hidden" name="wsact" value="{{= $cActionEmailUpdateOptIn.id }}">
        <button type="submit">Confirm email address.</button>
    </form>
{{ else }}
    <div class="alert alert-danger">The token has expired.</div>
{{ /if }}
```

***

### EmailVerify

This action verifies an email address via double opt-in. After registration, the customer receives a confirmation email; clicking the contained link executes this action on the shop page.

**Usage example**\
Can be used on the confirmation page to which the customer is redirected after clicking the verification link in the registration email.

**Error codes**

| **Error code**     | **Description**                          |
| ------------------ | ---------------------------------------- |
| `actionNotAllowed` | No valid double opt-in token is present. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how a success message is output after successfully clicking the confirmation link and a corresponding notice appears for an invalid token.

```text theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ if $wsActions.current.name == "EmailVerify" }}
    {{ if $wsActions.current.success }}
        <div>Email address was verified.</div>
    {{ else }}
        <div>Email address could not be verified.</div>
    {{ /if }}
{{ /if }}
```

***

### AddressCreate

This action creates a new address for the logged-in user.

**Usage example**\
Can be used on the address management page where customers can create new shipping or billing addresses.

**Parameters**

| **Name**              | **Description**                                                                                                                                                                                                                       |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `address.(fieldname)` | The individual fields of the address, e.g., `address.firstName`, `address.street`, etc.                                                                                                                                               |
| `type`                | Type of address:  - `"bill"` - Billing address - `"delivery"` - Shipping address     If this is the first address of its kind for the relevant customer account, it is automatically set as the main address for the respective type. |

**Error codes**

| **Error code**       | **Description**                                                                                                                                                                                                             |
| -------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `notLoggedIn`        | The user is not logged in and no opt-in token is present.                                                                                                                                                                   |
| `emptyAddress`       | No address fields were passed.                                                                                                                                                                                              |
| `addressCheckFailed` | Error in the address data. Specified via sub-codes:  - `minlen` = too few characters - `maxlen` = too many characters - `numeric` = invalid characters - `country` = country not configured - `zip` = postal code incorrect |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.addresses](/en/frontend/referenz/module/wsAccount#%24wsaccount-addresses)

**Example** showing how a new address is created via a form with individual address fields.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionAddressCreate = $wsActions.create("AddressCreate") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionAddressCreate.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionAddressCreate.csrf }}">
    <input type="hidden" name="type" value="delivery">
    <input type="text" name="address.firstName">
    <input type="text" name="address.lastName">
    <input type="text" name="address.street">
    <input type="text" name="address.zip">
    <input type="text" name="address.city">
    <button type="submit">Save shipping address.</button>
</form>
```

***

### AddressUpdate

This action edits an existing address of the logged-in user.

**Usage example**\
Can be used on the address management page when a customer wants to update one of their saved addresses.

**Parameters**

| **Name**              | **Description**                                                                  |
| --------------------- | -------------------------------------------------------------------------------- |
| `addressId`           | The ID of the address to be edited.                                              |
| `address.(fieldname)` | The individual fields of the address to be updated.                              |
| `type`                | Type of address:  - `"bill"` - Billing address - `"delivery"` - Shipping address |

**Error codes**

| **Error code**     | **Description**                                                                           |
| ------------------ | ----------------------------------------------------------------------------------------- |
| `notLoggedIn`      | The user is not logged in and no opt-in token is present.                                 |
| `emptyAddress`     | No address fields were passed.                                                            |
| `invalidAddressId` | Invalid `addressId` — the address does not exist or does not belong to this user account. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.addresses](/en/frontend/referenz/module/wsAccount#%24wsaccount-addresses)
* [\$wsAccount.loadAddress](/en/frontend/referenz/module/wsAccount#%24wsaccount-loadaddress)

**Example** showing how an existing address is edited by its ID.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionAddressUpdate = $wsActions.create("AddressUpdate") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionAddressUpdate.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionAddressUpdate.csrf }}">
    <input type="hidden" name="addressId" value="{{= $myAddress.id }}">
    <input type="hidden" name="type" value="delivery">
    <input type="text" name="address.firstName" value="{{= $myAddress.firstName }}">
    <input type="text" name="address.lastName" value="{{= $myAddress.lastName }}">
    <input type="text" name="address.street" value="{{= $myAddress.street }}">
    <input type="text" name="address.zip" value="{{= $myAddress.zip }}">
    <input type="text" name="address.city" value="{{= $myAddress.city }}">
    <button type="submit">Update shipping address.</button>
</form>
```

***

### AddressDelete

This action deletes an address of the logged-in user.

**Usage example**\
Can be used on the address management page when a customer wants to remove an address that is no longer needed.

**Parameters**

| **Name**    | **Description**                      |
| ----------- | ------------------------------------ |
| `addressId` | The ID of the address to be deleted. |

**Error codes**

| **Error code**     | **Description**                                                                           |
| ------------------ | ----------------------------------------------------------------------------------------- |
| `notLoggedIn`      | The user is not logged in and no opt-in token is present.                                 |
| `invalidAddressId` | Invalid `addressId` — the address does not exist or does not belong to this user account. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.addresses](/en/frontend/referenz/module/wsAccount#%24wsaccount-addresses)

**Example** showing how an address is deleted by its ID.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
 {{ var $cActionAddressDelete = $wsActions.create("AddressDelete") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $cActionAddressDelete.id }}">
    <input type="hidden" name="wscsrf" value="{{= $cActionAddressDelete.csrf }}">
    <input type="hidden" name="addressId" value="{{= $cAddress.id }}">

    <button type="submit">Delete address.</button>
</form>
```

***

### SetMainAddress

This action sets a saved address as the main address. The main address is automatically preselected in the checkout.

**Usage example**\
Can be used on the address management page so customers can store their preferred address as the default for future orders.

**Parameters**

| **Name**    | **Description**                                      |
| ----------- | ---------------------------------------------------- |
| `addressId` | The ID of the address to be set as the main address. |

**Error codes**

| **Error code**     | **Description**                                                                 |
| ------------------ | ------------------------------------------------------------------------------- |
| `notLoggedIn`      | The user is not logged in.                                                      |
| `missingAddressId` | Parameter `addressId` is missing.                                               |
| `invalidAddressId` | Invalid `addressId` — the address does not exist or belongs to another account. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.addresses](/en/frontend/referenz/module/wsAccount#%24wsaccount-addresses)

**Example** showing how an address is set as the main address via a button, provided it is not already.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionSetMainAddress = $wsActions.create("SetMainAddress") }}

{{ foreach $cAddress in $wsAccount.addresses }}
    {{ if $cAddress.id != $wsAccount.mainAddress.id }}
        <form action="{{= $wsViews.current.url() }}" method="post">
            <input type="hidden" name="wsact" value="{{= $cActionSetMainAddress.id }}">
            <input type="hidden" name="wscsrf" value="{{= $cActionSetMainAddress.csrf }}">
            <input type="hidden" name="addressId" value="{{= $cAddress.id }}">

            <button type="submit">Set as main address.</button>
        </form>
    {{ /if }}
{{ /foreach }}
```

***

### SetDefaultBillAddress

This action sets a saved address as the default billing address. The default billing address is automatically preselected as the billing address in the checkout.

**Usage example**\
Can be used on the address management page so customers can store a preferred billing address as the default for future orders.

**Parameters**

| **Name**    | **Description**                                                 |
| ----------- | --------------------------------------------------------------- |
| `addressId` | The ID of the address to be set as the default billing address. |

**Error codes**

| **Error code**     | **Description**                                                                 |
| ------------------ | ------------------------------------------------------------------------------- |
| `notLoggedIn`      | The user is not logged in.                                                      |
| `missingAddressId` | Parameter `addressId` is missing.                                               |
| `invalidAddressId` | Invalid `addressId` — the address does not exist or belongs to another account. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.addresses](/en/frontend/referenz/module/wsAccount#%24wsaccount-addresses)
* [\$wsAccount.defaultBillAddress](/en/frontend/referenz/module/wsAccount#%24wsaccount-defaultbilladdress)

**Example** showing how an address is set as the default billing address via a button, provided it is not already.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionSetDefaultBillAddress = $wsActions.create("SetDefaultBillAddress") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionSetDefaultBillAddress.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionSetDefaultBillAddress.csrf }}">
    <input type="hidden" name="addressId" value="{{= $myAddress.id }}">
    <button type="submit">Set as default billing address.</button>
</form>
```

***

### SetDefaultDeliveryAddress

This action sets a saved address as the default shipping address. The default shipping address is automatically preselected as the shipping address in the checkout.

**Usage example**\
Can be used on the address management page so customers can store a preferred shipping address as the default for future orders.

**Parameters**

| **Name**    | **Description**                                                  |
| ----------- | ---------------------------------------------------------------- |
| `addressId` | The ID of the address to be set as the default shipping address. |

**Error codes**

| **Error code**     | **Description**                                                                 |
| ------------------ | ------------------------------------------------------------------------------- |
| `notLoggedIn`      | The user is not logged in.                                                      |
| `missingAddressId` | Parameter `addressId` is missing.                                               |
| `invalidAddressId` | Invalid `addressId` — the address does not exist or belongs to another account. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.addresses](/en/frontend/referenz/module/wsAccount#%24wsaccount-addresses)
* [\$wsAccount.defaultDeliveryAddress](/en/frontend/referenz/module/wsAccount#\$wsaccount-defaultdeliveryaddress) \
  \
  **Example** showing how an address is set as the default shipping address via a button, provided it is not already.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionSetDefaultDeliveryAddress = $wsActions.create("SetDefaultDeliveryAddress") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionSetDefaultDeliveryAddress.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionSetDefaultDeliveryAddress.csrf }}">
    <input type="hidden" name="addressId" value="{{= $myAddress.id }}">
    <button type="submit">Set as default shipping address.</button>
</form>
```

***

### RemoveDefaultBillAddress

This action removes the set default billing address of the logged-in user.

**Usage example**\
Can be used on the address management page when a customer wants to reset the default billing address so that no address is preselected in the checkout.

**Error codes**

| **Error code** | **Description**            |
| -------------- | -------------------------- |
| `notLoggedIn`  | The user is not logged in. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.addresses](/en/frontend/referenz/module/wsAccount#%24wsaccount-addresses)
* [\$wsAccount.defaultBillAddress](/en/frontend/referenz/module/wsAccount#%24wsaccount-defaultbilladdress)

**Example** showing how the default billing address is removed via a button, provided one is set.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $myActionRemoveDefaultBillAddress = $wsActions.create("RemoveDefaultBillAddress") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionRemoveDefaultBillAddress.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionRemoveDefaultBillAddress.csrf }}">
    <button type="submit">Remove default billing address.</button>
</form>
```

***

### RemoveDefaultDeliveryAddress

This action removes the set default shipping address of the logged-in user.

**Usage example**\
Can be used on the address management page when a customer wants to reset the default shipping address so that no address is preselected in the checkout.

**Error codes**

| **Error code** | **Description**            |
| -------------- | -------------------------- |
| `notLoggedIn`  | The user is not logged in. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.addresses](/en/frontend/referenz/module/wsAccount#%24wsaccount-addresses)
* [\$wsAccount.defaultDeliveryAddress](/en/frontend/referenz/module/wsAccount#\$wsaccount-defaultdeliveryaddress)

**Example** showing how the default shipping address is removed via a button, provided one is set.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
 {{ var $myActionRemoveDefaultDeliveryAddress = $wsActions.create("RemoveDefaultDeliveryAddress") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $myActionRemoveDefaultDeliveryAddress.id }}">
    <input type="hidden" name="wscsrf" value="{{= $myActionRemoveDefaultDeliveryAddress.csrf }}">
    <button type="submit">Remove default shipping address.</button>
</form>
```

***

### CreditCardDelete

This action deletes a saved credit card from the customer account.

**Usage example**\
Can be used on the credit card management page where logged-in customers can view and remove their saved credit cards.

**Parameters**

| **Name**     | **Description**                          |
| ------------ | ---------------------------------------- |
| `pseudoCCId` | The ID of the credit card to be deleted. |

**Error codes**

| **Error code**      | **Description**                                                                                |
| ------------------- | ---------------------------------------------------------------------------------------------- |
| `notLoggedIn`       | The user is not logged in.                                                                     |
| `invalidPseudoCCId` | Invalid `pseudoCCId` — the credit card does not exist or does not belong to this user account. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.pseudoCreditCards](/en/frontend/referenz/module/wsAccount#%24wsaccount-pseudocreditcards)

**Example** showing how all saved credit cards are listed and each one can be deleted via a button.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cCreditCards = $wsAccount.pseudoCreditCards }}
{{ foreach $cCreditCard in $wsAccount.pseudoCreditCards }}
    {{ var $cActionCreditCardDelete = $wsActions.create("CreditCardDelete") }}
    <form method="POST" action="{{= $wsViews.current.url() }}">
        <input type="hidden" name="wscsrf" value="{{= $cActionCreditCardDelete.csrf }}">
        <input type="hidden" name="wsact" value="{{= $cActionCreditCardDelete.id }}">
        <input type="hidden" name="pseudoCCId" value="{{= $cCreditCard.id }}">
        <button type="submit">Delete credit card.</button>
    </form>
{{ /foreach }}
```

***

### CheckPasswordStrength

This action checks the strength of an entered password in real time. The action is executed in the background via AJAX and returns a JSON object with the evaluation result.

**Usage example**\
Can be used on pages with password input fields, e.g., on the registration page, to give the customer direct feedback on the password strength.

**Parameters**

| **Name**   | **Description**             |
| ---------- | --------------------------- |
| `password` | The password to be checked. |

**Return values**

| **Value** | **Description**                      |
| --------- | ------------------------------------ |
| `value`   | Score reached for password strength. |
| `max`     | Maximum score for password strength. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)

**Example** showing how the password strength is checked in real time on input and is displayed to the user visually as weak, medium, or strong.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionCheckPasswordStrength = $wsActions.create("CheckPasswordStrength") }}
<form id="wsFormCheckPasswordStrength" action="{{= $wsViews.current.url() }}" method="post" style="display:none;" data-ws-ajax-form>
    <input type="hidden" name="wsact" value="{{= $cActionCheckPasswordStrength.id }}">
    <input type="hidden" name="wscsrf" value="{{= $cActionCheckPasswordStrength.csrf }}">
    <input type="hidden" name="password" id="wsCheckPassword" value="">
</form>
```

***

### accountDisplayNameUpdate

This action changes the display name of a customer account.

**Usage example**\
Can be used on the account management page where logged-in customers can update their display name.

**Parameters**

| **Name**      | **Description**                                         |
| ------------- | ------------------------------------------------------- |
| `displayName` | The new display name to be stored for the user account. |

**Error codes**

| **Code**             | **Description**                     |
| -------------------- | ----------------------------------- |
| `notLoggedIn`        | The user is not logged in.          |
| `missingDisplayName` | Parameter `displayName` is missing. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how the action is created and embedded in a form through which the customer can update their display name.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionAccountDisplayNameUpdate = $wsActions.create("accountDisplayNameUpdate") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $cActionAccountDisplayNameUpdate.id }}">
    <input type="hidden" name="wscsrf" value="{{= $cActionAccountDisplayNameUpdate.csrf }}">
    <input type="text" name="displayName">
    <button type="submit">Save display name</button>
</form>
```

***

### AccountSetCustomerData

This action sets or updates custom customer data for the logged-in user account.

**Usage example**\
Can be used on the account management page where logged-in customers can store their personal data such as date of birth or phone number.

**Parameters**

| **Name**                   | **Description**                             |
| -------------------------- | ------------------------------------------- |
| `customerData.(fieldname)` | The individual fields of the customer data. |

**Error codes**

| **Error code**      | **Description**                      |
| ------------------- | ------------------------------------ |
| `notLoggedIn`       | The user is not logged in.           |
| `emptyCustomerData` | No customer data fields were passed. |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how the action is created and embedded in a form through which the customer can update their personal data.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionAccountSetCustomerData = $wsActions.create("AccountSetCustomerData") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $cActionAccountSetCustomerData.id }}">
    <input type="hidden" name="wscsrf" value="{{= $cActionAccountSetCustomerData.csrf }}">
    <input type="text" name="customerData.phone">
    <input type="text" name="customerData.birthDate">
    <button type="submit">Save customer data</button>
</form>
```

***

### GuestRegister

This action creates a fully-fledged customer account from a guest checkout. The guest specifies a password; the email address is automatically taken from the checkout data.

**Usage example**\
Can be used on the order confirmation page after a guest checkout, where non-logged-in customers are given the option to create an account directly.

**Parameters**

| **Name**         | **Description**                                                                 |
| ---------------- | ------------------------------------------------------------------------------- |
| `guestMail`      | Email address of the guest account, automatically taken from the checkout data. |
| `password`       | New password for the customer account.                                          |
| `passwordRepeat` | Repetition of the password.                                                     |

**Error codes**

| **Error code**        | **Description**                                                                                                                            |
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| `passwordCheckFailed` | Password does not meet the required guidelines. Specified via sub-codes:  - `minlen` = too few characters - `maxlen` = too many characters |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)
* [\$wsAccount.email](/en/frontend/referenz/module/wsAccount#%24wsaccount-email)

**Example** showing how non-logged-in customers are offered the option of creating a customer account after a guest checkout, including success output.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ if not $wsAccount.isLoggedIn }}
    {{ var $cGuestRegister = $wsActions.create("GuestRegister") }}

    {{ if $cGuestRegister.success }}
        <div class="alert alert-success">An account has been created.</div>
    {{ /if }}

    {{ if not $cGuestRegister.success }}
        <form action="{{= $wsViews.current.url() }}" method="post">
            <input type="hidden" name="wscsrf" value="{{= $cGuestRegister.csrf }}">
            <input type="hidden" name="wsact" value="{{= $cGuestRegister.id }}">
            <input type="email" name="guestMail" value="{{= $wsCheckout.guestMail }}" readonly>
            <input type="password" name="password">
            <input type="password" name="passwordRepeat">
            <button type="submit">Create customer account.</button>
        </form>
    {{ /if }}
{{ /if }}
```

***

### SaveGuestDataToUser

This action creates a fully-fledged customer account from the data of a guest checkout. The guest specifies a password and thereby gains access to a permanent account.

**Usage example**\
Can be used on the order confirmation page after a guest checkout to give the customer the option of creating an account directly without having to re-enter all data.

**Parameters**

| **Name**         | **Description**                        |
| ---------------- | -------------------------------------- |
| `id`             | Email address of the guest account.    |
| `password`       | New password for the customer account. |
| `passwordRepeat` | Repetition of the password.            |

**Error codes**

| **Error code**        | **Description**                                               |
| --------------------- | ------------------------------------------------------------- |
| `nonGuestAccount`     | The user is already logged in to a customer account.          |
| `missingId`           | Parameter `id` is missing.                                    |
| `missingPassword`     | Parameter `password` is missing.                              |
| `passwordMismatch`    | Parameters `password` and `passwordRepeat` are not identical. |
| `passwordCheckFailed` | The password rule check has failed.                           |

**Related modules, variables & methods**

* [\$wsAccount](/en/frontend/referenz/module/wsAccount)
* [\$wsAccount.addresses](/en/frontend/referenz/module/wsAccount#%24wsaccount-addresses)
* [\$wsAccount.isLoggedIn](/en/frontend/referenz/module/wsAccount#%24wsaccount-isloggedin)

**Example** showing how a guest customer can create a permanent account after the checkout by only having to provide a password.

```html theme={"theme":{"light":"github-light","dark":"github-dark"},"languages":{"custom":["/languages/websale.json"]}}
{{ var $cActionSaveGuestDataToUser = $wsActions.create("SaveGuestDataToUser") }}
<form action="{{= $wsViews.current.url() }}" method="post">
    <input type="hidden" name="wsact" value="{{= $cActionSaveGuestDataToUser.id }}">
    <input type="hidden" name="wscsrf" value="{{= $cActionSaveGuestDataToUser.csrf }}">
    <input type="hidden" name="id" value="{{= $wsAccount.email }}">

    <input type="password" name="password">
    <input type="password" name="passwordRepeat">

    <button type="submit">Create customer account.</button>
</form>
```

***

###
