Route problem in multisite

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
User avatar
aimeos
Administrator
Posts: 7906
Joined: 01 Jan 1970, 00:00

Re: Route problem in multisite

Post by aimeos » 27 Oct 2022, 14:33

This was only an example. You have to use the airoute() function where you generate the URL that cases the error.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

Re: Route problem in multisite

Post by VirtualSpy » 28 Oct 2022, 05:31

VirtualSpy wrote: 27 Oct 2022, 14:00
aimeos wrote: 27 Oct 2022, 13:52 Read:

The root cause for the error is that the links to the auth routes are not generated by the airoute() function in your templates like here:
https://github.com/aimeos/aimeos/blob/m ... ade.php#L9
already airoute() function is here in this template

Code: Select all

<x-guest-layout>
    <x-auth-card>
        <!-- Validation Errors -->
        <x-auth-validation-errors class="mb-4" :errors="$errors" />

        <form method="POST" action="{{ airoute('register') }}">
            @csrf

            <!-- Name -->
            <div>
                <x-label for="name" :value="__('Name')" />

                <x-input id="name" class="block mt-1 w-full" type="text" name="name" :value="old('name')" required autofocus />
            </div>

            <!-- Email Address -->
            <div class="mt-4">
                <x-label for="email" :value="__('Email')" />

                <x-input id="email" class="block mt-1 w-full" type="email" name="email" :value="old('email')" required />
            </div>

            <!-- Password -->
            <div class="mt-4">
                <x-label for="password" :value="__('Password')" />

                <x-input id="password" class="block mt-1 w-full"
                                type="password"
                                name="password"
                                required autocomplete="new-password" />
            </div>

            <!-- Confirm Password -->
            <div class="mt-4">
                <x-label for="password_confirmation" :value="__('Confirm Password')" />

                <x-input id="password_confirmation" class="block mt-1 w-full"
                                type="password"
                                name="password_confirmation" required />
            </div>

            <div class="flex items-center justify-end mt-4">
                <a class="underline text-sm text-gray-600 hover:text-gray-900" href="{{ airoute('login') }}">
                    {{ __('Already registered?') }}
                </a>

                <x-button class="ml-4">
                    {{ __('Register') }}
                </x-button>
            </div>
        </form>
    </x-auth-card>
</x-guest-layout>
Why are you not accepting it is bug from your side because i didn't change any template except this

Code: Select all

<div class="form-group row">
                <div class="col-md-12 text-left">
                @if (Route::has('register'))
                        <a class="underline text-sm text-gray-600 hover:text-gray-900" href="{{ airoute('register') }}">
                            {{ __('Create Account') }}
                        </a>
                    @endif

User avatar
aimeos
Administrator
Posts: 7906
Joined: 01 Jan 1970, 00:00

Re: Route problem in multisite

Post by aimeos » 28 Oct 2022, 07:02

Don't know where the error exactly is located. E-mail verification is something Laravel does internally and without much access from outside.

You could try to replace this in your routes/web.php:

Code: Select all

Route::group($conf ?? [], function () {
    require __DIR__ . '/auth.php';
});
//replace with
require __DIR__ . '/auth.php';
You could also modify this file:
https://github.com/aimeos/aimeos/blob/m ... s/auth.php

Add the settings in $conf there but not for these routes:
https://github.com/aimeos/aimeos/blob/m ... hp#L38-L47

Whatever works best. If you find a good solution, please create a PR so it will be fixed for all.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

Re: Route problem in multisite

Post by VirtualSpy » 12 Dec 2022, 06:34

aimeos wrote: 28 Oct 2022, 07:02 Don't know where the error exactly is located. E-mail verification is something Laravel does internally and without much access from outside.

You could try to replace this in your routes/web.php:

Code: Select all

Route::group($conf ?? [], function () {
    require __DIR__ . '/auth.php';
});
//replace with
require __DIR__ . '/auth.php';
You could also modify this file:
https://github.com/aimeos/aimeos/blob/m ... s/auth.php

Add the settings in $conf there but not for these routes:
https://github.com/aimeos/aimeos/blob/m ... hp#L38-L47

Whatever works best. If you find a good solution, please create a PR so it will be fixed for all.
i seprated this routes

Code: Select all

Route::get('verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke'])
                ->middleware(['signed', 'throttle:6,1'])
                ->name('verification.verify');
               
                Route::get('confirm-password', [ConfirmablePasswordController::class, 'show'])
                ->name('password.confirm');
            
            Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']);
            
            Route::get('reset-password/{token}', [NewPasswordController::class, 'create'])
    ->name('password.reset');
and for resetting password , passed site parameter in login route from NewPasswordController , but when i login to my other site from first site user creds it is showing error like this

Code: Select all

Item with ID "22" in "customer.id" not found
please tell me a best way to handel this error or give me a best solution.

User avatar
aimeos
Administrator
Posts: 7906
Joined: 01 Jan 1970, 00:00

Re: Route problem in multisite

Post by aimeos » 13 Dec 2022, 10:09

This is usually the case if the user has been created for a different site and is bound to that site ID now instead of the current site (see users.siteid column for that user). You can set the site ID of the user to an empty string to make that account available for all sites.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

Re: Route problem in multisite

Post by VirtualSpy » 13 Dec 2022, 10:20

aimeos wrote: 13 Dec 2022, 10:09 This is usually the case if the user has been created for a different site and is bound to that site ID now instead of the current site (see users.siteid column for that user). You can set the site ID of the user to an empty string to make that account available for all sites.
please tell me how can i set site ID empty while user registration.

User avatar
VirtualSpy
Advanced
Posts: 122
Joined: 05 Jul 2022, 07:55

Re: Route problem in multisite

Post by VirtualSpy » 13 Dec 2022, 10:48

VirtualSpy wrote: 13 Dec 2022, 10:20
aimeos wrote: 13 Dec 2022, 10:09 This is usually the case if the user has been created for a different site and is bound to that site ID now instead of the current site (see users.siteid column for that user). You can set the site ID of the user to an empty string to make that account available for all sites.
please tell me how can i set site ID empty while user registration.
Thank you so much for your support from site id as an empty string now user can login on all sites :D

Post Reply