modified: README.md

modified:   index.php
	modified:   username.sql
Add hashing of password stored in database
This commit is contained in:
Sven Luethi committed 2023-12-23 16:34:15 +01:00
1 parent 296f2a937d
commit bf0ad5bf3e
3 files changed
+5 -4

No files matched your search

+1 -1
View File
@@ -27,7 +27,7 @@ I wrote this small application to help my wife learn german but then thought of
- php-sqlite3 extension
## Installation
1. Set a password for your new user in username.sql. Find following line and replace 'password' by your preferred password.
1. Set a password for your new user in username.sql. Find following line and replace '5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8' by the sha256 hash of your preferred password.
```
INSERT INTO config VALUES(1,'PASSWORD','password');
```
+3 -2
View File
@@ -33,7 +33,7 @@ class Auth {
}
$pass = $this->db->getConfigValueByKey('PASSWORD');
if($_SERVER['PHP_AUTH_PW'] !== $pass) {
if(hash('sha256', $_SERVER['PHP_AUTH_PW']) !== $pass) {
$this->respondWithAccessDenied();
}
}
@@ -435,7 +435,8 @@ class App {
unset($_GET[$key]);
}
}
//$db = new DB('username.db');
//new App($db);
$auth = new Auth();
new App($auth->getDBHandle());
?>
+1 -1
View File
@@ -6,7 +6,7 @@ CREATE TABLE config (
value TEXT NOT NULL
);
INSERT INTO config VALUES(0,'NEW_CARD_BOX_ID','4');
INSERT INTO config VALUES(1,'PASSWORD','password');
INSERT INTO config VALUES(1,'PASSWORD','5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8');
CREATE TABLE boxes (
id INTEGER PRIMARY KEY,
name TEXT NOT NULL,