If you have lost your password for any reasons, you can follow this tutorial and reset it manually. This tutorial supposes that you have FTP access and are able to edit files in your server. 1. Open \application\bootstrap\app.php file. 2. Add the following code at the end of this file.

Route::register('/manual_reset_password', function() {

    $userIDToReset = 0; //enter USER_ID here
    $newPassword = 'ENTER YOUR NEW PASSWORD HERE';

    $hasher = new \Hautelook\Phpass\PasswordHash(Config::get('concrete.user.password.hash_cost_log2'), Config::get('concrete.user.password.hash_portable'));

    $ui = UserInfo::getByID($userIDToReset);
    $username = $ui->getUserName();

    $db = Database::connection();
    $dh = Loader::helper('date');
    $dateTime = $dh->getOverridableNow();

    //update password
    $statement = $db->executeQuery(
        'UPDATE Users SET uPassword = ?, uLastPasswordChange = ?  WHERE uID = ?;', 
        array(
            $hasher->HashPassword($newPassword),    
            $dateTime,
            intval($userIDToReset)
        )
    ); 

    //delete password
    $statement = $db->executeQuery(
        'DELETE FROM UserValidationHashes WHERE uID = ?;', 
        array(
            $userIDToReset  
        )
    ); 

    printf("Password for username = %s (ID=%s) has been changed to '%s'.", $username, $userIDToReset, $newPassword);
    printf("<h2 style='color:red'>");
    printf("DO NOT FORGET TO REMOVE THIS CODE AFTER CHANGING THE PASSWORD.");
    printf("</h2>");

});
  1. Change '$userIDToReset' & '$newPassword' appropriately.
  2. Run this path in your browser: http://www.yoursite.com/index.php/manual_reset_password
  3. After checking whether your new password works, remove the appended code in step 2.
Loading Conversation