Welcome, Guest
Username: Password: Remember me

TOPIC: Login plugin - 2.05beta5

Login plugin - 2.05beta5 8 months 3 weeks ago #98595

  • atlet
  • atlet's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 16
  • Karma: 0
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?
The administrator has disabled public write access.

Login plugin - 2.05beta5 8 months 3 weeks ago #98598

  • mdekker
  • mdekker's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 340
  • Thank you received: 68
  • Karma: 38
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 administrator has disabled public write access.
The following user(s) said Thank You: atlet

Login plugin - 2.05beta5 8 months 3 weeks ago #98602

  • atlet
  • atlet's Avatar
  • OFFLINE
  • Fresh Lemon
  • Posts: 16
  • Karma: 0
Tnx, now it's working fine.
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.155 seconds
Donation Image