v0.0.1 Added the first files and made a login system.
This commit is contained in:
parent
78df7dd754
commit
dfb9103157
|
@ -52,6 +52,30 @@
|
|||
<excludeFolder url="file://$MODULE_DIR$/installer/vendor/doctrine/instantiator" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/installer/vendor/composer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/installer/vendor/sebastian/comparator" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-intl-normalizer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php80" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/simple-cache" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-intl-grapheme" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/psr/container" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-php73" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/translation" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/string" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/service-contracts" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/console" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/translation-contracts" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/symfony/deprecation-contracts" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/doctrine/inflector" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/illuminate/container" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/composer" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/illuminate/collections" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/illuminate/macroable" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/illuminate/database" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/illuminate/contracts" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/illuminate/support" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/nesbot/carbon" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/vendor/voku/portable-ascii" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="PhpIncludePathManager">
|
||||
<include_path>
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-normalizer" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php80" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/simple-cache" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-intl-grapheme" />
|
||||
<path value="$PROJECT_DIR$/vendor/psr/container" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-php73" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-ctype" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/translation" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/string" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/service-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/console" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/translation-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/polyfill-mbstring" />
|
||||
<path value="$PROJECT_DIR$/vendor/symfony/deprecation-contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/doctrine/inflector" />
|
||||
<path value="$PROJECT_DIR$/vendor/illuminate/container" />
|
||||
<path value="$PROJECT_DIR$/vendor/composer" />
|
||||
<path value="$PROJECT_DIR$/vendor/illuminate/collections" />
|
||||
<path value="$PROJECT_DIR$/vendor/illuminate/macroable" />
|
||||
<path value="$PROJECT_DIR$/vendor/illuminate/database" />
|
||||
<path value="$PROJECT_DIR$/vendor/illuminate/contracts" />
|
||||
<path value="$PROJECT_DIR$/vendor/illuminate/support" />
|
||||
<path value="$PROJECT_DIR$/vendor/nesbot/carbon" />
|
||||
<path value="$PROJECT_DIR$/vendor/voku/portable-ascii" />
|
||||
</include_path>
|
||||
</component>
|
||||
</project>
|
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['token'])) {
|
||||
header("location: ../Frontend/index.php?login=notloggedin");
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
require_once "../../bootstrap.php";
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
session_start();
|
||||
if (isset($_POST['loginsubmit'])) {
|
||||
$username = $_POST["username"];
|
||||
$password = $_POST["password"];
|
||||
$user = User::query()->firstWhere('name', $username);
|
||||
if ($user) {
|
||||
$hashedPassword = $user->password;
|
||||
if (password_verify($password, $hashedPassword)) {
|
||||
$token = Str::random(100);
|
||||
$password = User::firstWhere('id', '=', $user->id);
|
||||
$password->remember_token = $token;
|
||||
if ($password->save()) {
|
||||
$_SESSION['token'] = $token;
|
||||
$_SESSION['name'] = $username;
|
||||
header('location: ../../Frontend/home.php?login=success');
|
||||
exit();
|
||||
http_response_code(200);
|
||||
} else {
|
||||
session_destroy();
|
||||
http_response_code(500);
|
||||
}
|
||||
|
||||
} else {
|
||||
session_destroy();
|
||||
http_response_code(401);
|
||||
echo json_encode(["message" => "Wrong password"]);
|
||||
}
|
||||
|
||||
} else {
|
||||
session_destroy();
|
||||
http_response_code(401);
|
||||
echo json_encode(["message" => "User was not found"]);
|
||||
}
|
||||
} else {
|
||||
http_response_code(400);
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
session_start();
|
||||
session_unset();
|
||||
session_destroy();
|
||||
header("location: ../../Frontend/index.php");
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
|
||||
require "user_migration.php";
|
||||
echo "Done";
|
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
require "../../bootstrap.php";
|
||||
$createUser = User::Create(['name' => "Victor", 'password' => password_hash('1234', PASSWORD_DEFAULT)]);
|
||||
echo "User was created";
|
|
@ -0,0 +1,12 @@
|
|||
<?php
|
||||
|
||||
require "../../bootstrap.php";
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
|
||||
Capsule::schema()->create('users', function ($table) {
|
||||
$table->increments('id');
|
||||
$table->string('name');
|
||||
$table->longtext('password');
|
||||
$table->longtext('remember_token');
|
||||
$table->timestamps();
|
||||
});
|
|
@ -0,0 +1,15 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Eloquent\Model as Eloquent;
|
||||
|
||||
class User extends Eloquent{
|
||||
|
||||
protected $fillable = [
|
||||
'name','password','remember_token'
|
||||
];
|
||||
|
||||
protected $hidden = [
|
||||
'password'
|
||||
];
|
||||
|
||||
}
|
|
@ -0,0 +1,12 @@
|
|||
<?php require "../Backend/controller/accessControl.php"?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Home</title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Logget in</p>
|
||||
<a href="../Backend/controller/logout.php">Log ud</a>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,14 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Login</title>
|
||||
</head>
|
||||
<body>
|
||||
<form action="../Backend/controller/login.php" method="POST">
|
||||
<input type="text" name="username" placeholder="Username">
|
||||
<input type="password" name="password" placeholder="Password">
|
||||
<input type="submit" name="loginsubmit" placeholder="login">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,20 @@
|
|||
<?php
|
||||
require "vendor/autoload.php";
|
||||
use Illuminate\Database\Capsule\Manager as Capsule;
|
||||
|
||||
$capsule = new Capsule;
|
||||
|
||||
$capsule->addConnection([
|
||||
"driver" => "mysql",
|
||||
"host" => "127.0.0.1",
|
||||
"database" => "itskp",
|
||||
"username" => "root",
|
||||
"password" => ""
|
||||
]);
|
||||
|
||||
//Make this Capsule instance available globally.
|
||||
$capsule->setAsGlobal();
|
||||
|
||||
// Setup the Eloquent ORM.
|
||||
$capsule->bootEloquent();
|
||||
$capsule->bootEloquent();
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"require": {
|
||||
"illuminate/database": "^8.44"
|
||||
},
|
||||
"autoload": {
|
||||
"classmap": [
|
||||
"Backend/model"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,9 +21,9 @@
|
|||
"bin/laravel"
|
||||
],
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Laravel\\Installer\\Console\\": "src/"
|
||||
}
|
||||
"classmap": [
|
||||
"Backend/model"
|
||||
]
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
|
|
|
@ -25,24 +25,24 @@ class InstalledVersions
|
|||
private static $installed = array (
|
||||
'root' =>
|
||||
array (
|
||||
'pretty_version' => '1.0.0+no-version-set',
|
||||
'version' => '1.0.0.0',
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => NULL,
|
||||
'reference' => '78df7dd754a997529545d1c7f78733965fb7e709',
|
||||
'name' => '__root__',
|
||||
),
|
||||
'versions' =>
|
||||
array (
|
||||
'__root__' =>
|
||||
array (
|
||||
'pretty_version' => '1.0.0+no-version-set',
|
||||
'version' => '1.0.0.0',
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => NULL,
|
||||
'reference' => '78df7dd754a997529545d1c7f78733965fb7e709',
|
||||
),
|
||||
'doctrine/inflector' =>
|
||||
array (
|
||||
|
|
|
@ -12,5 +12,6 @@ return array(
|
|||
'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
|
||||
'Stringable' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
|
||||
'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
|
||||
'User' => $baseDir . '/Backend/model/User.php',
|
||||
'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
|
||||
);
|
||||
|
|
|
@ -9,12 +9,12 @@ return array(
|
|||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => $vendorDir . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => $vendorDir . '/symfony/polyfill-php80/bootstrap.php',
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => $vendorDir . '/symfony/deprecation-contracts/function.php',
|
||||
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
|
||||
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => $vendorDir . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
|
||||
'8825ede83f2f289127722d4e842cf7e8' => $vendorDir . '/symfony/polyfill-intl-grapheme/bootstrap.php',
|
||||
'e69f7f6ee287b969198c3c9d6777bd38' => $vendorDir . '/symfony/polyfill-intl-normalizer/bootstrap.php',
|
||||
'0d59ee240a4cd96ddbb4ff164fccea4d' => $vendorDir . '/symfony/polyfill-php73/bootstrap.php',
|
||||
'a1105708a18b76903365ca1c4aa61b02' => $vendorDir . '/symfony/translation/Resources/functions.php',
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => $vendorDir . '/symfony/string/Resources/functions.php',
|
||||
'60799491728b879e74601d83e38b2cad' => $vendorDir . '/illuminate/collections/helpers.php',
|
||||
'a1105708a18b76903365ca1c4aa61b02' => $vendorDir . '/symfony/translation/Resources/functions.php',
|
||||
'72579e7bd17821bb1321b87411366eae' => $vendorDir . '/illuminate/support/helpers.php',
|
||||
);
|
||||
|
|
|
@ -20,7 +20,7 @@ return array(
|
|||
'Symfony\\Component\\Console\\' => array($vendorDir . '/symfony/console'),
|
||||
'Psr\\SimpleCache\\' => array($vendorDir . '/psr/simple-cache/src'),
|
||||
'Psr\\Container\\' => array($vendorDir . '/psr/container/src'),
|
||||
'Illuminate\\Support\\' => array($vendorDir . '/illuminate/macroable', $vendorDir . '/illuminate/collections', $vendorDir . '/illuminate/support'),
|
||||
'Illuminate\\Support\\' => array($vendorDir . '/illuminate/collections', $vendorDir . '/illuminate/macroable', $vendorDir . '/illuminate/support'),
|
||||
'Illuminate\\Database\\' => array($vendorDir . '/illuminate/database'),
|
||||
'Illuminate\\Contracts\\' => array($vendorDir . '/illuminate/contracts'),
|
||||
'Illuminate\\Container\\' => array($vendorDir . '/illuminate/container'),
|
||||
|
|
|
@ -10,13 +10,13 @@ class ComposerStaticInitc851e149abcb24897d1e18cb056786d5
|
|||
'0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
|
||||
'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
|
||||
'6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
|
||||
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
|
||||
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
|
||||
'320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
|
||||
'8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
|
||||
'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
|
||||
'0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
|
||||
'a1105708a18b76903365ca1c4aa61b02' => __DIR__ . '/..' . '/symfony/translation/Resources/functions.php',
|
||||
'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
|
||||
'60799491728b879e74601d83e38b2cad' => __DIR__ . '/..' . '/illuminate/collections/helpers.php',
|
||||
'a1105708a18b76903365ca1c4aa61b02' => __DIR__ . '/..' . '/symfony/translation/Resources/functions.php',
|
||||
'72579e7bd17821bb1321b87411366eae' => __DIR__ . '/..' . '/illuminate/support/helpers.php',
|
||||
);
|
||||
|
||||
|
@ -120,8 +120,8 @@ class ComposerStaticInitc851e149abcb24897d1e18cb056786d5
|
|||
),
|
||||
'Illuminate\\Support\\' =>
|
||||
array (
|
||||
0 => __DIR__ . '/..' . '/illuminate/macroable',
|
||||
1 => __DIR__ . '/..' . '/illuminate/collections',
|
||||
0 => __DIR__ . '/..' . '/illuminate/collections',
|
||||
1 => __DIR__ . '/..' . '/illuminate/macroable',
|
||||
2 => __DIR__ . '/..' . '/illuminate/support',
|
||||
),
|
||||
'Illuminate\\Database\\' =>
|
||||
|
@ -153,6 +153,7 @@ class ComposerStaticInitc851e149abcb24897d1e18cb056786d5
|
|||
'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
|
||||
'Stringable' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Stringable.php',
|
||||
'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
|
||||
'User' => __DIR__ . '/../..' . '/Backend/model/User.php',
|
||||
'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
|
||||
);
|
||||
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
<?php return array (
|
||||
'root' =>
|
||||
array (
|
||||
'pretty_version' => '1.0.0+no-version-set',
|
||||
'version' => '1.0.0.0',
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => NULL,
|
||||
'reference' => '78df7dd754a997529545d1c7f78733965fb7e709',
|
||||
'name' => '__root__',
|
||||
),
|
||||
'versions' =>
|
||||
array (
|
||||
'__root__' =>
|
||||
array (
|
||||
'pretty_version' => '1.0.0+no-version-set',
|
||||
'version' => '1.0.0.0',
|
||||
'pretty_version' => 'dev-master',
|
||||
'version' => 'dev-master',
|
||||
'aliases' =>
|
||||
array (
|
||||
),
|
||||
'reference' => NULL,
|
||||
'reference' => '78df7dd754a997529545d1c7f78733965fb7e709',
|
||||
),
|
||||
'doctrine/inflector' =>
|
||||
array (
|
||||
|
|
Loading…
Reference in New Issue