File tree Expand file tree Collapse file tree
src/routes/(public)/(guest)/login Expand file tree Collapse file tree Original file line number Diff line number Diff line change 9494 function clearAuthToken() {
9595 localStorage .removeItem (' imagine-auth-token' );
9696 }
97+
98+ const emailEnabled = $derived (data .enableEmail || profile .logins .includes (Logins .EMAIL ));
9799 </script >
98100
99101<svelte:head >
105107 <svelte:fragment >
106108 <Form onSubmit ={login }>
107109 <Layout .Stack >
108- {#if profile . logins . includes ( Logins . EMAIL ) }
110+ {#if emailEnabled }
109111 <InputEmail
110112 id =" email"
111113 label =" Email"
146148 </Form >
147149 </svelte:fragment >
148150 <svelte:fragment slot =" links" >
149- {#if profile . logins . includes ( Logins . EMAIL ) }
151+ {#if emailEnabled }
150152 <li class =" inline-links-item" >
151153 <a href ={` ${base }/recover ` }><span class =" text" >Forgot password?</span ></a >
152154 </li >
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { redirect } from '@sveltejs/kit';
55import type { PageLoad } from './$types' ;
66
77export const load : PageLoad = async ( { url } ) => {
8+ const enableEmail = url . searchParams . has ( 'email_enabled' ) ;
89 if ( url . searchParams . has ( 'code' ) ) {
910 const code = url . searchParams . get ( 'code' ) ;
1011 let campaign : Campaign ;
@@ -13,6 +14,7 @@ export const load: PageLoad = async ({ url }) => {
1314 if ( couponData . campaign ) {
1415 campaign = await sdk . forConsole . billing . getCampaign ( couponData . campaign ) ;
1516 return {
17+ enableEmail,
1618 couponData,
1719 campaign
1820 } ;
@@ -26,10 +28,10 @@ export const load: PageLoad = async ({ url }) => {
2628 let campaign : Campaign ;
2729 try {
2830 campaign = await sdk . forConsole . billing . getCampaign ( campaignId ) ;
29- return { campaign } ;
31+ return { campaign, enableEmail } ;
3032 } catch ( e ) {
3133 redirect ( 303 , `${ base } /login` ) ;
3234 }
3335 }
34- return ;
36+ return { enableEmail } ;
3537} ;
You can’t perform that action at this time.
0 commit comments