# 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/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_logout:
    path: /logout
    methods: [GET]

sylius_shop_register:
    path: /register
    methods: [GET, POST]
    defaults:
        _controller: sylius.controller.customer::createAction
        _sylius:
            template: "@SyliusShop/register.html.twig"
            form: Sylius\Bundle\CoreBundle\Form\Type\Customer\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\CoreBundle\Form\Type\Customer\CustomerRegistrationType
            factory:
                method: ['expr:service("sylius.factory.customer_after_checkout")', 'createAfterCheckout']
                arguments:
                    - 'expr:service("sylius.repository.order").findOneByTokenValue($tokenValue)'
            template: "@SyliusShop/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.controller.shop.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/requestPasswordReset.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/resetPassword.html.twig"
            redirect: sylius_shop_login
