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();
|
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()
|
public function isDropbox()
|
||||||
{
|
{
|
||||||
// This logic must be mirrored in external_services.js
|
// This logic must be mirrored in external_services.js
|
||||||
return $this->service_type == self::DROPBOX;
|
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],
|
'date_format' => $this->allowedDateFormats()[0],
|
||||||
'default_album_view' => $this->allowedAlbumViews()[0],
|
'default_album_view' => $this->allowedAlbumViews()[0],
|
||||||
'enable_visitor_hits' => false,
|
'enable_visitor_hits' => false,
|
||||||
'facebook_app_id' => '',
|
'facebook_external_service_id' => null,
|
||||||
'facebook_app_secret' => '',
|
'google_external_service_id' => null,
|
||||||
'google_app_id' => '',
|
|
||||||
'google_app_secret' => '',
|
|
||||||
'hotlink_protection' => false,
|
'hotlink_protection' => false,
|
||||||
'items_per_page' => 12,
|
'items_per_page' => 12,
|
||||||
'items_per_page_admin' => 10,
|
'items_per_page_admin' => 10,
|
||||||
@ -151,8 +149,7 @@ class ConfigHelper
|
|||||||
'social_user_feeds' => false,
|
'social_user_feeds' => false,
|
||||||
'social_user_profiles' => false,
|
'social_user_profiles' => false,
|
||||||
'theme' => 'default',
|
'theme' => 'default',
|
||||||
'twitter_app_id' => '',
|
'twitter_external_service_id' => null
|
||||||
'twitter_app_secret' => '',
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers\Admin;
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
use App\Album;
|
use App\Album;
|
||||||
|
use App\ExternalService;
|
||||||
use App\Facade\Theme;
|
use App\Facade\Theme;
|
||||||
use App\Facade\UserConfig;
|
use App\Facade\UserConfig;
|
||||||
use App\Group;
|
use App\Group;
|
||||||
@ -260,10 +261,8 @@ class DefaultController extends Controller
|
|||||||
'analysis_queue_storage_location',
|
'analysis_queue_storage_location',
|
||||||
'app_name',
|
'app_name',
|
||||||
'date_format',
|
'date_format',
|
||||||
'facebook_app_id',
|
'facebook_external_service_id',
|
||||||
'facebook_app_secret',
|
'google_external_service_id',
|
||||||
'google_app_id',
|
|
||||||
'google_app_secret',
|
|
||||||
'photo_comments_allowed_html',
|
'photo_comments_allowed_html',
|
||||||
'photo_comments_thread_depth',
|
'photo_comments_thread_depth',
|
||||||
'rabbitmq_server',
|
'rabbitmq_server',
|
||||||
@ -279,8 +278,7 @@ class DefaultController extends Controller
|
|||||||
'smtp_username',
|
'smtp_username',
|
||||||
'smtp_password',
|
'smtp_password',
|
||||||
'theme',
|
'theme',
|
||||||
'twitter_app_id',
|
'twitter_external_service_id',
|
||||||
'twitter_app_secret',
|
|
||||||
'recaptcha_site_key',
|
'recaptcha_site_key',
|
||||||
'recaptcha_secret_key',
|
'recaptcha_secret_key',
|
||||||
'analytics_code'
|
'analytics_code'
|
||||||
@ -374,12 +372,30 @@ class DefaultController extends Controller
|
|||||||
// Storage sources for the Image Processing tab
|
// Storage sources for the Image Processing tab
|
||||||
$storageSources = AnalysisQueueHelper::getCompatibleStorages();
|
$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', [
|
return Theme::render('admin.settings', [
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
'date_formats' => $dateFormatsLookup,
|
'date_formats' => $dateFormatsLookup,
|
||||||
|
'facebookServices' => $facebookServices,
|
||||||
|
'googleServices' => $googleServices,
|
||||||
'storage_sources' => $storageSources,
|
'storage_sources' => $storageSources,
|
||||||
'success' => $request->session()->get('success'),
|
'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
|
* @return \Illuminate\Http\Response
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function create(Request $request)
|
||||||
{
|
{
|
||||||
$this->authorizeAccessToAdminPanel('admin:manage-services');
|
$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', [
|
return Theme::render('admin.create_service', [
|
||||||
'callbackUrls' => $this->callbackList(),
|
'callbackUrls' => $this->callbackList(),
|
||||||
|
'returnTo' => $returnTo,
|
||||||
|
'selectedServiceType' => $selectedServiceType,
|
||||||
'service' => new ExternalService(),
|
'service' => new ExternalService(),
|
||||||
'serviceTypes' => $this->serviceTypeList()
|
'serviceTypes' => $serviceTypes
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -236,6 +252,14 @@ class ServiceController extends Controller
|
|||||||
|
|
||||||
$service->save();
|
$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'));
|
return redirect(route('services.index'));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +302,10 @@ class ServiceController extends Controller
|
|||||||
$dropboxService = new DropboxService();
|
$dropboxService = new DropboxService();
|
||||||
|
|
||||||
return [
|
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))
|
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;
|
namespace App\Http\Controllers\Auth;
|
||||||
|
|
||||||
|
use App\ExternalService;
|
||||||
use App\Facade\Theme;
|
use App\Facade\Theme;
|
||||||
use App\Facade\UserConfig;
|
use App\Facade\UserConfig;
|
||||||
use App\Helpers\MiscHelper;
|
use App\Helpers\MiscHelper;
|
||||||
@ -152,7 +153,12 @@ class LoginController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function redirectToFacebook()
|
public function redirectToFacebook()
|
||||||
{
|
{
|
||||||
$socialite = $this->setSocialiteConfigs();
|
$socialite = $this->setSocialiteConfigForFacebook();
|
||||||
|
if (is_null($socialite))
|
||||||
|
{
|
||||||
|
return redirect(route('login'));
|
||||||
|
}
|
||||||
|
|
||||||
return $socialite->driver('facebook')->redirect();
|
return $socialite->driver('facebook')->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +169,12 @@ class LoginController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function redirectToGoogle()
|
public function redirectToGoogle()
|
||||||
{
|
{
|
||||||
$socialite = $this->setSocialiteConfigs();
|
$socialite = $this->setSocialiteConfigForGoogle();
|
||||||
|
if (is_null($socialite))
|
||||||
|
{
|
||||||
|
return redirect(route('login'));
|
||||||
|
}
|
||||||
|
|
||||||
return $socialite->driver('google')->redirect();
|
return $socialite->driver('google')->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +185,12 @@ class LoginController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function redirectToTwitter()
|
public function redirectToTwitter()
|
||||||
{
|
{
|
||||||
$socialite = $this->setSocialiteConfigs();
|
$socialite = $this->setSocialiteConfigForTwitter();
|
||||||
|
if (is_null($socialite))
|
||||||
|
{
|
||||||
|
return redirect(route('login'));
|
||||||
|
}
|
||||||
|
|
||||||
return $socialite->driver('twitter')->redirect();
|
return $socialite->driver('twitter')->redirect();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,7 +201,12 @@ class LoginController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function handleFacebookCallback(Request $request)
|
public function handleFacebookCallback(Request $request)
|
||||||
{
|
{
|
||||||
$socialite = $this->setSocialiteConfigs();
|
$socialite = $this->setSocialiteConfigForFacebook();
|
||||||
|
if (is_null($socialite))
|
||||||
|
{
|
||||||
|
return redirect(route('login'));
|
||||||
|
}
|
||||||
|
|
||||||
$facebookUser = $socialite->driver('facebook')->user();
|
$facebookUser = $socialite->driver('facebook')->user();
|
||||||
|
|
||||||
return $this->processSocialMediaLogin($request, 'facebook_id', $facebookUser);
|
return $this->processSocialMediaLogin($request, 'facebook_id', $facebookUser);
|
||||||
@ -198,7 +219,12 @@ class LoginController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function handleGoogleCallback(Request $request)
|
public function handleGoogleCallback(Request $request)
|
||||||
{
|
{
|
||||||
$socialite = $this->setSocialiteConfigs();
|
$socialite = $this->setSocialiteConfigForGoogle();
|
||||||
|
if (is_null($socialite))
|
||||||
|
{
|
||||||
|
return redirect(route('login'));
|
||||||
|
}
|
||||||
|
|
||||||
$googleUser = $socialite->driver('google')->user();
|
$googleUser = $socialite->driver('google')->user();
|
||||||
|
|
||||||
return $this->processSocialMediaLogin($request, 'google_id', $googleUser);
|
return $this->processSocialMediaLogin($request, 'google_id', $googleUser);
|
||||||
@ -211,12 +237,30 @@ class LoginController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function handleTwitterCallback(Request $request)
|
public function handleTwitterCallback(Request $request)
|
||||||
{
|
{
|
||||||
$socialite = $this->setSocialiteConfigs();
|
$socialite = $this->setSocialiteConfigForTwitter();
|
||||||
|
if (is_null($socialite))
|
||||||
|
{
|
||||||
|
return redirect(route('login'));
|
||||||
|
}
|
||||||
|
|
||||||
$twitterUser = $socialite->driver('twitter')->user();
|
$twitterUser = $socialite->driver('twitter')->user();
|
||||||
|
|
||||||
return $this->processSocialMediaLogin($request, 'twitter_id', $twitterUser);
|
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)
|
private function processSocialMediaLogin(Request $request, $socialMediaIdField, $socialMediaUser)
|
||||||
{
|
{
|
||||||
$userBySocialMediaId = User::where($socialMediaIdField, $socialMediaUser->getId())->first();
|
$userBySocialMediaId = User::where($socialMediaIdField, $socialMediaUser->getId())->first();
|
||||||
@ -260,38 +304,81 @@ class LoginController extends Controller
|
|||||||
return redirect(route('auth.register_sso'));
|
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 = app()->make(\Laravel\Socialite\Contracts\Factory::class);
|
||||||
$socialite->extend(
|
$socialite->extend(
|
||||||
'facebook',
|
'facebook',
|
||||||
function ($app) use ($socialite) {
|
function ($app) use ($socialite, $facebookConfig) {
|
||||||
$config = [
|
$config = [
|
||||||
'client_id' => trim(UserConfig::get('facebook_app_id')),
|
'client_id' => trim(decrypt($facebookConfig->app_id)),
|
||||||
'client_secret' => trim(decrypt(UserConfig::get('facebook_app_secret'))),
|
'client_secret' => trim(decrypt($facebookConfig->app_secret)),
|
||||||
'redirect' => route('login_callback.facebook')
|
'redirect' => route('login_callback.facebook')
|
||||||
];
|
];
|
||||||
return $socialite->buildProvider(FacebookProvider::class, $config);
|
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(
|
$socialite->extend(
|
||||||
'google',
|
'google',
|
||||||
function ($app) use ($socialite) {
|
function ($app) use ($socialite, $googleConfig) {
|
||||||
$config = [
|
$config = [
|
||||||
'client_id' => trim(UserConfig::get('google_app_id')),
|
'client_id' => trim(decrypt($googleConfig->app_id)),
|
||||||
'client_secret' => trim(decrypt(UserConfig::get('google_app_secret'))),
|
'client_secret' => trim(decrypt($googleConfig->app_secret)),
|
||||||
'redirect' => route('login_callback.google')
|
'redirect' => route('login_callback.google')
|
||||||
];
|
];
|
||||||
return $socialite->buildProvider(GoogleProvider::class, $config);
|
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(
|
$socialite->extend(
|
||||||
'twitter',
|
'twitter',
|
||||||
function ($app) use ($socialite) {
|
function ($app) use ($socialite, $twitterConfig) {
|
||||||
$config = [
|
$config = [
|
||||||
'identifier' => trim(UserConfig::get('twitter_app_id')),
|
'identifier' => trim(decrypt($twitterConfig->app_id)),
|
||||||
'secret' => trim(decrypt(UserConfig::get('twitter_app_secret'))),
|
'secret' => trim(decrypt($twitterConfig->app_secret)),
|
||||||
'callback_uri' => route('login_callback.twitter')
|
'callback_uri' => route('login_callback.twitter')
|
||||||
];
|
];
|
||||||
return new TwitterProvider($app['request'], new TwitterServer($config));
|
return new TwitterProvider($app['request'], new TwitterServer($config));
|
||||||
|
@ -5,17 +5,25 @@ function ExternalServiceViewModel()
|
|||||||
service_type: ''
|
service_type: ''
|
||||||
};
|
};
|
||||||
this.computed = {
|
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()
|
isDropbox: function()
|
||||||
{
|
{
|
||||||
// This logic must be mirrored in App\ExternalService
|
// This logic must be mirrored in App\ExternalService
|
||||||
return this.service_type === 'dropbox';
|
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.',
|
'rebuild_permissions_cache_succeeded' => 'The permissions cache rebuild completed successfully.',
|
||||||
'security_allow_self_registration' => 'Allow self-registration',
|
'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.',
|
'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' => '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' => '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_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_email_tab' => 'E-mail',
|
||||||
'settings_general_tab' => 'General',
|
'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_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' => '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_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_external_service' => 'Facebook service:',
|
||||||
'settings_social_facebook_app_secret' => 'Facebook App Secret:',
|
|
||||||
'settings_social_facebook_login' => 'Allow login/registration with a Facebook account.',
|
'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_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_external_service' => 'Google service:',
|
||||||
'settings_social_google_app_secret' => 'Google App Secret:',
|
|
||||||
'settings_social_google_login' => 'Allow login/registration with a Google account.',
|
'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_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_external_service' => 'Twitter service:',
|
||||||
'settings_social_twitter_app_secret' => 'Twitter App Secret:',
|
|
||||||
'settings_social_twitter_login' => 'Allow login/registration with a Twitter account',
|
'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_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',
|
'settings_social_user_feeds' => 'Enable user feeds and following',
|
||||||
|
@ -32,7 +32,3 @@
|
|||||||
.text-red {
|
.text-red {
|
||||||
color: #ff0000;
|
color: #ff0000;
|
||||||
}
|
}
|
||||||
|
|
||||||
[v-cloak] {
|
|
||||||
display: none;
|
|
||||||
}
|
|
@ -28,3 +28,7 @@ textarea {
|
|||||||
border-top: 0;
|
border-top: 0;
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[v-cloak] {
|
||||||
|
display: none;
|
||||||
|
}
|
@ -19,6 +19,8 @@
|
|||||||
<form action="{{ route('services.store') }}" method="post" id="external-service-options">
|
<form action="{{ route('services.store') }}" method="post" id="external-service-options">
|
||||||
{{ csrf_field() }}
|
{{ csrf_field() }}
|
||||||
|
|
||||||
|
<input type="hidden" name="return_to" value="{{ $returnTo }}"/>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label class="form-control-label" for="service-type">@lang('forms.service_type_label')</label>
|
<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">
|
<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
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="hasOAuthStandardOptions">
|
<div v-if="isDropbox" v-cloak>
|
||||||
@include(Theme::viewName('partials.admin_services_oauth_options'))
|
@include(Theme::viewName('partials.admin_services_oauth_options'), ['oauthService' => \App\ExternalService::DROPBOX])
|
||||||
</div>
|
</div>
|
||||||
<div v-elseif="isDropbox">
|
<div v-else-if="isFacebook" v-cloak>
|
||||||
@include(Theme::viewName('partials.admin_services_dropbox_options'))
|
@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>
|
||||||
|
|
||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
@ -71,8 +79,8 @@
|
|||||||
var viewModel = new ExternalServiceViewModel();
|
var viewModel = new ExternalServiceViewModel();
|
||||||
var app = new Vue(viewModel);
|
var app = new Vue(viewModel);
|
||||||
|
|
||||||
@if (strlen(old('service_type')) > 0)
|
@if (strlen($selectedServiceType) > 0)
|
||||||
app.service_type = '{{ old('service_type') }}';
|
app.service_type = '{{ $selectedServiceType }}';
|
||||||
@endif
|
@endif
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -48,10 +48,14 @@
|
|||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@if ($service->hasOAuthStandardOptions())
|
@if ($service->isFacebook())
|
||||||
@include(Theme::viewName('partials.admin_services_oauth_options'))
|
@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())
|
@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
|
@endif
|
||||||
|
|
||||||
<div class="text-right" style="margin-top: 20px;">
|
<div class="text-right" style="margin-top: 20px;">
|
||||||
|
@ -499,6 +499,12 @@
|
|||||||
@lang('admin.settings.social_facebook')
|
@lang('admin.settings.social_facebook')
|
||||||
</legend>
|
</legend>
|
||||||
|
|
||||||
|
@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">
|
<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>
|
<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">
|
<label class="form-check-label" for="social-facebook-login">
|
||||||
@ -508,26 +514,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group mt-3">
|
<div class="form-group mt-3">
|
||||||
<label class="form-control-label" for="facebook-app-id">@lang('forms.settings_social_facebook_app_id')</label>
|
<label class="form-control-label" for="facebook-app-id">@lang('forms.settings_social_facebook_external_service')</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']) }}">
|
<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'))
|
@if ($errors->has('facebook_external_service_id'))
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
<strong>{{ $errors->first('facebook_app_id') }}</strong>
|
<strong>{{ $errors->first('facebook_external_service_id') }}</strong>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</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
|
@endif
|
||||||
</div>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -546,6 +547,12 @@
|
|||||||
@lang('admin.settings.social_twitter')
|
@lang('admin.settings.social_twitter')
|
||||||
</legend>
|
</legend>
|
||||||
|
|
||||||
|
@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">
|
<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>
|
<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">
|
<label class="form-check-label" for="social-twitter-login">
|
||||||
@ -555,26 +562,21 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group mt-3">
|
<div class="form-group mt-3">
|
||||||
<label class="form-control-label" for="twitter-app-id">@lang('forms.settings_social_twitter_app_id')</label>
|
<label class="form-control-label" for="twitter-app-id">@lang('forms.settings_social_twitter_external_service')</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']) }}">
|
<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'))
|
@if ($errors->has('twitter_external_service_id'))
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
<strong>{{ $errors->first('twitter_app_id') }}</strong>
|
<strong>{{ $errors->first('twitter_external_service_id') }}</strong>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</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
|
@endif
|
||||||
</div>
|
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -593,6 +595,12 @@
|
|||||||
@lang('admin.settings.social_google')
|
@lang('admin.settings.social_google')
|
||||||
</legend>
|
</legend>
|
||||||
|
|
||||||
|
@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">
|
<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>
|
<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">
|
<label class="form-check-label" for="social-google-login">
|
||||||
@ -600,25 +608,20 @@
|
|||||||
@lang('forms.settings_social_google_login_help')
|
@lang('forms.settings_social_google_login_help')
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<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']) }}">
|
|
||||||
|
|
||||||
@if ($errors->has('google_app_id'))
|
|
||||||
<div class="invalid-feedback">
|
|
||||||
<strong>{{ $errors->first('google_app_id') }}</strong>
|
|
||||||
</div>
|
|
||||||
@endif
|
@endif
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="form-group mt-3">
|
<div class="form-group mt-3">
|
||||||
<label class="form-control-label" for="google-app-secret">@lang('forms.settings_social_google_app_secret')</label>
|
<label class="form-control-label" for="google-app-id">@lang('forms.settings_social_google_external_service')</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']) }}">
|
<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_secret'))
|
@if ($errors->has('google_external_service_id'))
|
||||||
<div class="invalid-feedback">
|
<div class="invalid-feedback">
|
||||||
<strong>{{ $errors->first('google_app_secret') }}</strong>
|
<strong>{{ $errors->first('google_external_service_id') }}</strong>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</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>
|
</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;">
|
<p class="text-center" style="font-size: xx-large;">
|
||||||
@if (UserConfig::get('social_facebook_login'))
|
@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
|
@endif
|
||||||
@if (UserConfig::get('social_twitter_login'))
|
@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
|
@endif
|
||||||
@if (UserConfig::get('social_google_login'))
|
@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
|
@endif
|
||||||
</p>
|
</p>
|
Loading…
Reference in New Issue
Block a user