mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
add script for emergency password reset
This commit is contained in:
parent
1c27df9b32
commit
9403d1214a
2 changed files with 28 additions and 0 deletions
|
|
@ -45,6 +45,7 @@ unlink('./docker-config.php');
|
|||
unlink('./includes/lang/en-rtl.json');
|
||||
unlink('./includes/lang/_percent.php');
|
||||
unlink('./mtt-edit-settings.php');
|
||||
unlink('./mtt-emergency.php');
|
||||
unlink('./content/theme/images/svg2base64.php');
|
||||
|
||||
chdir('..'); # to the root of repo
|
||||
|
|
|
|||
27
src/mtt-emergency.php
Normal file
27
src/mtt-emergency.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
$dontStartSession = true;
|
||||
require_once(__DIR__ . '/init.php');
|
||||
|
||||
if (!need_auth()) {
|
||||
exitmsg("No password protection is set");
|
||||
}
|
||||
|
||||
if (isset($_POST['reset'])) {
|
||||
$pass = _post('pass');
|
||||
$hash = passwordHash($pass);
|
||||
Config::set('password', $hash);
|
||||
Config::save();
|
||||
exitmsg("Done");
|
||||
}
|
||||
else {
|
||||
exitmsg("<form method=post><label>Enter new password:<br><input name=pass type=password> <input name=reset type=submit></label></form>");
|
||||
}
|
||||
|
||||
|
||||
function exitmsg(?string $text = '') {
|
||||
echo "<h1>Password Reset</h1>\n";
|
||||
echo $text;
|
||||
echo "<br><br><hr> <i>For security reasons delete this file after usage!</i>";
|
||||
exit;
|
||||
}
|
||||
Loading…
Reference in a new issue