vtex-apps / login

Login docs and messages
174 stars 383 forks source link

returnUrl in LoginContent #16

Open felipe-ssilva opened 2 years ago

felipe-ssilva commented 2 years ago

Hi guys! How it's going?

How using returnUrl in LoginContent? This is possible? The login is working. But returnUrl after login not.

import LoginContent from 'vtex.login/LoginContent'; 

 <LoginContent
          profile={profile}
          defaultOption={1}
          returnUrl={encodeURIComponent(urlLocal)}
          emailAndPasswordTitle={`Entrar com e-mail e senha:`}
          optionsTitle={`Use uma das opções abaixo:`}
          accessCodeTitle="Receber código de acesso por e-mail"
          emailPlaceholder="Digite seu e-mail"
          passwordPlaceholder="Digite sua senha"
          accessCodePlaceholder="Digite seu código"
          isInitialScreenOptionOnly={false}
          showPasswordVerificationIntoTooltip={true}
/>

Custom app: image

charzlwebz256 commented 1 year ago

Yes, it's possible to use the returnUrl prop in the LoginContent component to redirect the user to a specific page after they log in. Here's an example of how you can use it: `import LoginContent from 'vtex.login/LoginContent';

const MyLoginPage = () => { const returnUrl = encodeURIComponent('https://example.com/my-account');

return ( <LoginContent profile={profile} defaultOption={1} returnUrl={returnUrl} emailAndPasswordTitle={Entrar com e-mail e senha:} optionsTitle={Use uma das opções abaixo:} accessCodeTitle="Receber código de acesso por e-mail" emailPlaceholder="Digite seu e-mail" passwordPlaceholder="Digite sua senha" accessCodePlaceholder="Digite seu código" isInitialScreenOptionOnly={false} showPasswordVerificationIntoTooltip={true} /> ); }; ` In this example, the returnUrl prop is set to https://example.com/my-account, which is the URL that the user will be redirected to after they log in. Make sure to encode the URL using the encodeURIComponent function, as shown in the example.

When the user logs in, they will be redirected to the URL specified in the returnUrl prop. If the returnUrl prop is not specified or is set to an empty string, the user will be redirected to the home page of the website.

Abongile184 commented 1 year ago

Yo I don't know why am I receiving these mails please remove me from your mailing list

On Mon, Feb 27, 2023, 14:55 Charz Lwebz @.***> wrote:

Yes, it's possible to use the returnUrl prop in the LoginContent component to redirect the user to a specific page after they log in. Here's an example of how you can use it: `import LoginContent from 'vtex.login/LoginContent';

const MyLoginPage = () => { const returnUrl = encodeURIComponent('https://example.com/my-account');

return ( <LoginContent profile={profile} defaultOption={1} returnUrl={returnUrl} emailAndPasswordTitle={Entrar com e-mail e senha:} optionsTitle={Use uma das opções abaixo:} accessCodeTitle="Receber código de acesso por e-mail" emailPlaceholder="Digite seu e-mail" passwordPlaceholder="Digite sua senha" accessCodePlaceholder="Digite seu código" isInitialScreenOptionOnly={false} showPasswordVerificationIntoTooltip={true} /> ); }; ` In this example, the returnUrl prop is set to https://example.com/my-account, which is the URL that the user will be redirected to after they log in. Make sure to encode the URL using the encodeURIComponent function, as shown in the example.

When the user logs in, they will be redirected to the URL specified in the returnUrl prop. If the returnUrl prop is not specified or is set to an empty string, the user will be redirected to the home page of the website.

— Reply to this email directly, view it on GitHub https://github.com/vtex-apps/login/issues/16#issuecomment-1446276562, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR3O43GFFMTATQZYES2547LWZSP4RANCNFSM5YEY4I3A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

manutromero commented 6 months ago

@charzlwebz256 But, how you imported vtex.login: "2.x" in you manifest? I got this error.

image

nohestmm commented 2 months ago

Hi, not work for me, did it work for anyone