Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset password #684

Open
astronyu opened this issue Jan 11, 2025 · 4 comments
Open

Reset password #684

astronyu opened this issue Jan 11, 2025 · 4 comments

Comments

@astronyu
Copy link

Is there a way to reset password?

@ellite
Copy link
Owner

ellite commented Jan 11, 2025

If you have it enabled on your settings, you can just click the link on the login page.

Otherwise

Assuming you have access to your mounted folders
create a file resetpw.php on your mounted database folder

<?php
$databaseFile = 'wallos.db';
$db = new SQLite3($databaseFile);
$db->busyTimeout(5000);
$password = "mynewpassword";
$sql = "UPDATE user SET password = :password WHERE id = 1";
$stmt = $db->prepare($sql);
$hashedPassword = password_hash($password, PASSWORD_DEFAULT);
$stmt->bindParam(':password', $hashedPassword, SQLITE3_TEXT);
$result = $stmt->execute();
if ($result) {
echo "Password updated successfully.";
} else {
echo "Error updating password.";
}
?>

and run on your browser
http://ip:port/db/resetpw.php

@astronyu
Copy link
Author

Sorry for the late response.

I added the resetpw.php file in the same folder of "db", "images" but going to http://ip:port/db/resetpw.php I got this:

seFile = 'wallos.db'; $db = new SQLite3($databaseFile); $db->busyTimeout(5000); $password = "MYNEWPWD"; $sql = "UPDATE user SET password = :password WHERE id = 1"; $stmt = $db->prepare($sql); $hashedPassword = password_hash($password, PASSWORD_DEFAULT); $stmt->bindParam(':password', $hashedPassword, SQLITE3_TEXT); $result = $stmt->execute(); if ($result) { echo "Password updated successfully."; } else { echo "Error updating password."; } ?>```

but still can't login with the new password.

@ellite
Copy link
Owner

ellite commented Jan 16, 2025

There seems to have been a problem with the copy and paste of the code.
The file should start with

@astronyu
Copy link
Author

astronyu commented Jan 17, 2025

There seems to have been a problem with the copy and paste of the code. The file should start with

Yeah, my bad. Realized the code I copied from email notification was truncated.
Copied the one from here and page gave me this

Warning: SQLite3::prepare(): Unable to prepare statement: 1, no such table: user in /var/www/html/resetpw.php on line 7

Fatal error: Uncaught Error: Call to a member function bindParam() on bool in /var/www/html/resetpw.php:9 Stack trace: #0 {main} thrown in /var/www/html/resetpw.php on line 9

the resetpw.php added into /var/www/html using portainer console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants