Session immer am Ende des Requests speichern
authorMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 28 Feb 2011 08:00:48 +0000 (09:00 +0100)
committerMoritz Bunkus <m.bunkus@linet-services.de>
Mon, 28 Feb 2011 08:00:48 +0000 (09:00 +0100)
Momentan wird eh am Anfang der Session einmal gespeichert, wenn
Benutzername und Passwort überprüft wurden. Somit erspart man sich
späteres Speichern.

SL/Auth.pm
SL/Dispatcher.pm
SL/Helper/Flash.pm

index e7f60e9..62686a6 100644 (file)
@@ -611,7 +611,9 @@ sub save_session {
   my $self         = shift;
   my $provided_dbh = shift;
 
-  my $dbh          = $provided_dbh || $self->dbconnect();
+  my $dbh          = $provided_dbh || $self->dbconnect(1);
+
+  return unless $dbh;
 
   $dbh->begin_work unless $provided_dbh;
 
index 55d2380..880f6f4 100644 (file)
@@ -202,7 +202,7 @@ sub handle_request {
 
       $::auth->set_session_value('login', $::form->{login}, 'password', $::form->{password});
       $::auth->create_or_refresh_session;
-      $::auth->delete_session_value('FLASH')->save_session();
+      $::auth->delete_session_value('FLASH');
       delete $::form->{password};
 
       if ($action) {
@@ -233,6 +233,7 @@ sub handle_request {
   $::form     = undef;
   $::myconfig = ();
   Form::disconnect_standard_dbh;
+  $::auth->save_session;
   $::auth->dbdisconnect;
 
   $::lxdebug->end_request;
index 8f68d00..876de96 100644 (file)
@@ -16,7 +16,7 @@ sub flash {
 }
 
 sub flash_later {
-  $::auth->set_session_value(FLASH => _store_flash($::auth->get_session_value('FLASH'), @_))->save_session();
+  $::auth->set_session_value(FLASH => _store_flash($::auth->get_session_value('FLASH'), @_));
 }
 
 sub render_flash {