Forums | Mahara Community
Can't Login after Transfer
12 June 2012, 4:29
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
12 June 2012, 18:44
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!
13 June 2012, 0:33Great thanks Richard
20 July 2012, 1:03
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?
20 July 2012, 3:54
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,
28 August 2012, 17:48
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?
28 August 2012, 21:13
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.
29 August 2012, 0:05
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?
29 August 2012, 5:37
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.
14 January 2013, 15:15
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?