Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to selected "locale" after login/registering #956

Open
xyz1123581321 opened this issue Sep 19, 2022 · 0 comments
Open

Redirect to selected "locale" after login/registering #956

xyz1123581321 opened this issue Sep 19, 2022 · 0 comments

Comments

@xyz1123581321
Copy link
Contributor

Hey @tobias-kuendig, I'm not sure if it is my mistake, Ive added a couple of languages to my site and after login the user is redirected back to default language. I got a suggestion how to fix it, but I also wanted to ask you if this is the correct solution to this problem.
I've updated OFFLINE\Mall\Components\SignUp component

    protected function redirect()
    {
        // Check for session redirect.
        if ($redirect = Session::pull('mall.login.redirect')) {
            return redirect()->to($redirect);
        }

        // Check for a redirect parameter specified via GET/POST.
        if ($redirect = input('redirect')) {
            return redirect()->guest($this->controller->pageUrl($redirect));
        }

        // Otherwise, use the redirect property of the component.
        if ($url = $this->property('redirect')) {
            $translator = Translator::instance();
            $locale = $translator->getLocale();
            return \Redirect::to($translator->getPathInLocale($url, $locale));
        }

        return redirect()->back();
    }
    ```

if ($url = $this->property('redirect')) {
$translator = Translator::instance();
$locale = $translator->getLocale();
return \Redirect::to($translator->getPathInLocale($url, $locale));
}

    
    
    
    
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant