1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-29 16:00:15 +02:00

Flextype Box Plugin: Admin #125 #117

- Users Controller/Views implementation
This commit is contained in:
Awilum
2019-05-30 23:48:58 +03:00
parent 452dd7fd1a
commit 16c0d34db7

View File

@@ -62,7 +62,7 @@ class UsersController extends Controller
$data = $request->getParsedBody();
if (!Filesystem::has($_user_file = PATH['site'] . '/accounts/' . Text::safeString($data['username']) . '.json')) {
if (Filesystem::write(
if (Filesystem::write(
PATH['site'] . '/accounts/' . $data['username'] . '.json',
JsonParser::encode(['username' => Text::safeString($data['username']),
'hashed_password' => password_hash($data['password'], PASSWORD_BCRYPT),
@@ -86,9 +86,11 @@ class Users
{
// Get Users Profiles
$users = Filesystem::listContents(PATH['site'] . '/accounts/');
// If any users exists then return true
return ($users && count($users) > 0) ? true : false;
}
public static function isLoggedIn() : bool
{
return (Session::exists('role') && Session::get('role') == 'admin') ? true : false;