diff --git a/_api_app/app/Http/Controllers/StateController.php b/_api_app/app/Http/Controllers/StateController.php index fb063b16..cf4b72d2 100644 --- a/_api_app/app/Http/Controllers/StateController.php +++ b/_api_app/app/Http/Controllers/StateController.php @@ -106,6 +106,8 @@ public function getMeta() $meta = [ 'version' => $options['version'], 'forgotPasswordUrl' => $user->forgot_password_url, + 'googleLoginUrl' => $user->google_login_url, + 'facebookLoginUrl' => $user->facebook_login_url, 'loginUrl' => $user->profile_url ? $user->profile_url : route('login'), 'authenticateUrl' => route('authenticate'), 'isBertaHosting' => $user->profile_url != false, diff --git a/_api_app/app/User/UserModel.php b/_api_app/app/User/UserModel.php index 6e7205a5..b3cc3cb8 100644 --- a/_api_app/app/User/UserModel.php +++ b/_api_app/app/User/UserModel.php @@ -19,6 +19,10 @@ class UserModel implements AuthenticatableContract, AuthorizableContract public $profile_url; + public $google_login_url; + + public $facebook_login_url; + public $forgot_password_url; public $plans; @@ -38,6 +42,8 @@ public function __construct() $this->name = $options['AUTH_user']; $this->password = $options['AUTH_password']; $this->profile_url = $this->getHostingData('HOSTING_PROFILE'); + $this->google_login_url = $this->getHostingData('GOOGLE_LOGIN'); + $this->facebook_login_url = $this->getHostingData('FACEBOOK_LOGIN'); $this->forgot_password_url = $this->getHostingData('FORGOTPASSWORD_LINK'); $this->plans = $this->getHostingData('PLANS'); $this->features = $this->getFeatures(); diff --git a/editor/src/app/app-state/app-state.interface.ts b/editor/src/app/app-state/app-state.interface.ts index c68f2595..8f1f06da 100644 --- a/editor/src/app/app-state/app-state.interface.ts +++ b/editor/src/app/app-state/app-state.interface.ts @@ -14,6 +14,8 @@ export interface AppStateModel { tag: string | null; urls: { [name: string]: string }; forgotPasswordUrl: string; + googleLoginUrl: string; + facebookLoginUrl: string; isBertaHosting: boolean; plans: PlanModel[]; loginUrl: string; diff --git a/editor/src/app/app-state/app.state.ts b/editor/src/app/app-state/app.state.ts index 4f6748d1..95f2e001 100644 --- a/editor/src/app/app-state/app.state.ts +++ b/editor/src/app/app-state/app.state.ts @@ -36,6 +36,8 @@ const defaultState: AppStateModel = { tag: null, urls: {}, forgotPasswordUrl: '', + googleLoginUrl: '', + facebookLoginUrl: '', isBertaHosting: false, plans: [], loginUrl: '', @@ -210,6 +212,8 @@ export class AppState implements NgxsOnInit { setState({ ...defaultState, forgotPasswordUrl: state.forgotPasswordUrl, + googleLoginUrl: state.googleLoginUrl, + facebookLoginUrl: state.facebookLoginUrl, isBertaHosting: state.isBertaHosting, plans: state.plans, loginUrl: state.loginUrl, diff --git a/editor/src/app/login/login.component.ts b/editor/src/app/login/login.component.ts index 542df3f3..6604ac50 100644 --- a/editor/src/app/login/login.component.ts +++ b/editor/src/app/login/login.component.ts @@ -27,26 +27,33 @@ import { UserState } from '../user/user.state'; } @else { - @if (appState.isBertaHosting) { + @if ( + appState.isBertaHosting && + (appState.facebookLoginUrl || appState.googleLoginUrl) + ) {
- - -

Log in with Facebook

- - -

Sign in with Google

+ @if (appState.facebookLoginUrl) { + + +

Log in with Facebook

+ } + @if (appState.googleLoginUrl) { + + +

Sign in with Google

+ }

or

} diff --git a/engine/inc.hosting.php b/engine/inc.hosting.php index 09e7fefe..fe819bf1 100644 --- a/engine/inc.hosting.php +++ b/engine/inc.hosting.php @@ -6,6 +6,8 @@ } $options['PLANS'] = isset($hostingConfig['plans']) ? $hostingConfig['plans'] : []; $options['HOSTING_PROFILE'] = isset($hostingConfig['login']) ? $hostingConfig['login'] : false; +$options['GOOGLE_LOGIN'] = isset($hostingConfig['googleLogin']) ? $hostingConfig['googleLogin'] : false; +$options['FACEBOOK_LOGIN'] = isset($hostingConfig['facebookLogin']) ? $hostingConfig['facebookLogin'] : false; $options['FORGOTPASSWORD_LINK'] = isset($hostingConfig['forgotPassword']) ? $hostingConfig['forgotPassword'] : 'https://github.com/berta-cms/berta/wiki/Installation'; $options['INTERCOM_APP_ID'] = isset($hostingConfig['intercomAppId']) ? $hostingConfig['intercomAppId'] : false; $options['INTERCOM_SECRET_KEY'] = isset($hostingConfig['intercomSecretKey']) ? $hostingConfig['intercomSecretKey'] : false;