Elxis CMS Forum

Support => General => Topic started by: ahmet on November 15, 2011, 11:29:59

Title: password recovery in localhost
Post by: ahmet on November 15, 2011, 11:29:59
hello all,
i have forgotten the localhost admin password.how do i recover it? thanks...
Title: Re: password recovery in localhost
Post by: nikos on November 15, 2011, 12:28:12
With phpMyAdmin open table elx_users of your site's database and click on view to see all users. There, edit the id of super administrator and into password field set a new one and on the left choose function MD5. Save it and you are ready.
Title: Re: password recovery in localhost
Post by: ahmet on November 15, 2011, 12:52:25
tnx..
Title: Re: password recovery in localhost
Post by: seadhna on April 19, 2015, 16:03:54
Hi, this method doesn't work anymore - what is the new process?
Title: Re: password recovery in localhost
Post by: webgift on April 20, 2015, 13:40:01
The replies of this thread are addressed to Elxis CMS 200x.x. We don't use MD5 encryption to Elxis CMS 4.x series
Title: Re: password recovery in localhost
Post by: seadhna on April 21, 2015, 14:30:18
Ok, thanks!
Title: Re: password recovery in localhost
Post by: webgift on April 21, 2015, 20:46:38
You are welcome!
Title: Re: password recovery in localhost
Post by: kyomar on September 21, 2016, 10:40:55
Hi, sorry for reopening this post but I have same problem but with elxis 4.x and the new method hasn't been explained here. I don't know whether this is connected but I couldn't login anymore after the latest update r1888.
Thank you!
Title: Re: password recovery in localhost
Post by: datahell on September 21, 2016, 14:28:23
If you updated from 4.2 re-download the 4.2 to 4.3 update patch and read carefully the how-to instructions. There is a big warning regarding passwords encryption method change.

https://www.elxis.net/edc/core/100.html (https://www.elxis.net/edc/core/100.html)
Title: Re: password recovery in localhost
Post by: kyomar on September 22, 2016, 04:22:33
Thanks datahell for your quick reply. I have updated from r1886, so this shouldn't be a problem. How can I recover the admin password in the database (phpadmin)?
Thank you!
Title: Re: password recovery in localhost
Post by: datahell on September 22, 2016, 19:01:30
The passwords (and all data) don't get affected by Elxis updates. I dont know how you lost it but this is what you should do.

Passwords cannot be changed via phpmyadmin because they are encrypted by Elxis. If you type a password, even md5 encrypted, via phpmyadmin simply you wont be able to login in Elxis! Passwords can be changed only inside Elxis.

Open the index.php file of the template you use. For example templates/chloe/index.php
Copy paste the code below to the top of the template (below line defined('_ELXIS_') or die....)

$username = 'myusername';
$password = 'mypassword';
if (isset($_GET['cp'])) {
   $elxis = eFactory::getElxis();
   $db = eFactory::getDB();
   $penc = $elxis->obj('crypt')->getEncryptedPassword($password);
   $sql = "UPDATE ".$db->quoteId('#__users')." SET ".$db->quoteId('pword')." = :xp WHERE ".$db->quoteId('uname')." = :xu";
   $stmt = $db->prepare($sql);
   $stmt->bindParam(':xp', $penc, PDO::PARAM_STR);
   $stmt->bindParam(':xu', $username, PDO::PARAM_STR);
   $stmt->execute();
   echo 'Password for user '.$username.' changed!';
   exit;
}

At the top of the code I wrote set the username of the user you want to change its password. For example
$username = 'someuser';
Set the new password for the user:
$password = 'somethingsecret';

Save index.php and visit your site by adding ?cp=1 in the URL. For example:
http://www.example.com/?cp=1

The password will be changed.
After that remove the extra lines you previously added in template's file index.php and you are ready to login with the new password.
Title: Re: password recovery in localhost
Post by: kyomar on September 23, 2016, 03:40:56
Thank you datahell, great support as usual.
The code worked well but I still cannot login (incorrect password). I have restored the backups (db & files) from before the update (r1886) and I can login. Then I installed the r1888 update again with the same result that I cannot login. So I assume it has something to do with the update. This is on a local install (localhost, lampp). I don't update the live version until I have solved this issue.
Thank you for your time/help - much appreciated.
Title: Re: password recovery in localhost
Post by: webgift on September 23, 2016, 11:53:38
Hello!
Apply the update to the latest version however keep the same old copy of crypt.helper.php file
as it is located to: /includes/libraries/elxis/helpers/ directory ;)
Title: Re: password recovery in localhost
Post by: datahell on September 23, 2016, 14:57:28
If you change the password as I told you, you will be able to login regardless Elxis version and update status. I guarantee that. If you cant login then maybe the browser sends a saved password. Delete saved passwords and re-try or try with a different browser. Update to Elxis latest version (use the latest crypt helper file), change the password as I told you (dont use strange symbols) and login.
Title: Re: password recovery in localhost
Post by: kyomar on September 24, 2016, 12:25:13
Thank you datahell and webgift. I have to disappoint you datahell, I still couldn't login although setting new password seems to have worked (Password for user **** changed!). After this I tried webgift's suggestion (old crypt.helper.php) and I can login again - great! But now when I check file-system it says crypt.helper.php needs update. So I guess there is something wrong with crypt.helper.php.

Update: I updated hosted version (live) us well and the same problem, cannot login anymore. Only restoring old crypt.helper.php file solved the problem.
Title: Re: password recovery in localhost
Post by: creon on October 01, 2019, 03:06:41
I can confirm that after I updated 4.1 to 5.0 I had the same problem.
After restoring old crypt.helper.php from a backup, my password worked again.

p.s sorry for the necro post
Title: Re: password recovery in localhost
Post by: datahell on October 01, 2019, 18:46:30
Do the trick below to get rid of the outdated crypt helper.

1. Login in Elxis administration
2. Delete the old crypt.helper.php file and upload the new one from Elxis 5.x. Click on any administration page once per 5-10 minutes in order not to get logged out.
3. Go to users > edit your account and change your password (you can set the same password if you like). You are ready!

If you have more users you can change their passwords or they can change them with the "I forgot my password" feature in users central.