Skip to content

Instantly share code, notes, and snippets.

@bondt
Forked from christian-kolb/reset.php
Last active August 29, 2015 13:56
Show Gist options
  • Save bondt/8972660 to your computer and use it in GitHub Desktop.
Save bondt/8972660 to your computer and use it in GitHub Desktop.
Place this file in your (Contao based) website's root folder and update your username in line 16. Then run it from the browser and log in to the backend using the password "random".
<?php
define('BYPASS_TOKEN_CHECK', true);
require('system/initialize.php');
class Reset extends Frontend {
public function __construct() {
parent::__construct();
$this->import('Database');
}
// 1. resets user's password to temporary to "random"
// 2. forces to change on login
// 3. if account was locked before, it's free now
public function run() {
$username = "YOUR_USERNAME"; // << set this to your username, obviously
$newPassword = sha1("random"); // thanks @aschempp for this addition
$this->Database->prepare("
UPDATE tl_user
SET password = ?
, pwChange = 1
, locked = 0
WHERE username = ?
")->execute(
$newPassword,
$username
);
}
}
$reset = new Reset();
$reset->run();
echo "Go ahead and re-set a new password!";
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment