Changeset 784a425 in github for index.php


Ignore:
Timestamp:
Feb 3, 2011 5:08:03 PM (2 years ago)
Author:
thomascube <thomas@…>
Branches:
master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
Children:
89d19c4
Parents:
6ec4658
Message:

protect login form submission from CSRF using a request token

File:
1 edited

Legend:

Unmodified
Added
Removed
  • index.php

    rcf2da2f r784a425  
    7676// try to log in 
    7777if ($RCMAIL->task == 'login' && $RCMAIL->action == 'login') { 
     78  $request_valid = $_SESSION['temp'] && $RCMAIL->check_request(RCUBE_INPUT_POST, 'login'); 
     79 
    7880  // purge the session in case of new login when a session already exists  
    7981  $RCMAIL->kill_session(); 
     
    8587       $RCMAIL->config->get('password_charset', 'ISO-8859-1')), 
    8688    'cookiecheck' => true, 
     89    'valid' => $request_valid, 
    8790  )); 
    8891 
     
    9194    $OUTPUT->show_message("cookiesdisabled", 'warning'); 
    9295  } 
    93   else if ($_SESSION['temp'] && !$auth['abort'] && 
     96  else if ($auth['valid'] && !$auth['abort'] && 
    9497        !empty($auth['host']) && !empty($auth['user']) && 
    9598        $RCMAIL->login($auth['user'], $auth['pass'], $auth['host'])) { 
     
    124127    $error_code = is_object($IMAP) ? $IMAP->get_error_code() : -1; 
    125128 
    126     $OUTPUT->show_message($error_code < -1 ? 'imaperror' : 'loginfailed', 'warning'); 
     129    $OUTPUT->show_message($error_code < -1 ? 'imaperror' : (!$auth['valid'] ? 'invalidrequest' : 'loginfailed'), 'warning'); 
    127130    $RCMAIL->plugins->exec_hook('login_failed', array( 
    128131      'code' => $error_code, 'host' => $auth['host'], 'user' => $auth['user'])); 
     
    168171  } 
    169172 
    170   $OUTPUT->set_env('task', 'login'); 
     173  $RCMAIL->set_task('login'); 
    171174  $OUTPUT->send('login'); 
    172175} 
Note: See TracChangeset for help on using the changeset viewer.