[Jifty-commit] r1895 - in wifty/trunk: etc lib/Wifty
lib/Wifty/Action lib/Wifty/Notification
jifty-commit at lists.jifty.org
jifty-commit at lists.jifty.org
Wed Aug 30 19:51:27 EDT 2006
Author: jpeacock
Date: Wed Aug 30 19:51:23 2006
New Revision: 1895
Removed:
wifty/trunk/lib/Wifty/Action/
wifty/trunk/lib/Wifty/CurrentUser.pm
wifty/trunk/lib/Wifty/Notification/
Modified:
wifty/trunk/etc/config.yml
wifty/trunk/lib/Wifty/Dispatcher.pm
wifty/trunk/lib/Wifty/Model/Page.pm
wifty/trunk/lib/Wifty/Model/User.pm
Log:
Update Wifty to use the Login plugin.
Delete unnecessary files.
Modified: wifty/trunk/etc/config.yml
==============================================================================
--- wifty/trunk/etc/config.yml (original)
+++ wifty/trunk/etc/config.yml Wed Aug 30 19:51:23 2006
@@ -1,6 +1,7 @@
framework:
AdminMode: 0
ApplicationName: Wifty
+ AdminEmail: 'wifty at example.com'
Database:
Driver: SQLite
@@ -9,7 +10,10 @@
Version: 0.0.20
Password: ''
RequireSSL: 0
-# Mailer: IO
+ Plugins:
+ - Login: {}
+ Mailer: SMTP
+ MailerArgs: ['69.17.117.59']
# MailerArgs:
# - %log/mail.log%
SiteConfig: etc/site_config.yml
Modified: wifty/trunk/lib/Wifty/Dispatcher.pm
==============================================================================
--- wifty/trunk/lib/Wifty/Dispatcher.pm (original)
+++ wifty/trunk/lib/Wifty/Dispatcher.pm Wed Aug 30 19:51:23 2006
@@ -78,55 +78,5 @@
set pages => $pages;
};
-# Sign up for an account
-on 'signup', run {
- redirect('/') if ( Jifty->web->current_user->id );
- set 'action' =>
- Jifty->web->new_action( class => 'Signup', moniker => 'signupbox' );
-
- set 'next' => Jifty->web->request->continuation
- || Jifty::Continuation->new(
- request => Jifty::Request->new( path => "/" ) );
-
-};
-
-# Login
-on 'login', run {
- set 'action' =>
- Jifty->web->new_action( class => 'Login', moniker => 'loginbox' );
- set 'next' => Jifty->web->request->continuation
- || Jifty::Continuation->new(
- request => Jifty::Request->new( path => "/" ) );
-};
-
-# Log out
-before 'logout', run {
- Jifty->web->request->add_action(
- moniker => 'logout',
- class => 'Wifty::Action::Logout'
- );
-};
-
-
-## LetMes
-before qr'^/let/(.*)' => run {
- Jifty->api->deny(qr/^Wifty::Dispatcher/);
-
- my $let_me = Jifty::LetMe->new();
- $let_me->from_token($1);
- redirect '/error/let_me/invalid_token' unless $let_me->validate;
-
- Jifty->web->temporary_current_user($let_me->validated_current_user);
-
- my %args = %{$let_me->args};
- set $_ => $args{$_} for keys %args;
- set let_me => $let_me;
-};
-
-on qr'^/let/', => run {
- my $let_me = get 'let_me';
- show '/let/' . $let_me->path;
-};
-
1;
Modified: wifty/trunk/lib/Wifty/Model/Page.pm
==============================================================================
--- wifty/trunk/lib/Wifty/Model/Page.pm (original)
+++ wifty/trunk/lib/Wifty/Model/Page.pm Wed Aug 30 19:51:23 2006
@@ -128,7 +128,9 @@
$self->SUPER::_set(
column => 'updated_by',
- value => ( $self->current_user? $self->current_user->user_object->id : undef )
+ value => ( $self->current_user->user_object
+ ? $self->current_user->user_object->id
+ : undef )
);
return ( $val, $msg );
Modified: wifty/trunk/lib/Wifty/Model/User.pm
==============================================================================
--- wifty/trunk/lib/Wifty/Model/User.pm (original)
+++ wifty/trunk/lib/Wifty/Model/User.pm Wed Aug 30 19:51:23 2006
@@ -1,131 +1,4 @@
-package Wifty::Model::User::Schema;
-use Jifty::DBI::Schema;
-
-column name =>
- type is 'text',
- label is 'Name',
- is mandatory,
- is distinct;
-
-column email =>
- type is 'text',
- label is 'Email address',
- is mandatory,
- is distinct;
-
-column password =>,
- type is 'text',
- label is 'Password',
- render_as 'password';
-
-column email_confirmed =>
- label is 'Email address confirmed?',
- type is 'boolean',
- since '0.0.19';
-
-column auth_token =>
- type is 'text',
- render_as 'Password',
- since '0.0.15';
-
-
-
package Wifty::Model::User;
-use base qw/Wifty::Record/;
-use Wifty::Notification::ConfirmAddress;
-
-sub since {'0.0.7'}
-
-sub create {
- my $self = shift;
- my %args = (@_);
- my (@ret) = $self->SUPER::create(%args);
-
- if ($self->id and not $self->email_confirmed) {
- Wifty::Notification::ConfirmAddress->new( to => $self )->send;
- }
- return (@ret);
-}
-
-
-=head2 password_is STRING
-
-Returns true if and only if the current user's password matches STRING
-
-=cut
-
-
-sub password_is {
- my $self = shift;
- my $string = shift;
- return 1 if ($self->_value('password') eq $string);
- return 0;
-}
-
-=head2 password
-
-Never display a password
-
-=cut
-
-sub password {
- return undef;
-
-}
-
-=head2 current_user_can
-
-Allows the current user to see all their own attributes and
-everyone else to see their username.
-
-Allows the current user to update any of their own attributes
-except whether or not their email has been confirmed.
-
-Passes everything else off to the superclass.
-
-=cut
-
-
-sub current_user_can {
- my $self = shift;
- my $right = shift;
- my %args = (@_);
- if ( $right eq 'read'
- and $self->id == $self->current_user->id )
- {
- return 1;
- } elsif ( $right eq 'read' and $args{'column'} and $args{'column'} eq 'name' ) {
- return (1);
-
- } elsif ( $right eq 'update'
- and $self->id == $self->current_user->id
- and $args{'column'} ne 'email_confirmed' )
- {
- return (1);
- }
-
- return $self->SUPER::current_user_can( $right, %args );
-}
-
-=head2 auth_token
-
-Returns the user's unique authentication token. If the user
-doesn't have one, sets one and returns it.
-
-=cut
-
-
-sub auth_token {
- my $self = shift;
- return undef unless ($self->current_user_can( read => column => 'auth_token'));
- my $value = $self->_value('auth_token') ;
- unless ($value) {
- my $digest =Digest::MD5->new();
- $digest->add(rand(100));
- $self->__set(column => 'auth_token', value => $digest->b64digest);
- }
- return $self->_value('auth_token') ;
-
-}
+use base qw/Jifty::Plugin::Login::Model::User/;
1;
More information about the Jifty-commit
mailing list