Skip to content

Instantly share code, notes, and snippets.

@huglester
Last active October 12, 2023 07:31
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save huglester/0730e8b3835d039e1bb9 to your computer and use it in GitHub Desktop.
Save huglester/0730e8b3835d039e1bb9 to your computer and use it in GitHub Desktop.
RoundCube mail - disable CSRF protection on login example
<?php
/*
Install:
1) create a folder: disablecsrf inside 'plugins/' directory.
2) place this file there and name it: disablecsrf.php
3) go to config/config.inc.php, and add it to plugins, like:
$config['plugins'] = array('disablecsrf');
CSRF should now be disabled for login.
*/
/**
* Sample plugin to disable csrf for RoundCube mail (tested only on 1.0.3)
*
* @license MIT
* @author huglester@gmail.com
*/
class disablecsrf extends rcube_plugin
{
public $task = 'login';
function init()
{
$this->add_hook('authenticate', array($this, 'authenticate'));
}
function authenticate($args)
{
$args['valid'] = true;
return $args;
}
}
@dvapelnik
Copy link

Thanks for plugin!
It works with v1.0.0

@pheeque
Copy link

pheeque commented Oct 20, 2017

Life saver.

@justsux
Copy link

justsux commented May 15, 2018

Awesome fix. Still has its use. Thanks!

@eilandert
Copy link

Does this still work?

@hid3nax
Copy link

hid3nax commented Sep 18, 2022

Huglester, what does this thing do? Don't you think it would be wise to include a brief description in the comments?

@eloydegen
Copy link

This should not be used in production. Now other websites can login for a particular user, potentially misleading them. There is a bug somewhere in Roundcube, this is a bad temporary workaround.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment