Skip to content

Commit 9ca9b3f

Browse files
committed
Remote social login route: reset state and conditional rendering
1 parent fcefe4c commit 9ca9b3f

2 files changed

Lines changed: 28 additions & 19 deletions

File tree

editor/src/app/app-state/app.state.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,8 @@ export class AppState implements NgxsOnInit {
212212
setState({
213213
...defaultState,
214214
forgotPasswordUrl: state.forgotPasswordUrl,
215+
googleLoginUrl: state.googleLoginUrl,
216+
facebookLoginUrl: state.facebookLoginUrl,
215217
isBertaHosting: state.isBertaHosting,
216218
plans: state.plans,
217219
loginUrl: state.loginUrl,

editor/src/app/login/login.component.ts

Lines changed: 26 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,33 @@ import { UserState } from '../user/user.state';
2727
<berta-loading></berta-loading>
2828
</div>
2929
} @else {
30-
@if (appState.isBertaHosting) {
30+
@if (
31+
appState.isBertaHosting &&
32+
(appState.facebookLoginUrl || appState.googleLoginUrl)
33+
) {
3134
<div class="form-group social-login">
32-
<a
33-
href="{{ appState.facebookLoginUrl }}?remote_redirect={{
34-
appState.authenticateUrl
35-
}}"
36-
class="button facebook"
37-
>
38-
<bt-icon-facebook></bt-icon-facebook>
39-
<p>Log in with Facebook</p></a
40-
>
41-
<a
42-
href="{{ appState.googleLoginUrl }}?remote_redirect={{
43-
appState.authenticateUrl
44-
}}"
45-
class="button google"
46-
>
47-
<bt-icon-google></bt-icon-google>
48-
<p>Sign in with Google</p></a
49-
>
35+
@if (appState.facebookLoginUrl) {
36+
<a
37+
href="{{ appState.facebookLoginUrl }}?remote_redirect={{
38+
appState.authenticateUrl
39+
}}"
40+
class="button facebook"
41+
>
42+
<bt-icon-facebook></bt-icon-facebook>
43+
<p>Log in with Facebook</p></a
44+
>
45+
}
46+
@if (appState.googleLoginUrl) {
47+
<a
48+
href="{{ appState.googleLoginUrl }}?remote_redirect={{
49+
appState.authenticateUrl
50+
}}"
51+
class="button google"
52+
>
53+
<bt-icon-google></bt-icon-google>
54+
<p>Sign in with Google</p></a
55+
>
56+
}
5057
<p>or</p>
5158
</div>
5259
}

0 commit comments

Comments
 (0)