-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
manage login for streamer (only acces widget edit page), improve ipli…
…mit (move to .env)
- Loading branch information
Showing
9 changed files
with
165 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
|
||
require 'app/Config.php'; | ||
|
||
$repository = Config::getInstance()->repo; | ||
|
||
if ($_SERVER["REQUEST_METHOD"] == "POST") { | ||
$username = $_POST['username'] ?? ''; | ||
$password = $_POST['password'] ?? ''; | ||
|
||
$user = $repository->getUser($username); | ||
|
||
if ($user && password_verify($password, $user['password'])) { | ||
$_SESSION['user_email'] = $user['email']; | ||
header('Location: /admin/widget_edit.php'); | ||
exit; | ||
} else { | ||
echo '<div class="alert alert-danger" role="alert">Email ou mot de passe invalide 😞</div>'; | ||
} | ||
} | ||
?> | ||
|
||
<!DOCTYPE html> | ||
|
||
<html lang="fr"> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<title>Connexion</title> | ||
<link rel="stylesheet" href="/node_modules/bootstrap/dist/css/bootstrap.min.css"> | ||
</head> | ||
|
||
<body> | ||
<div class="container"> | ||
<h2>Connexion</h2> | ||
<form action="index.php" method="POST"> | ||
<div class="form-group"> | ||
<label for="username">Email</label> | ||
<input type="text" class="form-control" id="username" name="username" required> | ||
</div> | ||
<div class="form-group"> | ||
<label for="password">Mot de passe</label> | ||
<input type="password" class="form-control" id="password" name="password" required> | ||
</div> | ||
<button type="submit" class="btn btn-primary">🚀</button> | ||
</form> | ||
</div> | ||
</body> | ||
|
||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
CREATE TABLE {prefix}users ( | ||
id INT AUTO_INCREMENT PRIMARY KEY, | ||
email VARCHAR(255) NOT NULL, | ||
password VARCHAR(255) NOT NULL, | ||
creation_date DATETIME(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6), | ||
last_update DATETIME(6) DEFAULT CURRENT_TIMESTAMP(6) ON UPDATE CURRENT_TIMESTAMP(6) NOT NULL | ||
); | ||
|
||
ALTER TABLE ADD CONSTRAINT fk_{prefix}charity_stream_users FOREIGN KEY (owner_email) REFERENCES {prefix}users(email), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters