Customer authentication patterns for STORE_ECOMMERCE app using modal-based login/register. Trigger: When implementing customer login, registration, or auth modal in e-commerce frontend.
STORE_ECOMMERCE.loginCustomer, registerCustomer, customer tokens, or legal document acceptance.POST /auth/register-customer is @Public().POST /auth/login-customer is @Public().ip_address and user_agent from the request.Files:
apps/backend/src/domains/auth/auth.controller.tsapps/backend/src/domains/auth/auth.service.tsapps/backend/src/domains/auth/dto/register-customer.dto.tsapps/backend/src/domains/auth/dto/login-customer.dto.tsRegisterCustomerDto requires email, first_name, last_name, and store_id.
password is optional in the backend DTO. If provided, it must be at least 8 chars and contain at least one non-alphanumeric character. The current frontend modal requires a password during registration.
Optional registration fields include phone, document_type, and document_number. Phone allows digits plus + # * ( ) - and spaces.
LoginCustomerDto requires email, password, and store_id.
registerCustomer():
store_id.customer in lowercase.users with the store organization id.user_settings with app_type: 'STORE_ECOMMERCE'.user_roles and store_users association.customer.created and sends a store-branded welcome email.loginCustomer():
email + organization_id.customer and association in store_users.store_id: store.id.updatedEnvironment: 'STORE_ECOMMERCE'.Use modal auth, not redirects, for customer login/register.
Files:
apps/frontend/src/app/private/layouts/store-ecommerce/store-ecommerce-layout.component.tsapps/frontend/src/app/private/layouts/store-ecommerce/components/auth-modal/auth-modal.component.tsapps/frontend/src/app/core/store/auth/auth.actions.tsapps/frontend/src/app/core/store/auth/auth.facade.tsapps/frontend/src/app/core/store/auth/auth.effects.tsapps/frontend/src/app/core/store/auth/auth.reducer.tsThe layout uses signals:
readonly is_auth_modal_open = signal(false);
readonly auth_modal_mode = signal<'login' | 'register'>('login');
login(): void {
this.auth_modal_mode.set('login');
this.is_auth_modal_open.set(true);
}
Template binding:
<app-auth-modal
[isOpen]="is_auth_modal_open()"
[initialMode]="auth_modal_mode()"
[storeLogo]="store_logo()"
[storeName]="store_name()"
(closed)="closeAuthModal()"
/>
AuthModalComponent uses signal input()/output() APIs and signal state. It auto-closes with an effect() when authFacade.isAuthenticated() becomes true while the modal is open.
Login calls:
const storeId = this.tenantFacade.getCurrentStoreId();
this.authFacade.loginCustomer(email, password, storeId);
Registration calls:
this.authFacade.registerCustomer({
email,
password,
first_name,
last_name,
store_id: storeId,
});
The modal requires pending legal documents to be accepted before registration when any are returned by the legal service.
Dedicated customer actions exist: loginCustomer, loginCustomerSuccess, loginCustomerFailure, registerCustomer, registerCustomerSuccess, and registerCustomerFailure.
AuthFacade.loginCustomer() and AuthFacade.registerCustomer() dispatch those actions. Facade signals use toSignal(..., { initialValue }).
loginSuccess$ handles customer login success too. Customer login returns updatedEnvironment: 'STORE_ECOMMERCE'; do not rely on it being null.
registerCustomerSuccess persists auth state in the reducer and shows a success toast through its effect.
The auth modal obtains store_id through TenantFacade.getCurrentStoreId(), which reads currentStore().id first and falls back to domainConfig().store_id.
Legal document APIs use x-store-id and live in apps/frontend/src/app/public/ecommerce/services/legal.service.ts.
loginCustomer/registerCustomer, not admin login/register, for ecommerce customers.customer when reasoning about backend role names.vendix-ecommerce-checkout - Guest vs authenticated checkout boundaryvendix-backend-auth - Backend auth guards and public routesvendix-zoneless-signals - Modal signal patternsvendix-multi-tenant-context - Store id resolutionnpx skills add Rzyfront/vendix-customer-auth下载完整 Skill 目录,包含 SKILL.md 及所有相关文件
Search for places (restaurants, cafes, etc.) via Google Places API proxy on localhost.
Interact with GitHub using the `gh` CLI. Use `gh issue`, `gh pr`, `gh run`, and `gh api` for issues, PRs, CI runs, and advanced queries.
Create or update AgentSkills. Use when designing, structuring, or packaging skills with scripts, references, and assets.
Start voice calls via the OpenClaw voice-call plugin.
Notion API for creating and managing pages, databases, and blocks.
Gemini CLI for one-shot Q&A, summaries, and generation.
Category:developer