diff --git a/sys0-code/assets/php/user_page.php b/sys0-code/assets/php/user_page.php index 6221294..7950109 100644 --- a/sys0-code/assets/php/user_page.php +++ b/sys0-code/assets/php/user_page.php @@ -119,7 +119,7 @@
-
Passwort zurücksetzen
+
Jakach account verknüpfen / Passwort zurücksetzen

Hier kannst du dein Passwort ändern

diff --git a/sys0-code/install/create_db.php b/sys0-code/install/create_db.php index 333c26a..18ba1cf 100644 --- a/sys0-code/install/create_db.php +++ b/sys0-code/install/create_db.php @@ -19,6 +19,7 @@ $sql = "CREATE TABLE IF NOT EXISTS users ( username VARCHAR(255) NOT NULL, password VARCHAR(255), role VARCHAR(255), + user_token VARCHAR(128), created_at DATETIME, keepmeloggedin VARCHAR(255), color VARCHAR(50), diff --git a/sys0-code/login/login.php b/sys0-code/login/login.php index 3329e2b..9e3db36 100644 --- a/sys0-code/login/login.php +++ b/sys0-code/login/login.php @@ -375,7 +375,12 @@ EOF; - +
+ +

Oder

+ mit Jakach account einloggen +
+
diff --git a/sys0-code/login/oauth.php b/sys0-code/login/oauth.php new file mode 100644 index 0000000..e455c01 --- /dev/null +++ b/sys0-code/login/oauth.php @@ -0,0 +1,104 @@ +location.href='/app/overview.php';"); + }else{ + echo("
Dein System0 Account wurde noch nicht mit deinem Jakach account verknüpft!
"); + } + + // Return a success response + } else { + // Authentication failed + echo '
Invalid auth token
'; + } +} else { + // Invalid response format or missing status + echo '
Server error
'; +} + +?> diff --git a/sys0-code/login/reset-password.php b/sys0-code/login/reset-password.php index 3faffdf..5da0f0d 100644 --- a/sys0-code/login/reset-password.php +++ b/sys0-code/login/reset-password.php @@ -15,7 +15,7 @@ $new_password_err = $confirm_password_err = ""; $old_password=""; $old_passwort_err=""; // Processing form data when form is submitted -if($_SERVER["REQUEST_METHOD"] == "POST"){ +if($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["old_password"])){ $login_err=""; //first: validate old password if(empty(trim($_POST["old_password"]))){ @@ -45,6 +45,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){ // Redirect user to welcome page $auth=true; + $change=true; } else{ // Password is not valid, display a generic error message $login_err = "Invalid password."; @@ -61,7 +62,7 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){ } } } - if($auth===true) + if($auth===true && $change===true) { //end of old_password validation // Validate new password @@ -115,6 +116,17 @@ if($_SERVER["REQUEST_METHOD"] == "POST"){ } } } + +if(isset($_POST["user_token"])){ + $sql="update users set user_token = ? where id = ?"; + $stmt = mysqli_prepare($link, $sql); + $user_token=$_POST["user_token"]; + $id=$_SESSION["id"]; + mysqli_stmt_bind_param($stmt, "si", $user_token, $id); + mysqli_stmt_execute($stmt); + mysqli_stmt_close($stmt); + $msg="User Token wurde hinzugefügt."; +} // Close connection mysqli_close($link); ?> @@ -178,6 +190,21 @@ echo("
");?> echo '
' . $login_err . '
'; } ?> +

Hier kannst du deinen Jakach-Account verknüpfen, um dich leichter einzuloggen.

+

Du findest dein User-Token in bei deinem Jakach Account (hier) +

+
+
+ + +
+ +
+
+ ' . $msg . '
'; + ?>