# Customer accounts

Shoppers can open an account on the storefront. Ordering never needs one: an account saves typing and shows the
shopper their orders. Accounts are separate from staff users; a shopper can never sign in to the admin.

## What a shopper can do

- **Create an account** (**Contul meu → Creează un cont**, at `/cont/inregistrare`): name, e-mail and a password of at
  least 10 characters. They are signed in at once and get an e-mail to **confirm the address**; the link lasts three
  days, and can be sent again from the account page.
- **Sign in** at `/cont/intra`, optionally staying signed in on the device. A wrong e-mail and a wrong password get
  the same answer, and after five failed tries from one place the sign-in waits five minutes. When an account is
  guessed at from many places, it asks for a new password by e-mail instead, which lets the real owner straight in.
- **Changing or resetting the password** signs the account out everywhere else.
- **Choose a new password** from **Ți-ai uitat parola?**: the link arrives by e-mail and lasts an hour. The page says
  the same whether or not an account has that e-mail.
- **See their orders** (**Comenzi**): the number, date, status, items and total, each opening the order's page.
- **Order again** (**Comandă din nou** on an order's page): its products go back into the cart at today's prices.
- **Save products for later** (**Salvează la favorite** under a product's buy button; **Favorite** in the header and
  the account): each variant once, up to 200. **Favorite** lists them with today's price, the Omnibus price when
  reduced, whether they are in stock, and **Adaugă în coș**. A guest who presses the button signs in first and comes
  back to the product.
- **Apply to the affiliate programme** (**Afiliere**), when you opened sign-ups, and then see their link, coupon and
  commissions: see [Affiliates](affiliates.md#applications-from-customers).
- **Quick order** (**Comandă rapidă**) and **order lists** (**Liste de comandă**), for company buyers only: see
  [Company accounts](companies.md#fast-ordering).
- **Keep addresses** (**Adrese**): a name, the address (county and SIRUTA locality), a phone, and optionally a company
  with its CUI (checked) and trade register number for invoices. One address is the default for billing and one for
  delivery; the first saved is both, and deleting a default hands its role to the most recent address left.
- **See their recent sign-ins** (**Date și parolă → Intrări recente**): the last ten, from the shop or the app, with
  wrong-password tries, each with the date, the device (for example *Chrome · macOS*) and the IP address, so they can
  spot one that wasn't theirs.
- **Change their name, phone and password** (**Date și parolă**). The e-mail stays: to change it, the shopper writes to
  you.
- **Ask to delete the account** (**Date și parolă → Ștergerea contului**), confirming with their password and, if they
  like, saying why. They can withdraw the request until you act on it.
- **Sign out**: the cart stays with the account and the browser starts with an empty one.

## Back-in-stock alerts

When a product can't be ordered online (no stock in the locations that ship online orders), its page offers
**Anunță-mă când revine în stoc** (tell me when it is back) in place of the buy button. Anyone can leave an e-mail:

- A guest gets an e-mail to **confirm the alert** first (at most three a day to one address, whoever asks). The link
  opens the alert's page, where they press **Confirmă alerta**; e-mail scanners that open links don't confirm it.
- A signed-in shopper with a confirmed e-mail address doesn't need to confirm. They can also ask from **Favorite**,
  where a sold-out product shows **Anunță-mă când revine**.

Every 15 minutes a scheduled task (see [Scheduled tasks](scheduled-tasks.md)) looks for products back in online stock
and writes once to each confirmed address, in the language the shopper used. The stock is not held for them. After
that the alert is done; the shopper can ask again. Each e-mail links to the alert's page, where it can be cancelled.
The address is used for nothing else. Old alerts are deleted (see [Privacy](privacy.md#retention)).

## Checkout for a signed-in shopper

The checkout form comes filled in: the account's e-mail and phone, the default billing address (with the company,
when it has one) and the default delivery address when it is a different one. **Salvează adresele în contul meu**
(save the addresses in my account), ticked by default, keeps the order's addresses in the book, without repeating one
already there.

## Admin → Clienți

**Clienți** (Customers) lists the accounts, newest first, with their number of orders, when the account was opened and
last signed in to, and its state (**Activ**, **Neconfirmat** while the e-mail is not confirmed, **Închis**). Search by
name, e-mail or phone, or show only unconfirmed or closed accounts. A customer's page shows their orders, their account
details and their saved addresses; an order placed from an account links to it (**Contul clientului**).

**Cerere de ștergere** (deletion requested) shows the accounts whose owners asked to be deleted (GDPR, the right to
erasure). On such a customer's page, **Șterge contul definitiv** (delete permanently, *Closes and reopens customer
accounts*) removes the account, its addresses and carts. Its orders stay, no longer tied to an account, because the law
requires you to keep them (accounting records, warranty). Answer the customer by e-mail once it is done. An account
whose owner did not ask cannot be deleted from here; close it instead.

**Activitate în cont** (account activity) on a customer's page lists the last 50 events, newest first: sign-ins
(from the shop or the app) and failed tries, the account opened and its e-mail confirmed, password changes and
resets, details and addresses changed, deletion requested or withdrawn, data downloaded, and what staff did (closed,
reopened, data exported, entered the account), with the staff member's name. Each line by the customer shows the IP
address and a short device name (an app's own name only after a correct password); the raw browser string is never
kept, and staff actions keep neither, since those would be the staff member's. Addresses and devices are deleted after 90 days and the
events after two years (see [Privacy](privacy.md#retention)).

**Exportă CSV** on the list saves the accounts it shows (search and state filters applied) for a spreadsheet: name,
e-mail, phone, language, whether the e-mail is confirmed, state, number of orders, when the account was opened and last
signed in to. It needs *Exports the customer list (CSV)* (Shop manager by default), and every export is written to the
activity log with who made it and the filters.

**Intră în contul clientului** (enter the customer's account) opens the storefront signed in as the customer, to see
what they see when they call: their account pages, orders, favourites and cart. A banner across the top says you are
in their account, with **Ieși din contul clientului** to leave and go back to their admin page. While you are in, you
can look around, fill the cart and the favourites and go as far as the checkout's review step; everything else is
refused, such as changing their details or password, asking to delete the account, downloading their data or files,
placing or paying orders, withdrawing from a contract, changing subscriptions, licences or addresses, cookie choices,
stock alerts and reservations in store. Their last sign-in doesn't change, and their own
sessions on their devices stay signed in. The visit ends by itself if you sign out of the admin or your admin session ends (for example after a password change). A closed account can't
be entered. It needs *Signs in to the storefront as a customer*, which no role has by default (owners and
administrators can do everything); entering and leaving are both written to the activity log.

**Închide contul** (close account) stops the customer from signing in and ends their open sessions; their orders stay.
**Redeschide contul** reopens it. Seeing customers needs *Sees customers* (Shop manager, Order operator and B2B account
manager by default); closing and reopening needs *Closes and reopens customer accounts* (Shop manager).

## Carts and orders

- Signing in brings the cart the shopper filled as a guest into their account's cart: quantities add up, never beyond
  what is in stock. A cart started while signed in belongs to the account, so it follows the shopper to their other
  devices.
- An order placed while signed in is the account's. Orders placed earlier without an account, with the same e-mail,
  join the account once the shopper confirms the address, never before, so nobody sees orders by typing someone else's
  e-mail.

The e-mails go out in the shopper's language, with your shop's name and button colour, and replies go to the address
set in **Setări → Magazin online**.
