Switched the socialite login providers to the new external services configuration #152
This commit is contained in:
parent
cb849c7928
commit
4dc4ce1517
@ -28,19 +28,27 @@ class ExternalService extends Model
|
||||
return ExternalService::where('service_type', $serviceType)->get();
|
||||
}
|
||||
|
||||
public function hasOAuthStandardOptions()
|
||||
{
|
||||
// This logic must be mirrored in external_services.js
|
||||
return in_array($this->service_type, [
|
||||
self::FACEBOOK,
|
||||
self::GOOGLE,
|
||||
self::TWITTER
|
||||
]);
|
||||
}
|
||||
|
||||
public function isDropbox()
|
||||
{
|
||||
// This logic must be mirrored in external_services.js
|
||||
return $this->service_type == self::DROPBOX;
|
||||
}
|
||||
|
||||
public function isFacebook()
|
||||
{
|
||||
// This logic must be mirrored in external_services.js
|
||||
return $this->service_type == self::FACEBOOK;
|
||||
}
|
||||
|
||||
public function isGoogle()
|
||||
{
|
||||
// This logic must be mirrored in external_services.js
|
||||
return $this->service_type == self::GOOGLE;
|
||||
}
|
||||
|
||||
public function isTwitter()
|
||||
{
|
||||
// This logic must be mirrored in external_services.js
|
||||
return $this->service_type == self::TWITTER;
|
||||
}
|
||||
}
|
@ -113,10 +113,8 @@ class ConfigHelper
|
||||
'date_format' => $this->allowedDateFormats()[0],
|
||||
'default_album_view' => $this->allowedAlbumViews()[0],
|
||||
'enable_visitor_hits' => false,
|
||||
'facebook_app_id' => '',
|
||||
'facebook_app_secret' => '',
|
||||
'google_app_id' => '',
|
||||
'google_app_secret' => '',
|
||||
'facebook_external_service_id' => null,
|
||||
'google_external_service_id' => null,
|
||||
'hotlink_protection' => false,
|
||||
'items_per_page' => 12,
|
||||
'items_per_page_admin' => 10,
|
||||
@ -151,8 +149,7 @@ class ConfigHelper
|
||||
'social_user_feeds' => false,
|
||||
'social_user_profiles' => false,
|
||||
'theme' => 'default',
|
||||
'twitter_app_id' => '',
|
||||
'twitter_app_secret' => '',
|
||||
'twitter_external_service_id' => null
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Album;
|
||||
use App\ExternalService;
|
||||
use App\Facade\Theme;
|
||||
use App\Facade\UserConfig;
|
||||
use App\Group;
|
||||
@ -260,10 +261,8 @@ class DefaultController extends Controller
|
||||
'analysis_queue_storage_location',
|
||||
'app_name',
|
||||
'date_format',
|
||||
'facebook_app_id',
|
||||
'facebook_app_secret',
|
||||
'google_app_id',
|
||||
'google_app_secret',
|
||||
'facebook_external_service_id',
|
||||
'google_external_service_id',
|
||||
'photo_comments_allowed_html',
|
||||
'photo_comments_thread_depth',
|
||||
'rabbitmq_server',
|
||||
@ -279,8 +278,7 @@ class DefaultController extends Controller
|
||||
'smtp_username',
|
||||
'smtp_password',
|
||||
'theme',
|
||||
'twitter_app_id',
|
||||
'twitter_app_secret',
|
||||
'twitter_external_service_id',
|
||||
'recaptcha_site_key',
|
||||
'recaptcha_secret_key',
|
||||
'analytics_code'
|
||||
@ -374,12 +372,30 @@ class DefaultController extends Controller
|
||||
// Storage sources for the Image Processing tab
|
||||
$storageSources = AnalysisQueueHelper::getCompatibleStorages();
|
||||
|
||||
// External services
|
||||
$externalServices = ExternalService::all();
|
||||
$facebookServices = $externalServices->filter(function (ExternalService $item)
|
||||
{
|
||||
return $item->service_type == ExternalService::FACEBOOK;
|
||||
});
|
||||
$googleServices = $externalServices->filter(function (ExternalService $item)
|
||||
{
|
||||
return $item->service_type == ExternalService::GOOGLE;
|
||||
});
|
||||
$twitterServices = $externalServices->filter(function (ExternalService $item)
|
||||
{
|
||||
return $item->service_type == ExternalService::TWITTER;
|
||||
});
|
||||
|
||||
return Theme::render('admin.settings', [
|
||||
'config' => $config,
|
||||
'date_formats' => $dateFormatsLookup,
|
||||
'facebookServices' => $facebookServices,
|
||||
'googleServices' => $googleServices,
|
||||
'storage_sources' => $storageSources,
|
||||
'success' => $request->session()->get('success'),
|
||||
'theme_names' => $themeNamesLookup
|
||||
'theme_names' => $themeNamesLookup,
|
||||
'twitterServices' => $twitterServices
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -90,14 +90,30 @@ class ServiceController extends Controller
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
public function create(Request $request)
|
||||
{
|
||||
$this->authorizeAccessToAdminPanel('admin:manage-services');
|
||||
|
||||
$serviceTypes = $this->serviceTypeList();
|
||||
$selectedServiceType = old('service_type', $request->get('service_type'));
|
||||
|
||||
if (!array_key_exists($selectedServiceType, $serviceTypes))
|
||||
{
|
||||
$selectedServiceType = '';
|
||||
}
|
||||
|
||||
$returnTo = old('return_to', $request->get('return_to'));
|
||||
if (!array_key_exists($returnTo, $this->validReturnLocations()))
|
||||
{
|
||||
$returnTo = '';
|
||||
}
|
||||
|
||||
return Theme::render('admin.create_service', [
|
||||
'callbackUrls' => $this->callbackList(),
|
||||
'returnTo' => $returnTo,
|
||||
'selectedServiceType' => $selectedServiceType,
|
||||
'service' => new ExternalService(),
|
||||
'serviceTypes' => $this->serviceTypeList()
|
||||
'serviceTypes' => $serviceTypes
|
||||
]);
|
||||
}
|
||||
|
||||
@ -236,6 +252,14 @@ class ServiceController extends Controller
|
||||
|
||||
$service->save();
|
||||
|
||||
$returnToLocations = $this->validReturnLocations();
|
||||
$returnTo = $request->get('return_to');
|
||||
|
||||
if (array_key_exists($returnTo, $returnToLocations))
|
||||
{
|
||||
return redirect($returnToLocations[$returnTo]);
|
||||
}
|
||||
|
||||
return redirect(route('services.index'));
|
||||
}
|
||||
|
||||
@ -278,7 +302,10 @@ class ServiceController extends Controller
|
||||
$dropboxService = new DropboxService();
|
||||
|
||||
return [
|
||||
ExternalService::DROPBOX => $dropboxService->callbackUrl()
|
||||
ExternalService::DROPBOX => $dropboxService->callbackUrl(),
|
||||
ExternalService::FACEBOOK => route('login_callback.facebook'),
|
||||
ExternalService::GOOGLE => route('login_callback.google'),
|
||||
ExternalService::TWITTER => route('login_callback.twitter')
|
||||
];
|
||||
}
|
||||
|
||||
@ -297,4 +324,11 @@ class ServiceController extends Controller
|
||||
ExternalService::TWITTER => trans(sprintf('services.%s', ExternalService::TWITTER))
|
||||
];
|
||||
}
|
||||
|
||||
private function validReturnLocations()
|
||||
{
|
||||
return [
|
||||
'settings' => route('admin.settings')
|
||||
];
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Auth;
|
||||
|
||||
use App\ExternalService;
|
||||
use App\Facade\Theme;
|
||||
use App\Facade\UserConfig;
|
||||
use App\Helpers\MiscHelper;
|
||||
@ -152,7 +153,12 @@ class LoginController extends Controller
|
||||
*/
|
||||
public function redirectToFacebook()
|
||||
{
|
||||
$socialite = $this->setSocialiteConfigs();
|
||||
$socialite = $this->setSocialiteConfigForFacebook();
|
||||
if (is_null($socialite))
|
||||
{
|
||||
return redirect(route('login'));
|
||||
}
|
||||
|
||||
return $socialite->driver('facebook')->redirect();
|
||||
}
|
||||
|
||||
@ -163,7 +169,12 @@ class LoginController extends Controller
|
||||
*/
|
||||
public function redirectToGoogle()
|
||||
{
|
||||
$socialite = $this->setSocialiteConfigs();
|
||||
$socialite = $this->setSocialiteConfigForGoogle();
|
||||
if (is_null($socialite))
|
||||
{
|
||||
return redirect(route('login'));
|
||||
}
|
||||
|
||||
return $socialite->driver('google')->redirect();
|
||||
}
|
||||
|
||||
@ -174,7 +185,12 @@ class LoginController extends Controller
|
||||
*/
|
||||
public function redirectToTwitter()
|
||||
{
|
||||
$socialite = $this->setSocialiteConfigs();
|
||||
$socialite = $this->setSocialiteConfigForTwitter();
|
||||
if (is_null($socialite))
|
||||
{
|
||||
return redirect(route('login'));
|
||||
}
|
||||
|
||||
return $socialite->driver('twitter')->redirect();
|
||||
}
|
||||
|
||||
@ -185,7 +201,12 @@ class LoginController extends Controller
|
||||
*/
|
||||
public function handleFacebookCallback(Request $request)
|
||||
{
|
||||
$socialite = $this->setSocialiteConfigs();
|
||||
$socialite = $this->setSocialiteConfigForFacebook();
|
||||
if (is_null($socialite))
|
||||
{
|
||||
return redirect(route('login'));
|
||||
}
|
||||
|
||||
$facebookUser = $socialite->driver('facebook')->user();
|
||||
|
||||
return $this->processSocialMediaLogin($request, 'facebook_id', $facebookUser);
|
||||
@ -198,7 +219,12 @@ class LoginController extends Controller
|
||||
*/
|
||||
public function handleGoogleCallback(Request $request)
|
||||
{
|
||||
$socialite = $this->setSocialiteConfigs();
|
||||
$socialite = $this->setSocialiteConfigForGoogle();
|
||||
if (is_null($socialite))
|
||||
{
|
||||
return redirect(route('login'));
|
||||
}
|
||||
|
||||
$googleUser = $socialite->driver('google')->user();
|
||||
|
||||
return $this->processSocialMediaLogin($request, 'google_id', $googleUser);
|
||||
@ -211,12 +237,30 @@ class LoginController extends Controller
|
||||
*/
|
||||
public function handleTwitterCallback(Request $request)
|
||||
{
|
||||
$socialite = $this->setSocialiteConfigs();
|
||||
$socialite = $this->setSocialiteConfigForTwitter();
|
||||
if (is_null($socialite))
|
||||
{
|
||||
return redirect(route('login'));
|
||||
}
|
||||
|
||||
$twitterUser = $socialite->driver('twitter')->user();
|
||||
|
||||
return $this->processSocialMediaLogin($request, 'twitter_id', $twitterUser);
|
||||
}
|
||||
|
||||
private function getSocialMediaConfig($socialMediaEnabledField, $socialMediaExternalServiceIdField)
|
||||
{
|
||||
if (boolval(UserConfig::get($socialMediaEnabledField)))
|
||||
{
|
||||
$externalServiceID = intval(UserConfig::get($socialMediaExternalServiceIdField));
|
||||
$externalService = ExternalService::where('id', $externalServiceID)->first();
|
||||
|
||||
return $externalService;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private function processSocialMediaLogin(Request $request, $socialMediaIdField, $socialMediaUser)
|
||||
{
|
||||
$userBySocialMediaId = User::where($socialMediaIdField, $socialMediaUser->getId())->first();
|
||||
@ -260,38 +304,81 @@ class LoginController extends Controller
|
||||
return redirect(route('auth.register_sso'));
|
||||
}
|
||||
|
||||
private function setSocialiteConfigs()
|
||||
private function setSocialiteConfigForFacebook()
|
||||
{
|
||||
// Force Socialite to use our config from the database instead of hard-coded in config/services.php
|
||||
$facebookConfig = $this->getSocialMediaConfig(
|
||||
'social_facebook_login',
|
||||
'facebook_external_service_id'
|
||||
);
|
||||
|
||||
if (is_null($facebookConfig))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$socialite = app()->make(\Laravel\Socialite\Contracts\Factory::class);
|
||||
$socialite->extend(
|
||||
'facebook',
|
||||
function ($app) use ($socialite) {
|
||||
function ($app) use ($socialite, $facebookConfig) {
|
||||
$config = [
|
||||
'client_id' => trim(UserConfig::get('facebook_app_id')),
|
||||
'client_secret' => trim(decrypt(UserConfig::get('facebook_app_secret'))),
|
||||
'client_id' => trim(decrypt($facebookConfig->app_id)),
|
||||
'client_secret' => trim(decrypt($facebookConfig->app_secret)),
|
||||
'redirect' => route('login_callback.facebook')
|
||||
];
|
||||
return $socialite->buildProvider(FacebookProvider::class, $config);
|
||||
}
|
||||
);
|
||||
|
||||
return $socialite;
|
||||
}
|
||||
|
||||
private function setSocialiteConfigForGoogle()
|
||||
{
|
||||
$googleConfig = $this->getSocialMediaConfig(
|
||||
'social_google_login',
|
||||
'google_external_service_id'
|
||||
);
|
||||
|
||||
if (is_null($googleConfig))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$socialite = app()->make(\Laravel\Socialite\Contracts\Factory::class);
|
||||
$socialite->extend(
|
||||
'google',
|
||||
function ($app) use ($socialite) {
|
||||
function ($app) use ($socialite, $googleConfig) {
|
||||
$config = [
|
||||
'client_id' => trim(UserConfig::get('google_app_id')),
|
||||
'client_secret' => trim(decrypt(UserConfig::get('google_app_secret'))),
|
||||
'client_id' => trim(decrypt($googleConfig->app_id)),
|
||||
'client_secret' => trim(decrypt($googleConfig->app_secret)),
|
||||
'redirect' => route('login_callback.google')
|
||||
];
|
||||
return $socialite->buildProvider(GoogleProvider::class, $config);
|
||||
}
|
||||
);
|
||||
|
||||
return $socialite;
|
||||
}
|
||||
|
||||
private function setSocialiteConfigForTwitter()
|
||||
{
|
||||
$twitterConfig = $this->getSocialMediaConfig(
|
||||
'social_twitter_login',
|
||||
'twitter_external_service_id'
|
||||
);
|
||||
|
||||
if (is_null($twitterConfig))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
$socialite = app()->make(\Laravel\Socialite\Contracts\Factory::class);
|
||||
$socialite->extend(
|
||||
'twitter',
|
||||
function ($app) use ($socialite) {
|
||||
function ($app) use ($socialite, $twitterConfig) {
|
||||
$config = [
|
||||
'identifier' => trim(UserConfig::get('twitter_app_id')),
|
||||
'secret' => trim(decrypt(UserConfig::get('twitter_app_secret'))),
|
||||
'identifier' => trim(decrypt($twitterConfig->app_id)),
|
||||
'secret' => trim(decrypt($twitterConfig->app_secret)),
|
||||
'callback_uri' => route('login_callback.twitter')
|
||||
];
|
||||
return new TwitterProvider($app['request'], new TwitterServer($config));
|
||||
|
@ -5,17 +5,25 @@ function ExternalServiceViewModel()
|
||||
service_type: ''
|
||||
};
|
||||
this.computed = {
|
||||
hasOAuthStandardOptions: function()
|
||||
{
|
||||
// This logic must be mirrored in App\ExternalService
|
||||
return this.service_type === 'facebook' ||
|
||||
this.service_type === 'google' ||
|
||||
this.service_type === 'twitter';
|
||||
},
|
||||
isDropbox: function()
|
||||
{
|
||||
// This logic must be mirrored in App\ExternalService
|
||||
return this.service_type === 'dropbox';
|
||||
},
|
||||
isFacebook: function()
|
||||
{
|
||||
// This logic must be mirrored in App\ExternalService
|
||||
return this.service_type === 'facebook';
|
||||
},
|
||||
isGoogle: function()
|
||||
{
|
||||
// This logic must be mirrored in App\ExternalService
|
||||
return this.service_type === 'google';
|
||||
},
|
||||
isTwitter: function()
|
||||
{
|
||||
// This logic must be mirrored in App\ExternalService
|
||||
return this.service_type === 'twitter';
|
||||
}
|
||||
}
|
||||
}
|
@ -314,10 +314,14 @@ return [
|
||||
'rebuild_permissions_cache_succeeded' => 'The permissions cache rebuild completed successfully.',
|
||||
'security_allow_self_registration' => 'Allow self-registration',
|
||||
'security_allow_self_registration_description' => 'With this option enabled, users can sign up for their own accounts. You can grant permissions to accounts to allow users to upload their own photos or manage yours.',
|
||||
'social_add_external_services_link' => 'Add a new service',
|
||||
'social_facebook' => 'Facebook',
|
||||
'social_facebook_no_services' => 'You haven\'t defined any services for Facebook. Add a new service with your Facebook app ID and secret.',
|
||||
'social_google' => 'Google',
|
||||
'social_google_no_services' => 'You haven\'t defined any services for Google. Add a new service with your Google app ID and secret.',
|
||||
'social_tab' => 'Social',
|
||||
'social_twitter' => 'Twitter'
|
||||
'social_twitter' => 'Twitter',
|
||||
'social_twitter_no_services' => 'You haven\'t defined any services for Twitter. Add a new service with your Twitter app API key and secret.',
|
||||
],
|
||||
'settings_email_tab' => 'E-mail',
|
||||
'settings_general_tab' => 'General',
|
||||
|
@ -82,16 +82,13 @@ return [
|
||||
'settings_moderate_known_users_help' => 'If this option is enabled, comments posted by logged-in users must be moderated before being displayed.',
|
||||
'settings_restrict_originals_download' => 'Restrict access to original images',
|
||||
'settings_restrict_originals_download_help' => 'With this option enabled, only the photo\'s owner can download the original high-resolution images.',
|
||||
'settings_social_facebook_app_id' => 'Facebook App ID:',
|
||||
'settings_social_facebook_app_secret' => 'Facebook App Secret:',
|
||||
'settings_social_facebook_external_service' => 'Facebook service:',
|
||||
'settings_social_facebook_login' => 'Allow login/registration with a Facebook account.',
|
||||
'settings_social_facebook_login_help' => 'With this option enabled, users can register (if enabled) and login with their Facebook account.',
|
||||
'settings_social_google_app_id' => 'Google App ID:',
|
||||
'settings_social_google_app_secret' => 'Google App Secret:',
|
||||
'settings_social_google_external_service' => 'Google service:',
|
||||
'settings_social_google_login' => 'Allow login/registration with a Google account.',
|
||||
'settings_social_google_login_help' => 'With this option enabled, users can register (if enabled) and login with their Google account.',
|
||||
'settings_social_twitter_app_id' => 'Twitter App ID:',
|
||||
'settings_social_twitter_app_secret' => 'Twitter App Secret:',
|
||||
'settings_social_twitter_external_service' => 'Twitter service:',
|
||||
'settings_social_twitter_login' => 'Allow login/registration with a Twitter account',
|
||||
'settings_social_twitter_login_help' => 'With this option enabled, users can register (if enabled) and login with their Twitter account.',
|
||||
'settings_social_user_feeds' => 'Enable user feeds and following',
|
||||
|
@ -32,7 +32,3 @@
|
||||
.text-red {
|
||||
color: #ff0000;
|
||||
}
|
||||
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
@ -28,3 +28,7 @@ textarea {
|
||||
border-top: 0;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
[v-cloak] {
|
||||
display: none;
|
||||
}
|
@ -19,6 +19,8 @@
|
||||
<form action="{{ route('services.store') }}" method="post" id="external-service-options">
|
||||
{{ csrf_field() }}
|
||||
|
||||
<input type="hidden" name="return_to" value="{{ $returnTo }}"/>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="service-type">@lang('forms.service_type_label')</label>
|
||||
<select class="form-control{{ $errors->has('service_type') ? ' is-invalid' : '' }}" id="service-type" name="service_type" value="{{ old('service_type') }}" v-model="service_type">
|
||||
@ -47,11 +49,17 @@
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div v-if="hasOAuthStandardOptions">
|
||||
@include(Theme::viewName('partials.admin_services_oauth_options'))
|
||||
<div v-if="isDropbox" v-cloak>
|
||||
@include(Theme::viewName('partials.admin_services_oauth_options'), ['oauthService' => \App\ExternalService::DROPBOX])
|
||||
</div>
|
||||
<div v-elseif="isDropbox">
|
||||
@include(Theme::viewName('partials.admin_services_dropbox_options'))
|
||||
<div v-else-if="isFacebook" v-cloak>
|
||||
@include(Theme::viewName('partials.admin_services_oauth_options'), ['oauthService' => \App\ExternalService::FACEBOOK])
|
||||
</div>
|
||||
<div v-else-if="isTwitter" v-cloak>
|
||||
@include(Theme::viewName('partials.admin_services_oauth_options'), ['oauthService' => \App\ExternalService::TWITTER])
|
||||
</div>
|
||||
<div v-else-if="isGoogle" v-cloak>
|
||||
@include(Theme::viewName('partials.admin_services_oauth_options'), ['oauthService' => \App\ExternalService::GOOGLE])
|
||||
</div>
|
||||
|
||||
<div class="text-right">
|
||||
@ -71,8 +79,8 @@
|
||||
var viewModel = new ExternalServiceViewModel();
|
||||
var app = new Vue(viewModel);
|
||||
|
||||
@if (strlen(old('service_type')) > 0)
|
||||
app.service_type = '{{ old('service_type') }}';
|
||||
@if (strlen($selectedServiceType) > 0)
|
||||
app.service_type = '{{ $selectedServiceType }}';
|
||||
@endif
|
||||
});
|
||||
</script>
|
||||
|
@ -48,10 +48,14 @@
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@if ($service->hasOAuthStandardOptions())
|
||||
@include(Theme::viewName('partials.admin_services_oauth_options'))
|
||||
@if ($service->isFacebook())
|
||||
@include(Theme::viewName('partials.admin_services_oauth_options'), ['oauthService' => \App\ExternalService::FACEBOOK])
|
||||
@elseif ($service->isGoogle())
|
||||
@include(Theme::viewName('partials.admin_services_oauth_options'), ['oauthService' => \App\ExternalService::GOOGLE])
|
||||
@elseif ($service->isDropbox())
|
||||
@include(Theme::viewName('partials.admin_services_dropbox_options'))
|
||||
@include(Theme::viewName('partials.admin_services_oauth_options'), ['oauthService' => \App\ExternalService::DROPBOX])
|
||||
@elseif ($service->isTwitter())
|
||||
@include(Theme::viewName('partials.admin_services_oauth_options'), ['oauthService' => \App\ExternalService::TWITTER])
|
||||
@endif
|
||||
|
||||
<div class="text-right" style="margin-top: 20px;">
|
||||
|
@ -499,35 +499,36 @@
|
||||
@lang('admin.settings.social_facebook')
|
||||
</legend>
|
||||
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="social-facebook-login" name="social_facebook_login" @if (old('social_facebook_login', $config['social_facebook_login']))checked="checked"@endif>
|
||||
<label class="form-check-label" for="social-facebook-login">
|
||||
<strong>@lang('forms.settings_social_facebook_login')</strong><br/>
|
||||
@lang('forms.settings_social_facebook_login_help')
|
||||
</label>
|
||||
</div>
|
||||
@if (count($facebookServices) == 0)
|
||||
<div class="alert alert-info">
|
||||
<p>@lang('admin.settings.social_facebook_no_services')</p>
|
||||
<p class="mb-0"><a href="{{ route('services.create', ['service_type' => \App\ExternalService::FACEBOOK, 'return_to' => 'settings']) }}"><i class="fas fa-fw fa-sync"></i> @lang('admin.settings.social_add_external_services_link')</a></p>
|
||||
</div>
|
||||
@else
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="social-facebook-login" name="social_facebook_login" @if (old('social_facebook_login', $config['social_facebook_login']))checked="checked"@endif>
|
||||
<label class="form-check-label" for="social-facebook-login">
|
||||
<strong>@lang('forms.settings_social_facebook_login')</strong><br/>
|
||||
@lang('forms.settings_social_facebook_login_help')
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<label class="form-control-label" for="facebook-app-id">@lang('forms.settings_social_facebook_app_id')</label>
|
||||
<input type="text" class="form-control{{ $errors->has('facebook_app_id') ? ' is-invalid' : '' }}" id="facebook-app-id" name="facebook_app_id" value="{{ old('facebook_app_id', $config['facebook_app_id']) }}">
|
||||
<div class="form-group mt-3">
|
||||
<label class="form-control-label" for="facebook-app-id">@lang('forms.settings_social_facebook_external_service')</label>
|
||||
<select name="facebook_external_service_id" class="form-control{{ $errors->has('facebook_external_service_id') ? ' is-invalid' : '' }}">
|
||||
<option{{ is_null(old('facebook_external_service_id', $config['facebook_external_service_id']) ? ' selected="selected"' : '') }}>@lang('forms.please_select')</option>
|
||||
@foreach ($facebookServices as $service)
|
||||
<option value="{{ $service->id }}"{{ old('facebook_external_service_id', $config['facebook_external_service_id'] == $service->id ? ' selected="selected"' : '') }}>{{ $service->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
@if ($errors->has('facebook_app_id'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('facebook_app_id') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<label class="form-control-label" for="facebook-app-secret">@lang('forms.settings_social_facebook_app_secret')</label>
|
||||
<input type="text" class="form-control{{ $errors->has('facebook_app_secret') ? ' is-invalid' : '' }}" id="facebook-app-secret" name="facebook_app_secret" value="{{ old('facebook_app_secret', $config['facebook_app_secret']) }}">
|
||||
|
||||
@if ($errors->has('facebook_app_secret'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('facebook_app_secret') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@if ($errors->has('facebook_external_service_id'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('facebook_external_service_id') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
@ -546,35 +547,36 @@
|
||||
@lang('admin.settings.social_twitter')
|
||||
</legend>
|
||||
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="social-twitter-login" name="social_twitter_login" @if (old('social_twitter_login', $config['social_twitter_login']))checked="checked"@endif>
|
||||
<label class="form-check-label" for="social-twitter-login">
|
||||
<strong>@lang('forms.settings_social_twitter_login')</strong><br/>
|
||||
@lang('forms.settings_social_twitter_login_help')
|
||||
</label>
|
||||
</div>
|
||||
@if (count($twitterServices) == 0)
|
||||
<div class="alert alert-info">
|
||||
<p>@lang('admin.settings.social_twitter_no_services')</p>
|
||||
<p class="mb-0"><a href="{{ route('services.create', ['service_type' => \App\ExternalService::TWITTER, 'return_to' => 'settings']) }}"><i class="fas fa-fw fa-sync"></i> @lang('admin.settings.social_add_external_services_link')</a></p>
|
||||
</div>
|
||||
@else
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="social-twitter-login" name="social_twitter_login" @if (old('social_twitter_login', $config['social_twitter_login']))checked="checked"@endif>
|
||||
<label class="form-check-label" for="social-twitter-login">
|
||||
<strong>@lang('forms.settings_social_twitter_login')</strong><br/>
|
||||
@lang('forms.settings_social_twitter_login_help')
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<label class="form-control-label" for="twitter-app-id">@lang('forms.settings_social_twitter_app_id')</label>
|
||||
<input type="text" class="form-control{{ $errors->has('twitter_app_id') ? ' is-invalid' : '' }}" id="twitter-app-id" name="twitter_app_id" value="{{ old('twitter_app_id', $config['twitter_app_id']) }}">
|
||||
<div class="form-group mt-3">
|
||||
<label class="form-control-label" for="twitter-app-id">@lang('forms.settings_social_twitter_external_service')</label>
|
||||
<select name="twitter_external_service_id" class="form-control{{ $errors->has('twitter_external_service_id') ? ' is-invalid' : '' }}">
|
||||
<option{{ is_null(old('twitter_external_service_id', $config['twitter_external_service_id']) ? ' selected="selected"' : '') }}>@lang('forms.please_select')</option>
|
||||
@foreach ($twitterServices as $service)
|
||||
<option value="{{ $service->id }}"{{ old('twitter_external_service_id', $config['twitter_external_service_id'] == $service->id ? ' selected="selected"' : '') }}>{{ $service->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
@if ($errors->has('twitter_app_id'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('twitter_app_id') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<label class="form-control-label" for="twitter-app-secret">@lang('forms.settings_social_twitter_app_secret')</label>
|
||||
<input type="text" class="form-control{{ $errors->has('twitter_app_secret') ? ' is-invalid' : '' }}" id="twitter-app-secret" name="twitter_app_secret" value="{{ old('twitter_app_secret', $config['twitter_app_secret']) }}">
|
||||
|
||||
@if ($errors->has('twitter_app_secret'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('twitter_app_secret') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@if ($errors->has('twitter_external_service_id'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('twitter_external_service_id') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
@endif
|
||||
</fieldset>
|
||||
</div>
|
||||
</div>
|
||||
@ -593,32 +595,33 @@
|
||||
@lang('admin.settings.social_google')
|
||||
</legend>
|
||||
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="social-google-login" name="social_google_login" @if (old('social_google_login', $config['social_google_login']))checked="checked"@endif>
|
||||
<label class="form-check-label" for="social-google-login">
|
||||
<strong>@lang('forms.settings_social_google_login')</strong><br/>
|
||||
@lang('forms.settings_social_google_login_help')
|
||||
</label>
|
||||
</div>
|
||||
@if (count($googleServices) == 0)
|
||||
<div class="alert alert-info">
|
||||
<p>@lang('admin.settings.social_google_no_services')</p>
|
||||
<p class="mb-0"><a href="{{ route('services.create', ['service_type' => \App\ExternalService::GOOGLE, 'return_to' => 'settings']) }}"><i class="fas fa-fw fa-sync"></i> @lang('admin.settings.social_add_external_services_link')</a></p>
|
||||
</div>
|
||||
@else
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="social-google-login" name="social_google_login" @if (old('social_google_login', $config['social_google_login']))checked="checked"@endif>
|
||||
<label class="form-check-label" for="social-google-login">
|
||||
<strong>@lang('forms.settings_social_google_login')</strong><br/>
|
||||
@lang('forms.settings_social_google_login_help')
|
||||
</label>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<label class="form-control-label" for="google-app-id">@lang('forms.settings_social_google_app_id')</label>
|
||||
<input type="text" class="form-control{{ $errors->has('google_app_id') ? ' is-invalid' : '' }}" id="google-app-id" name="google_app_id" value="{{ old('google_app_id', $config['google_app_id']) }}">
|
||||
<label class="form-control-label" for="google-app-id">@lang('forms.settings_social_google_external_service')</label>
|
||||
<select name="google_external_service_id" class="form-control{{ $errors->has('google_external_service_id') ? ' is-invalid' : '' }}">
|
||||
<option{{ is_null(old('google_external_service_id', $config['google_external_service_id']) ? ' selected="selected"' : '') }}>@lang('forms.please_select')</option>
|
||||
@foreach ($googleServices as $service)
|
||||
<option value="{{ $service->id }}"{{ old('google_external_service_id', $config['google_external_service_id'] == $service->id ? ' selected="selected"' : '') }}>{{ $service->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
|
||||
@if ($errors->has('google_app_id'))
|
||||
@if ($errors->has('google_external_service_id'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('google_app_id') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="form-group mt-3">
|
||||
<label class="form-control-label" for="google-app-secret">@lang('forms.settings_social_google_app_secret')</label>
|
||||
<input type="text" class="form-control{{ $errors->has('google_app_secret') ? ' is-invalid' : '' }}" id="google-app-secret" name="google_app_secret" value="{{ old('google_app_secret', $config['google_app_secret']) }}">
|
||||
|
||||
@if ($errors->has('google_app_secret'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('google_app_secret') }}</strong>
|
||||
<strong>{{ $errors->first('google_external_service_id') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
@ -1,31 +0,0 @@
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="access-key">@lang('forms.service_app_id_label')</label>
|
||||
<input type="text" class="form-control{{ $errors->has('app_id') ? ' is-invalid' : '' }}" id="app-id" name="app_id" value="{{ old('app_id', $service->app_id) }}">
|
||||
|
||||
@if ($errors->has('app_id'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('app_id') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="form-control-label" for="secret-key">@lang('forms.service_app_secret_label')</label>
|
||||
<input type="text" class="form-control{{ $errors->has('app_secret') ? ' is-invalid' : '' }}" id="app-secret" name="app_secret" value="{{ old('app_secret', $service->app_secret) }}">
|
||||
|
||||
@if ($errors->has('app_secret'))
|
||||
<div class="invalid-feedback">
|
||||
<strong>{{ $errors->first('app_secret') }}</strong>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="alert alert-info">
|
||||
<p>@lang('admin.service_callback_intro', ['name' => trans(sprintf('services.%s', \App\ExternalService::DROPBOX))])</p>
|
||||
<p class="mb-0"><b>{{ $callbackUrls[\App\ExternalService::DROPBOX] }}</b></p>
|
||||
</div>
|
@ -24,3 +24,10 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@if (isset($callbackUrls[$oauthService]))
|
||||
<div class="alert alert-info">
|
||||
<p>@lang('admin.service_callback_intro', ['name' => trans(sprintf('services.%s', $oauthService))])</p>
|
||||
<p class="mb-0"><b>{{ $callbackUrls[$oauthService] }}</b></p>
|
||||
</div>
|
||||
@endif
|
@ -1,11 +1,11 @@
|
||||
<p class="text-center" style="font-size: xx-large;">
|
||||
@if (UserConfig::get('social_facebook_login'))
|
||||
<a href="{{ route('login.facebook') }}"><i class="fa fa-facebook fa-fw"></i></a>
|
||||
<a href="{{ route('login.facebook') }}"><i class="fab fa-facebook fa-fw"></i></a>
|
||||
@endif
|
||||
@if (UserConfig::get('social_twitter_login'))
|
||||
<a href="{{ route('login.twitter') }}"><i class="fa fa-twitter fa-fw"></i></a>
|
||||
<a href="{{ route('login.twitter') }}"><i class="fab fa-twitter fa-fw"></i></a>
|
||||
@endif
|
||||
@if (UserConfig::get('social_google_login'))
|
||||
<a href="{{ route('login.google') }}"><i class="fa fa-google fa-fw"></i></a>
|
||||
<a href="{{ route('login.google') }}"><i class="fab fa-google fa-fw"></i></a>
|
||||
@endif
|
||||
</p>
|
Loading…
Reference in New Issue
Block a user