[Bps-public-commit] jifty-plugin-authentication-twitter branch, master, updated. 14edf452535eecc8fd0ce3c376305a6599ccbc44
Shawn Moore
sartak at bestpractical.com
Tue Jun 8 12:46:17 EDT 2010
The branch, master has been updated
via 14edf452535eecc8fd0ce3c376305a6599ccbc44 (commit)
from e690a32a264d279005d0e847fd8371c617f6b311 (commit)
Summary of changes:
.../Twitter/Action/LinkTwitterUser.pm | 60 --------------
.../Twitter/Action/LoginTwitterUser.pm | 86 --------------------
2 files changed, 0 insertions(+), 146 deletions(-)
delete mode 100644 lib/Jifty/Plugin/Authentication/Twitter/Action/LinkTwitterUser.pm
delete mode 100644 lib/Jifty/Plugin/Authentication/Twitter/Action/LoginTwitterUser.pm
- Log -----------------------------------------------------------------
commit 14edf452535eecc8fd0ce3c376305a6599ccbc44
Author: Shawn M Moore <sartak at bestpractical.com>
Date: Tue Jun 8 12:47:06 2010 -0400
Get rid of actions, going a different way with it
diff --git a/lib/Jifty/Plugin/Authentication/Twitter/Action/LinkTwitterUser.pm b/lib/Jifty/Plugin/Authentication/Twitter/Action/LinkTwitterUser.pm
deleted file mode 100644
index 4845d71..0000000
--- a/lib/Jifty/Plugin/Authentication/Twitter/Action/LinkTwitterUser.pm
+++ /dev/null
@@ -1,60 +0,0 @@
-use warnings;
-use strict;
-
-=head1 NAME
-
-Jifty::Plugin::Authentication::Twitter::Action::LinkTwitterUser - link Twitter user to current user
-
-=cut
-
-package Jifty::Plugin::Authentication::Twitter::Action::LinkTwitterUser;
-use base qw/Jifty::Action/;
-
-=head1 ARGUMENTS
-
-=cut
-
-use Jifty::Param::Schema;
-use Jifty::Action schema {
-};
-
-=head1 METHODS
-
-=head2 take_action
-
-Get the session key using the Twitter API. Link to current user.
-
-=cut
-
-sub take_action {
- my $self = shift;
-
- if ( not Jifty->web->current_user->id ) {
- $self->result->error(_("You must be logged in to link your user to your Twitter account."));
- return;
- }
-
- my $user = Jifty->web->current_user->user_object;
-
- my $name = 'xxx';
-
- # Set data
- $user->__set( column => 'twitter_name', value => $name );
-
- # Success!
- $self->report_success;
-
- return 1;
-}
-
-=head2 report_success
-
-=cut
-
-sub report_success {
- my $self = shift;
- $self->result->message(_("Your account has been successfully linked to your Twitter user %1!", Jifty->web->current_user->user_object->twitter_name ));
-}
-
-1;
-
diff --git a/lib/Jifty/Plugin/Authentication/Twitter/Action/LoginTwitterUser.pm b/lib/Jifty/Plugin/Authentication/Twitter/Action/LoginTwitterUser.pm
deleted file mode 100644
index 3caaf92..0000000
--- a/lib/Jifty/Plugin/Authentication/Twitter/Action/LoginTwitterUser.pm
+++ /dev/null
@@ -1,86 +0,0 @@
-use warnings;
-use strict;
-
-=head1 NAME
-
-Jifty::Plugin::Authentication::Twitter::Action::LoginTwitterUser - login Twitter user
-
-=cut
-
-package Jifty::Plugin::Authentication::Twitter::Action::LoginTwitterUser;
-use base qw/Jifty::Action/;
-
-=head1 ARGUMENTS
-
-=cut
-
-use Jifty::Param::Schema;
-use Jifty::Action schema {
-};
-
-=head1 METHODS
-
-=head2 take_action
-
-Get the session key using the Twitter API. Check for existing user.
-If none, autocreate. Login user.
-
-=cut
-
-sub take_action {
- my $self = shift;
-
- my $name = '...';
-
- # Load up the user
- my $current_user = Jifty->app_class('CurrentUser');
- my $user = $current_user->new( twitter_name => $name );
-
- # Autocreate the user if necessary
- if ( not $user->id ) {
- my $action = Jifty->web->new_action(
- class => 'CreateUser',
- current_user => $current_user->superuser,
- arguments => {
- twitter_name => $name,
- }
- );
- $action->run;
-
- if ( not $action->result->success ) {
- # Should this be less "friendly"?
- $self->result->error(_("Sorry, something weird happened (we couldn't create a user for you). Try again later."));
- return;
- }
-
- $user = $current_user->new( twitter_name => $name );
- }
-
- my $u = $user->user_object;
-
- # Always check name
- $u->__set( column => 'twitter_name', value => $name )
- if not defined $u->twitter_name or $u->twitter_name ne $name;
-
- # Login!
- Jifty->web->current_user( $user );
- Jifty->web->session->expires('+1y');
- Jifty->web->session->set_cookie;
-
- # Success!
- $self->report_success;
-
- return 1;
-}
-
-=head2 report_success
-
-=cut
-
-sub report_success {
- my $self = shift;
- $self->result->message(_("Hi %1!", Jifty->web->current_user->user_object->twitter_name ));
-}
-
-1;
-
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list