Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[ljcom] r9320: LJSUP-6137 (FaceBook authorization. Serv...

Committer: ailyin
LJSUP-6137 (FaceBook authorization. Server side): disable flags
U   trunk/cgi-bin/LJ/Identity/Facebook.pm
U   trunk/cgi-bin/LJ/Setting/TwitterConnect.pm
U   trunk/cgi-bin/LJ/Talk/Author/Facebook.pm
U   trunk/htdocs/identity/callback-facebook.bml
U   trunk/htdocs/manage/settings/facebook.bml
U   trunk/htdocs/manage/settings/twitter.bml
Modified: trunk/cgi-bin/LJ/Identity/Facebook.pm
===================================================================
--- trunk/cgi-bin/LJ/Identity/Facebook.pm	2010-08-09 04:17:05 UTC (rev 9319)
+++ trunk/cgi-bin/LJ/Identity/Facebook.pm	2010-08-09 05:24:20 UTC (rev 9320)
@@ -9,6 +9,11 @@
 sub pretty_type { 'Facebook' }
 sub short_code { 'facebook' }
 
+sub enabled {
+    return LJ::is_enabled('facebook_auth')
+        && $LJ::FACEBOOK_CONNECT_API_KEY;
+}
+
 my @request_permissions = qw( publish_stream offline_access email
                               user_about_me user_birthday user_hometown
                               user_interests user_website );

Modified: trunk/cgi-bin/LJ/Setting/TwitterConnect.pm
===================================================================
--- trunk/cgi-bin/LJ/Setting/TwitterConnect.pm	2010-08-09 04:17:05 UTC (rev 9319)
+++ trunk/cgi-bin/LJ/Setting/TwitterConnect.pm	2010-08-09 05:24:20 UTC (rev 9320)
@@ -9,7 +9,8 @@
     my ( $class, $u ) = @_;
 
     return $u
-        && LJ::is_enabled( "twitter_connect", $u )
+        && LJ::is_enabled( "repost_twitter", $u )
+        && $LJ::TWITTER_CONSUMER_KEY
         && ( $u->is_personal || $u->is_identity ) ? 1 : 0;
 }
 

Modified: trunk/cgi-bin/LJ/Talk/Author/Facebook.pm
===================================================================
--- trunk/cgi-bin/LJ/Talk/Author/Facebook.pm	2010-08-09 04:17:05 UTC (rev 9319)
+++ trunk/cgi-bin/LJ/Talk/Author/Facebook.pm	2010-08-09 05:24:20 UTC (rev 9320)
@@ -3,6 +3,10 @@
 
 use base qw(LJ::Talk::Author);
 
+sub enabled {
+    return LJ::Identity::Facebook->enabled;
+}
+
 sub display_params {
     my ($class, $opts) = @_;
 

Modified: trunk/htdocs/identity/callback-facebook.bml
===================================================================
--- trunk/htdocs/identity/callback-facebook.bml	2010-08-09 04:17:05 UTC (rev 9319)
+++ trunk/htdocs/identity/callback-facebook.bml	2010-08-09 05:24:20 UTC (rev 9320)
@@ -13,6 +13,9 @@
     my $returl_fail = LJ::Request->get_param('ret_fail') ||
                       $returl ||$LJ::SITEROOT;
 
+    return LJ::Request->redirect($returl_fail)
+        unless LJ::Identity::Facebook->enabled;
+
     my $fb_code = LJ::Request->get_param('code');
 
     return LJ::Request->redirect($returl_fail) unless $fb_code;

Modified: trunk/htdocs/manage/settings/facebook.bml
===================================================================
--- trunk/htdocs/manage/settings/facebook.bml	2010-08-09 04:17:05 UTC (rev 9319)
+++ trunk/htdocs/manage/settings/facebook.bml	2010-08-09 05:24:20 UTC (rev 9320)
@@ -13,6 +13,11 @@
     my $act    = LJ::Request->get_param('act');
     my $settings_page = "$LJ::SITEROOT/manage/settings/?cat=privacy";
 
+    # the feature is disabled, go away
+    return LJ::Request->redirect($settings_page)
+        unless LJ::is_enabled('repost_facebook')
+            && $LJ::FACEBOOK_CONNECT_API_KEY;
+
     # bogus remote or parameters, redirect them back to settings
     return LJ::Request->redirect($settings_page)
         unless $remote

Modified: trunk/htdocs/manage/settings/twitter.bml
===================================================================
--- trunk/htdocs/manage/settings/twitter.bml	2010-08-09 04:17:05 UTC (rev 9319)
+++ trunk/htdocs/manage/settings/twitter.bml	2010-08-09 05:24:20 UTC (rev 9320)
@@ -15,6 +15,11 @@
     my $act    = LJ::Request->get_param('act');
     my $settings_page = "$LJ::SITEROOT/manage/settings/?cat=privacy";
 
+    # the feature is disabled, go away
+    return LJ::Request->redirect($settings_page)
+        unless LJ::is_enabled('repost_twitter')
+            && $LJ::TWITTER_CONSUMER_KEY;
+
     # bogus remote or parameters, redirect them back to settings
     return LJ::Request->redirect($settings_page)
         unless $remote

Tags: andy, bml, ljcom, pm
Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments