Can't Login after Transfer
I have just transfered Mahara from a remote host to a local server.
I have Altered the Config.php for the new database connections and ran the sql dump to bring over all the data from the remote site.
An have also copied the mahara data file over the the new local direcotory and changed the config to poin to this location.
As I don't know the manual login admin password H abe nulled the salt field and entered a plain string password in the password field
but when I try and login I get
"You have not provided the correct credentials to log in. Please check your username and password are correct."
Any Ideas on what I have missed for the transfer !!
any help wloud be much appreciated
thanks.
Re: Can't Login after Transfer
Hi Gerry, from Mahara 1.4 onwards you can no longer use cleartext passwords, but when you have access to the server and need to hack in to an account, you can temporarily install a little php script like this to reset someone's password, for example, for user 123:
<?php
define('INTERNAL', 1);
define('PUBLIC', 1);
require('init.php');
require_once('auth/lib.php');
$user = get_record('usr', 'id', 123);
$user->password = 'changeme';
reset_password($user);
Don't forget to remove the script afterwards!
Re: Can't Login after Transfer
Hi Richard,
This sounds like a solution to my problem (I've forgotten the admin password and I don't know the email address used) ... but how do you install the script?
Dantina
Re: Can't Login after Transfer
Hi Dan,
To use the script, you make a new .php file called whatever you wish (example: resetpasswordscript.php) inside the htaccess directory.
Once you've done that, you type in your mahara url and add the filename to the end after a /. For our example filename and the example.com url, that would be example.com/resetpasswordscript.php
The script won't show anything on the screen, the screen will be empty. Once the browser has loaded it, you can go back to your mahara site and log in with the password you asked the script to set for you.
Immediately after logging in, delete the file you made. Scripts like this should never be left sitting around.
Hope this helps,
Melissa.
Re: Can't Login after Transfer
Hi Richard,
It seems that I also have the same problem.
I'm using Mahara 1.5.2 (upgrade it from 1.4) and PostgreSQL 8.4 on Ubuntu Linux.
I can't login using admin user, after I enable passwordsaltmain parameter in config.php . Before it, everything is OK. I tried to using your script below :
<?php
define('INTERNAL', 1);
define('PUBLIC', 1);
require('init.php');
require_once('auth/lib.php');
$user = get_record('usr', 'id', admin);
$user->password = 'my_new_password';
reset_password($user);
?>
I got error message like this :
Mahara: Site unavailable
A nonrecoverable error occured. This probably means you have encountered a bug in the system
Is the any other way to reset my admin user?
Thank you
--
Pungki Arianto
Re: Can't Login after Transfer
Hi Pungki,
The error you got is because the line "$user = get_record('usr', 'id', admin);" is invalid code.
The word admin there needs to be replaced with the user id, which is a number. In most cases, admin will be user 1, but you need to check in the database table.
Thanks,
Melissa
Re: Can't Login after Transfer
Hi Melissa,
Thanks You !!!! ![]()
![]()
![]()
You saved my day. Now I can login as Admin and continue my work.
Anyway, I want to ask something. What should I put on passwordsaltmain parameter?
Can I put word like "Hello_this_is_mahara" or I have to put a random character which is generated from some tools?
Thanks
--
Pungki Arianto
Re: Can't Login after Transfer
Hi Pungki,
It can be anything really, but for best security, it should be something impossible to guess.
What I tend to do is type 'pwgen' into my linux terminal and use a whole line from that. It can have the spaces in there too.
Thanks,
Melissa.
Re: Can't Login after Transfer
Hi
We have also just transferred our Mahara/Moodle installation to an new server/url
I am having the same problem of not being able to login as admin but with the mahara database in maintenance mode. Should this technique still work? It doesn't seem to.
I used the admin page to change the auth instances of every user (including admin) because using SSO from Moodle was creating duplicate users instead of picking up the existing records. This has triggered the cannot login plus maintenance mode messages.
I have gone into the database to restore the admin users auth instance to 1 but still no joy.
Anything else I can try?
Thanks
Richard