Beispiel #1
0
 /**
  * Handler for submitted form
  *
  * Check fields and save to default identity if valid.
  * Afterwards the session flag is removed and we're done.
  */
 function save_data()
 {
     $rcmail = rcmail::get_instance();
     $identity = $rcmail->user->get_identity();
     $identities_level = intval($rcmail->config->get('identities_level', 0));
     $save_data = array('name' => get_input_value('_name', RCUBE_INPUT_POST), 'email' => get_input_value('_email', RCUBE_INPUT_POST));
     // don't let the user alter the e-mail address if disabled by config
     if ($identities_level == 1 || $identities_level == 3) {
         $save_data['email'] = $identity['email'];
     }
     // save data if not empty
     if (!empty($save_data['name']) && !empty($save_data['email'])) {
         $rcmail->user->update_identity($identity['identity_id'], $save_data);
         rcube_sess_unset('plugin.newuserdialog');
     }
     $rcmail->output->redirect('');
 }
Beispiel #2
0
// trigger startup plugin hook
$startup = $RCMAIL->plugins->exec_hook('startup', array('task' => $RCMAIL->task, 'action' => $RCMAIL->action));
$RCMAIL->set_task($startup['task']);
$RCMAIL->action = $startup['action'];
// try to log in
if ($RCMAIL->action == 'login' && $RCMAIL->task == 'mail') {
    // purge the session in case of new login when a session already exists
    $RCMAIL->kill_session();
    $auth = $RCMAIL->plugins->exec_hook('authenticate', array('host' => $RCMAIL->autoselect_host(), 'user' => trim(get_input_value('_user', RCUBE_INPUT_POST)), 'cookiecheck' => true)) + array('pass' => get_input_value('_pass', RCUBE_INPUT_POST, true, 'ISO-8859-1'));
    // check if client supports cookies
    if ($auth['cookiecheck'] && empty($_COOKIE)) {
        $OUTPUT->show_message("cookiesdisabled", 'warning');
    } else {
        if ($_SESSION['temp'] && !$auth['abort'] && !empty($auth['host']) && !empty($auth['user']) && isset($auth['pass']) && $RCMAIL->login($auth['user'], $auth['pass'], $auth['host'])) {
            // create new session ID
            rcube_sess_unset('temp');
            rcube_sess_regenerate_id();
            // send auth cookie if necessary
            $RCMAIL->authenticate_session();
            // log successful login
            if ($RCMAIL->config->get('log_logins')) {
                write_log('userlogins', sprintf('Successful login for %s (id %d) from %s', $RCMAIL->user->get_username(), $RCMAIL->user->ID, $_SERVER['REMOTE_ADDR']));
            }
            // restore original request parameters
            $query = array();
            if ($url = get_input_value('_url', RCUBE_INPUT_POST)) {
                parse_str($url, $query);
            }
            // allow plugins to control the redirect url after login success
            $redir = $RCMAIL->plugins->exec_hook('login_after', $query + array('task' => $RCMAIL->task));
            unset($redir['abort']);
Beispiel #3
0
 /**
  * Destroy session data and remove cookie
  */
 public function kill_session()
 {
     $this->plugins->exec_hook('kill_session');
     rcube_sess_unset();
     $_SESSION = array('language' => $this->user->language, 'auth_time' => time(), 'temp' => true);
     rcmail::setcookie('sessauth', '-del-', time() - 60);
     $this->user->reset();
 }
Beispiel #4
0
 /**
  * Destroy session data and remove cookie
  */
 public function kill_session()
 {
     $this->plugins->exec_hook('kill_session');
     rcube_sess_unset();
     if (!isset($_SESSION['elastix_user'])) {
         $_SESSION = array('language' => $USER->language, 'auth_time' => time(), 'temp' => true);
     } else {
         $_SESSION['language'] = $USER->language;
         $_SESSION['auth_time'] = time();
         $_SESSION['temp'] = true;
         foreach (array('temp', 'user_id', 'username', 'imap_host', 'imap_port', 'imap_ssl', 'password', 'login_time', 'mbox', 'sort_col', 'sort_order', 'quota_display') as $k) {
             unset($_SESSION[$k]);
         }
     }
     rcmail::setcookie('sessauth', '-del-', time() - 60);
     $this->user->reset();
 }