HEX
Server: Apache
System: Linux server3230.server-vps.com 5.15.0-46-generic #49-Ubuntu SMP Thu Aug 4 18:03:25 UTC 2022 x86_64
User: lzgqnjwu (1002)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: //usr/share/webmail/plugins/brainy/brainy.php
<?php

/**
 * Plugin to brainy external login to the Roundcube
 * 
 * @license GNU GPLv3+
 * @author Aleksandr Gorkusha
 */
class brainy extends rcube_plugin
{
  public $task = 'login';

  function init()
  {
    $this->add_hook('startup', array($this, 'startup'));
    $this->add_hook('authenticate', array($this, 'authenticate'));
  }

  function startup($args)
  {
    // change action to login
    if (!empty($_GET['_autologin']))
      $args['action'] = 'login';

    return $args;
  }

  function authenticate($args)
  {
    if (!empty($_GET['_autologin'])) {
      $args['action'] = 'login';
      $args['user'] = $_POST['_user'];
      $args['pass'] = $_POST['_pass'];
      $args['host'] = $_SERVER['remote_addr'];
      $args['cookiecheck'] = false;
      $args['valid'] = true;
    }

    return $args;
  }


}