Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions _api_app/app/Http/Controllers/StateController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 6 additions & 0 deletions _api_app/app/User/UserModel.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions editor/src/app/app-state/app-state.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions editor/src/app/app-state/app.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ const defaultState: AppStateModel = {
tag: null,
urls: {},
forgotPasswordUrl: '',
googleLoginUrl: '',
facebookLoginUrl: '',
isBertaHosting: false,
plans: [],
loginUrl: '',
Expand Down Expand Up @@ -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,
Expand Down
45 changes: 26 additions & 19 deletions editor/src/app/login/login.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,26 +27,33 @@ import { UserState } from '../user/user.state';
<berta-loading></berta-loading>
</div>
} @else {
@if (appState.isBertaHosting) {
@if (
appState.isBertaHosting &&
(appState.facebookLoginUrl || appState.googleLoginUrl)
) {
<div class="form-group social-login">
<a
href="{{ appState.loginUrl }}?remote_redirect={{
appState.authenticateUrl
}}&amp;provider=facebook"
class="button facebook"
>
<bt-icon-facebook></bt-icon-facebook>
<p>Log in with Facebook</p></a
>
<a
href="{{ appState.loginUrl }}?remote_redirect={{
appState.authenticateUrl
}}&amp;provider=google"
class="button google"
>
<bt-icon-google></bt-icon-google>
<p>Sign in with Google</p></a
>
@if (appState.facebookLoginUrl) {
<a
href="{{ appState.facebookLoginUrl }}?remote_redirect={{
appState.authenticateUrl
}}"
class="button facebook"
>
<bt-icon-facebook></bt-icon-facebook>
<p>Log in with Facebook</p></a
>
}
@if (appState.googleLoginUrl) {
<a
href="{{ appState.googleLoginUrl }}?remote_redirect={{
appState.authenticateUrl
}}"
class="button google"
>
<bt-icon-google></bt-icon-google>
<p>Sign in with Google</p></a
>
}
<p>or</p>
</div>
}
Expand Down
2 changes: 2 additions & 0 deletions engine/inc.hosting.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down