|
106 | 106 | } |
107 | 107 |
|
108 | 108 | function onGithubLogin() { |
| 109 | + let successUrl = window.location.origin; |
| 110 | +
|
| 111 | + if (page.url.searchParams.has('code')) { |
| 112 | + successUrl += `?code=${page.url.searchParams.get('code')}`; |
| 113 | + } else if (page.url.searchParams.has('campaign')) { |
| 114 | + successUrl += `?campaign=${page.url.searchParams.get('campaign')}`; |
| 115 | + } |
| 116 | +
|
109 | 117 | sdk.forConsole.account.createOAuth2Session({ |
110 | 118 | provider: OAuthProvider.Github, |
111 | | - success: window.location.origin, |
| 119 | + success: successUrl, |
112 | 120 | failure: window.location.origin, |
113 | 121 | scopes: ['read:user', 'user:email'] |
114 | 122 | }); |
|
124 | 132 | <svelte:fragment> |
125 | 133 | <Form onSubmit={register}> |
126 | 134 | <Layout.Stack> |
| 135 | + {#if isCloud} |
| 136 | + <div style:margin-bottom="var(--gap-s, 8px)"> |
| 137 | + <Button secondary fullWidth on:click={onGithubLogin} {disabled}> |
| 138 | + <span class="icon-github" aria-hidden="true"></span> |
| 139 | + <span class="text">Sign up with GitHub</span> |
| 140 | + </Button> |
| 141 | + </div> |
| 142 | + <span class="with-separators eyebrow-heading-3">or</span> |
| 143 | + {/if} |
| 144 | + |
127 | 145 | <InputText |
128 | 146 | id="name" |
129 | 147 | label="Name" |
|
159 | 177 | >.</InputChoice> |
160 | 178 |
|
161 | 179 | <Button fullWidth submit disabled={disabled || !terms}>Sign up</Button> |
162 | | - |
163 | | - {#if isCloud} |
164 | | - <span class="with-separators eyebrow-heading-3">or</span> |
165 | | - <Button |
166 | | - secondary |
167 | | - fullWidth |
168 | | - on:click={onGithubLogin} |
169 | | - disabled={disabled || !terms}> |
170 | | - <span class="icon-github" aria-hidden="true"></span> |
171 | | - <span class="text">Sign up with GitHub</span> |
172 | | - </Button> |
173 | | - {/if} |
174 | 180 | </Layout.Stack> |
175 | 181 | </Form> |
176 | 182 | </svelte:fragment> |
|
0 commit comments