webERP Forum
[SOLVED] Access denied at log in - How to reset password - Printable Version

+- webERP Forum (http://www.weberp.org/forum)
+-- Forum: webERP Discussion (/forumdisplay.php?fid=1)
+--- Forum: Problems / Bugs? (/forumdisplay.php?fid=8)
+--- Thread: [SOLVED] Access denied at log in - How to reset password (/showthread.php?tid=2486)



[SOLVED] Access denied at log in - How to reset password - MacPhotoBiker - 06-12-2015 04:15 AM

Hi,

I get an "access denied" error when logging in (please see attached screenshot). I'm not mistyping the password, but I can't be sure if maybe "somewhere else" I messed up the password.

Is it possible to set the password manually in the database? Would that be in table "www_users"? If so, do I need to encrypt the password first (SHA1, MD5)?

I'd really appreciate some advice. Thank you!


RE: Access denied at log in - How to reset password - phil - 06-12-2015 05:59 AM

It is more tricky now... in older versions you could go
UPDATE www_users SET password=sha1('mynewpassword') WHERE userid='me';
you could choose between md5 and sha1 as encryption options in config.php

It is much more secure now ... would need to dig into the code in session.inc and includes to figure out a solution. There is salt (no pepper) and other stuff involved.


RE: Access denied at log in - How to reset password - MacPhotoBiker - 06-12-2015 06:07 AM

Hi Phil,

thank you for your reply.

Unfortunately, I'm not much of a "coder", I'm truly just a user, and it's most likely pointless (for me) to dig into those files.

Would a "brute force" workaround be to backup the database, and reinstall webERP from scratch? I really need to get access to that database...

Thanks a lot!


RE: Access denied at log in - How to reset password - falkoner - 06-12-2015 07:24 AM

Hi, it now uses the much more secure PHP function password_hash() function. I haven't tried it, but try setting up a file called PasswordReset.php containing the following:

<?php
include('config.php');
$db = mysqli_connect($Host, $DBUser, $DBPassword, 'DatabaseName', $DBPort);
$Result = mysqli_query($db, "UPDATE www_users SET password='".password_hash('weberp',PASSWORD_DEFAULT)."' WHERE userid='admin'");
?>

Replacing DatabaseName with the real name of your database. Run this from the browser and it should just change the password to weberp.

Remove this script once it has run - for obvious reasons Smile

Tim


RE: Access denied at log in - How to reset password - MacPhotoBiker - 06-12-2015 10:56 PM

Hi Tim,

thank you very much for that script!
Unfortunately it didn't do the trick, but I think that's not because of the script.

I noticed that the error message (in the screenshot in the opening post) does not refer to the webERP user, but to the database user (which I set up in my cpanel account).

I think what I need to correct is not is the password for the connection to the database. Sorry, I put that wrong initially.

Could you help me out with that, too, please?

Sorry for the confusion (I trust the script might come handy one day anyway Wink )

Thanks a lot!


Hi,

ok,that's clearly a home made issue Sad I figured out where to define the database connection (config.php).

However, since I tried to "correct" my user password for webERP, I can't log in (and at the login screen it states that the password is wrong).

I ran the script that Tim provided, but when I try to log in now, it tries to run UpgradeDatabase.php automatically, which fails (see attached screenshot):

ERROR Message Report : Security settings have not been defined for your user account. Please advise your system administrator. It could also be that there is a session problem with your PHP web server

Could you please help me out with that, too?

Thank you so much!


RE: Access denied at log in - How to reset password - phil - 06-13-2015 05:03 PM

Well if you have access to the host's control panel you should be able to reset it ... or is it your own server..
you could reinstall mysql - default user is root with a blank password ... but many distributions make you install it with a more secure password now.


RE: Access denied at log in - How to reset password - falkoner - 06-13-2015 05:31 PM

Hi Gert,

Did you try clicking the logout link and trying again?
Did you make any other changes to config.php specifically to the line where the $SessionSavePath is set?

My script only changed the password, and didn't make any changes to the security settings so my guess is it is something else that was done.

Thanks
Tim


RE: Access denied at log in - How to reset password - MacPhotoBiker - 06-14-2015 01:22 AM

Hi Tim,

thank you very much again! I was rather confident that I did try to log out.... But after reading your comment, I just tried again - and it did the trick!

Thank you very much again for the script to change the password! I deleted it from my server, but I will definitely keep a copy Smile

Very best regards from Canada

Gert


(06-13-2015 05:03 PM)phil Wrote:  Well if you have access to the host's control panel you should be able to reset it ... or is it your own server..
you could reinstall mysql - default user is root with a blank password ... but many distributions make you install it with a more secure password now.

Hi Phil,

thanks a lot for looking into it. My server is a dedicated WHM/ cpanel server, and webERP runs on one of the cpanel accounts. Fortunately Tim's script indeed changed the password successfully, and the initial "Security settings" warning also "healed".

Thank you very much again for all the support - although it was clearly not a "webERP issue".

Gert


RE: [SOLVED] Access denied at log in - How to reset password - cyrilca0001 - 11-15-2015 11:36 AM

Hi, got myself in a similar trouble. Tryed Tim's solution, I am afraid I am not getting it right...

1) Created a file password.php, and saved it in weberp folder
2) Is 'weberp' my database name? (i mostly used default installation settings)
3) http://localhost/weberp/password.php
4) Result:

Fatal error: Call to undefined function password_hash() in /Library/WebServer/Documents/weberp/password.php on line 4

What am I doing wrong?
(11-15-2015 11:36 AM)cyrilca0001 Wrote:  Hi, got myself in a similar trouble. Tryed Tim's solution, I am afraid I am not getting it right...

1) Created a file password.php, and saved it in weberp folder
2) Is 'weberp' my database name? (i mostly used default installation settings)
3) http://localhost/weberp/password.php
4) Result:

Fatal error: Call to undefined function password_hash() in /Library/WebServer/Documents/weberp/password.php on line 4

What am I doing wrong?

OK, found the solution:
1) Update PHP to 5.5 or newer
Link for Mac OS X: http://php-osx.liip.ch/
2) Create php script - from Tim's post
3) The php file is to be saved in weberp folder
4) Run the file from browser - in my case: http://localhost/weberp/password.php
5) If script worked, you see a blanc page!