Moved the techfuze/sessions module to core/users.
Has an alias techfuze/sessions for backwards compatibility. Will be removed when #74 has been resolved. Partially resolves #68
This commit is contained in:
parent
67ccc602e3
commit
654d873ba9
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Controller;
|
||||
use \FuzeWorks\Controller;
|
||||
|
||||
class Standard extends Controller {
|
||||
public function __construct(&$core) {
|
||||
parent::__construct($core);
|
||||
}
|
||||
|
||||
public function index($path = null) {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
?>
|
|
@ -28,7 +28,7 @@
|
|||
* @version Version 0.0.1
|
||||
*/
|
||||
|
||||
namespace Module\Sessions;
|
||||
namespace Module\Users;
|
||||
use \FuzeWorks\Event;
|
||||
|
||||
/**
|
|
@ -28,7 +28,7 @@
|
|||
* @version Version 0.0.1
|
||||
*/
|
||||
|
||||
namespace Module\Sessions;
|
||||
namespace Module\Users;
|
||||
use \FuzeWorks\Module;
|
||||
use \FuzeWorks\EventPriority;
|
||||
|
||||
|
@ -39,7 +39,7 @@ use \FuzeWorks\EventPriority;
|
|||
* @author Abel Hoogeveen <abel@techfuze.net>
|
||||
* @copyright Copyright (c) 2013 - 2015, Techfuze. (http://techfuze.net)
|
||||
*/
|
||||
class Session extends Module {
|
||||
class Users extends Module {
|
||||
|
||||
/**
|
||||
* UDT of the current session, send to the user
|
||||
|
@ -771,6 +771,24 @@ class Session extends Module {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Verify if a password matches the user
|
||||
* @param Int $userId User ID of the user
|
||||
* @param String $password Password of the user
|
||||
* @return true on valid, false on invalid
|
||||
*/
|
||||
public function verifyPassword($userId, $password) {
|
||||
$prefix = $this->db->getPrefix();
|
||||
$stmnt = $this->mods->database->prepare("SELECT * FROM ".$prefix."session_users WHERE user_id = ?");
|
||||
$stmnt->execute([$userId]);
|
||||
$data = $stmnt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
if (!empty($data)) {
|
||||
return password_verify($password, $data[0]['user_password']);
|
||||
} else {
|
||||
throw new SessionException("Could not verify password. User not found", 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks wether a user has permission to a certain action
|
||||
* If a userID is provided, a specific user is checked. Otherwise the current session is used
|
|
@ -33,6 +33,6 @@ return array(
|
|||
'cookie_name' => 'FuzeCookie',
|
||||
|
||||
// Should be filled in if you want email verification to work
|
||||
'verify_controller' => '',
|
||||
'verify_controller' => 'login',
|
||||
|
||||
);
|
|
@ -30,15 +30,17 @@
|
|||
|
||||
return array(
|
||||
|
||||
'module_class' => '\Module\Sessions\Session',
|
||||
'module_file' => 'class.sessions.php',
|
||||
'module_name' => 'sessions',
|
||||
'module_class' => '\Module\Users\Users',
|
||||
'module_file' => 'class.users.php',
|
||||
'module_name' => 'users',
|
||||
|
||||
'dependencies' => array('techfuze/database'),
|
||||
'dependencies' => array('core/database'),
|
||||
'aliases' => array('techfuze/sessions'),
|
||||
'events' => array(),
|
||||
|
||||
'name' => 'Sessions',
|
||||
'name' => 'Users',
|
||||
'description' => 'Lightweight user and permissions system',
|
||||
'author' => 'TechFuze',
|
||||
'author' => 'core',
|
||||
'version' => '1.0.0.0',
|
||||
'website' => 'http://fuzeworks.techfuze.net/',
|
||||
|
Loading…
Reference in New Issue