1: <?php
2: /**
3: * Authentification class for Native XOOPS
4: *
5: * You may not change or alter any portion of this comment or credits
6: * of supporting developers from this source code or any supporting source code
7: * which is considered copyrighted (c) material of the original comment or credit authors.
8: * This program is distributed in the hope that it will be useful,
9: * but WITHOUT ANY WARRANTY; without even the implied warranty of
10: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11: *
12: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
13: * @license GNU GPL 2 (http://www.gnu.org/licenses/gpl-2.0.html)
14: * @package kernel
15: * @subpackage auth
16: * @since 2.0
17: * @author Pierre-Eric MENUET <pemphp@free.fr>
18: */
19:
20: defined('XOOPS_ROOT_PATH') || exit('Restricted access');
21:
22: /**
23: *
24: * @package kernel
25: * @subpackage auth
26: * @description Authentification class for Native XOOPS
27: * @author Pierre-Eric MENUET <pemphp@free.fr>
28: * @copyright (c) 2000-2016 XOOPS Project (www.xoops.org)
29: */
30: class XoopsAuthXoops extends XoopsAuth
31: {
32: /**
33: * Authentication Service constructor
34: * @param XoopsDatabase $dao
35: */
36: public function __construct(XoopsDatabase $dao = null)
37: {
38: $this->_dao = $dao;
39: $this->auth_method = 'xoops';
40: }
41:
42: /**
43: * Authenticate user
44: *
45: * @param string $uname
46: * @param string $pwd
47: * @return bool
48: */
49: public function authenticate($uname, $pwd = null)
50: {
51: /* @var $member_handler XoopsMemberHandler */
52: $member_handler = xoops_getHandler('member');
53: $user = $member_handler->loginUser($uname, $pwd);
54: if ($user == false) {
55: $this->setErrors(1, _US_INCORRECTLOGIN);
56: }
57:
58: return $user;
59: }
60: }
61: