Changeset 156


Ignore:
Timestamp:
12/21/10 03:29:08 (13 years ago)
Author:
nanardon
Message:
  • paste results on the website only if client is authenticated (ie the bot)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/trunk/web/lib/Sophie/Controller/Chat.pm

    r100 r156  
    8484    my ($self, $c, $title, $text) = @_; 
    8585 
    86     my @char = ('a' .. 'z', 'A' .. 'Z', 0 .. 9); 
    87     my $id = join('', map { $char[rand(@char)] } (0..7)); 
    88     $c->model('Base::ChatPaste')->create( 
    89         { 
    90             id => $id, 
    91             user_id => $c->model('Base::Users')->find( 
    92                 { mail => $c->user->mail })->ukey, 
    93             title => $title, 
    94             reply => $text, 
    95         } 
    96     ); 
    97     $c->model('Base')->storage->dbh->commit; 
    98     $c->stash->{xmlrpc} = $id; 
     86    if ($c->user_exists) { 
     87        my @char = ('a' .. 'z', 'A' .. 'Z', 0 .. 9); 
     88        my $id = join('', map { $char[rand(@char)] } (0..7)); 
     89        $c->model('Base::ChatPaste')->create( 
     90            { 
     91                id => $id, 
     92                user_id => $c->model('Base::Users')->find( 
     93                    { mail => $c->user->mail })->ukey, 
     94                title => $title, 
     95                reply => $text, 
     96            } 
     97        ); 
     98        $c->model('Base')->storage->dbh->commit; 
     99        return $c->stash->{xmlrpc} = $id; 
     100    } else { 
     101        return $c->stash->{xmlrpc} = undef; 
     102    } 
    99103} 
    100104 
Note: See TracChangeset for help on using the changeset viewer.