diff --git a/README.md b/README.md index a5a3b3f..ed9bdfc 100644 --- a/README.md +++ b/README.md @@ -86,6 +86,7 @@ curl -fsSL https://get.docker.com | bash ```bash git clone https://git.vichingo455.freeddns.org/emmev-code/orario cd orario +git checkout dev # richiesto per passare alla versione di sviluppo docker compose up -d ``` 3. Il container dovrebbe diventare disponibile su ``http://localhost:8080`` diff --git a/docker-compose.yml b/docker-compose.yml index b2ee898..6b1597a 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,5 +1,3 @@ -version: "3.8" - services: web: build: . @@ -9,7 +7,6 @@ services: depends_on: - db restart: unless-stopped - db: image: mariadb:11 container_name: orario-db @@ -22,6 +19,5 @@ services: volumes: - db_data:/var/lib/mysql - ./schema.sql:/docker-entrypoint-initdb.d/init.sql:ro - volumes: db_data: \ No newline at end of file diff --git a/htdocs/admin/changepassword.php b/htdocs/admin/changepassword.php new file mode 100644 index 0000000..ddec263 --- /dev/null +++ b/htdocs/admin/changepassword.php @@ -0,0 +1,81 @@ +prepare("SELECT password FROM admins WHERE username = ?"); + $stmt->bind_param("s", $user); + $stmt->execute(); + $res = $stmt->get_result(); + $row = $res->fetch_assoc(); + + if ($row && password_verify($old, $row['password'])) { + $newHash = password_hash($new, PASSWORD_DEFAULT); + $stmt = $conn->prepare("UPDATE admins SET password = ? WHERE username = ?"); + $stmt->bind_param("ss", $newHash, $user); + $stmt->execute(); + $message = "Password cambiata con successo."; + } else { + $message = "Password attuale errata."; + } + } +} +?> + + +
+
diff --git a/htdocs/admin/login.php b/htdocs/admin/login.php
index e579ea4..5c8a773 100644
--- a/htdocs/admin/login.php
+++ b/htdocs/admin/login.php
@@ -12,6 +12,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
if ($row = $res->fetch_assoc()) {
if (password_verify($password, $row['password'])) {
$_SESSION['admin'] = $row['username'];
+ $_SESSION['auth_type'] = 'local';
header("Location: index.php");
exit;
}
diff --git a/htdocs/admin/login.php.keycloak b/htdocs/admin/login.php.keycloak
index 8347efc..ee100e4 100644
--- a/htdocs/admin/login.php.keycloak
+++ b/htdocs/admin/login.php.keycloak
@@ -14,5 +14,6 @@ $oidc->setRedirectURL('https://