# This file is a part of the Sylius package.
# (c) Sylius Sp. z o.o.

sylius_shop_login:
    path: /login
    methods: [GET]
    defaults:
        _controller: sylius.controller.security::loginAction
        _sylius:
            template: "@SyliusShop/account/login.html.twig"
            logged_in_route: sylius_shop_account_dashboard

sylius_shop_login_check:
    path: /login-check
    methods: [POST]
    defaults:
        _controller: sylius.controller.security::checkAction
        
sylius_shop_json_login_check:
    path: /json-login-check
    methods: [POST]
    defaults:
        _controller: sylius.controller.security::jsonLoginCheck

sylius_shop_logout:
    path: /logout
    methods: [GET]

sylius_shop_register:
    path: /register
    methods: [GET, POST]
    defaults:
        _controller: sylius.controller.customer::createAction
        _sylius:
            template: "@SyliusShop/account/register.html.twig"
            form: Sylius\Bundle\ShopBundle\Form\Type\CustomerRegistrationType
            event: register
            redirect:
                route: sylius_shop_register_thank_you
            flash: sylius.customer.register

sylius_shop_register_after_checkout:
    path: /register-after-checkout/{tokenValue}
    methods: [GET]
    defaults:
        _controller: sylius.controller.customer::createAction
        _sylius:
            form: Sylius\Bundle\ShopBundle\Form\Type\CustomerRegistrationType
            factory:
                method: ['expr:service("sylius.factory.customer_after_checkout")', 'createAfterCheckout']
                arguments:
                    - 'expr:service("sylius.repository.order").findOneByTokenValue($tokenValue)'
            template: "@SyliusShop/account/register.html.twig"
            event: register
            redirect:
                route: sylius_shop_register_thank_you
            flash: sylius.customer.register

sylius_shop_register_thank_you:
    path: /register/thank-you
    methods: [GET]
    defaults:
        _controller: sylius_shop.controller.register_thank_you::thankYouAction

sylius_shop_request_password_reset_token:
    path: /forgotten-password
    methods: [GET, POST]
    defaults:
        _controller: sylius.controller.shop_user::requestPasswordResetTokenAction
        _sylius:
            template: "@SyliusShop/account/forgotten_password.html.twig"
            redirect: sylius_shop_login

sylius_shop_password_reset:
    path: /forgotten-password/{token}
    methods: [GET, POST]
    defaults:
        _controller: sylius.controller.shop_user::resetPasswordAction
        _sylius:
            template: "@SyliusShop/account/reset_password.html.twig"
            redirect: sylius_shop_login
