Login plugin - 2.05beta5

More
5 years 1 month ago #98595 by atlet
atlet created the topic: Login plugin - 2.05beta5
I created simple login plugin just to test, if it is working.

Problem is, that event newUserSession is never called.

Here is the plugin code:
<?php
    class TestLogin extends AuthPluginBase
    {
        protected $storage = 'DbStorage';    
 
        static protected $description = 'Testing login system...';
        static protected $name = 'TestLogin';
 
        public function __construct(PluginManager $manager, $id) {
            parent::__construct($manager, $id);
 
            $this->subscribe('beforeLogin');
            $this->subscribe('newUserSession');
        }
 
        public function beforeLogin()
        {      
        if (isset($_GET["testlogin"]) && ($_GET["testlogin"] == 1)) {  
            $this->setUsername('admin');
            $this->setAuthPlugin();
        }
        }
 
        public function newUserSession()
        {
            $sUser = $this->getUserName();        
            $oUser = $this->api->getUserByName($sUser);
 
            if (!is_null($oUser))
            {
                $this->setAuthSuccess($oUser);
                return;
            } else {
                $this->setAuthFailure(self::ERROR_USERNAME_INVALID);
            }       
        }   
    }
?>

To call this code, just go to this url: admin/authentication/sa/login?testlogin=1

I'm missing something?

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #98598 by mdekker
mdekker replied the topic: Login plugin - 2.05beta5
Ah I now see the problem, I committed a fix to the 2.05 branch on github:

github.com/LimeSurvey/LimeSurvey/commit/...4e5996d13fddf12e4bb6

---
Menno Dekker
The following user(s) said Thank You: atlet

Please Log in or Create an account to join the conversation.

More
5 years 1 month ago #98602 by atlet
atlet replied the topic: Login plugin - 2.05beta5
Tnx, now it's working fine.

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!