Boost Posted February 12 Share Posted February 12 Hei guys, All the password resets in this forum don't work for me. I have the admin username with ID 41, but no luck. I noticed that all the examples for the password reset use username + password for the login. In my case, I use an email and password. Could that be the reason? Any ideas? Link to comment Share on other sites More sharing options...
Rudy Posted February 12 Share Posted February 12 Have you tried this method? https://processwire.recipes/recipes/resetting-admin-password-via-api/ Link to comment Share on other sites More sharing options...
virtualgadjo Posted February 12 Share Posted February 12 hi, no ? this one only resets the password (i think it's @bernhard who gave it) first, put this in you _init.php file or on top of your _main.php if($input->get->resetpassword == 1) { $admin = $users->get(41); $admin->setAndSave('pass', 'yournewpassword'); die("admin url = {$pages->get(2)->httpUrl}, admin username = {$admin->name}"); } then go to http://www.yoursite.com/?resetpassword=1 and, of course, immediatly remove this code from your template, goes without saying... it only uses and targets the first admin user (id 41) whichever login you're using have a nice day Link to comment Share on other sites More sharing options...
Boost Posted February 13 Author Share Posted February 13 Thanks @virtualgadjo, but no luck yet. I just got the admin login page. No error. Nothing happens. I just cannot get in. I tried to find any hints in the logs, but nothing there either. 16 hours ago, Rudy said: Have you tried this method? https://processwire.recipes/recipes/resetting-admin-password-via-api/ I tried it and it didn't work. Link to comment Share on other sites More sharing options...
virtualgadjo Posted February 13 Share Posted February 13 Hi @Boost funny, i just had to use it for a friend yesterday and, once more (he often looses his password :)) it worked fine the thing is, using this trick, first go to the domain url (not the admin login one) with the ?reset... as it works on the frontend of course and as you can see it doesn't use any user name or email to do the trick, only the user id to check if it does something you may try having the "field_pass" table opened, refreshing it after you've gone to the homepage with the reset get var to see if it worked or at least did something have a nice day Link to comment Share on other sites More sharing options...
Boost Posted February 13 Author Share Posted February 13 30 minutes ago, virtualgadjo said: to check if it does something you may try having the "field_pass" table opened, refreshing it after you've gone to the homepage with the reset get var to see if it worked or at least did something Hi. How would you do that? Link to comment Share on other sites More sharing options...
zoeck Posted February 13 Share Posted February 13 You have to open the database + table (field_pass) in an SQL administration tool, e.g. PHPMyAdmin (Or if you have installed Tracy with Adminer, you can also use this) Link to comment Share on other sites More sharing options...
virtualgadjo Posted February 13 Share Posted February 13 @Boost oh yes, being an old guy, i like to see if what i do actually does something, i don't totally rely on my brain ? the important thing here is the homepage with the get var one as using the snippet in your _main ou _init only works on the front side have a nice day Link to comment Share on other sites More sharing options...
virtualgadjo Posted February 13 Share Posted February 13 @Boost sorry i misread your question... what @zoeck said ? Link to comment Share on other sites More sharing options...
Boost Posted February 13 Author Share Posted February 13 Thanks @zoeck. At least now I can confirm that nothing changed there. It seems that it's not resetting it. Link to comment Share on other sites More sharing options...
virtualgadjo Posted February 13 Share Posted February 13 @Boost where have you put the php snippet ? Link to comment Share on other sites More sharing options...
Boost Posted February 13 Author Share Posted February 13 1 minute ago, virtualgadjo said: @Boost where have you put the php snippet ? _init.php Link to comment Share on other sites More sharing options...
Boost Posted February 13 Author Share Posted February 13 When I run the script I get admin url = http://acme.local:8080/backend/, admin username = admin But nothing changes in the DB. Link to comment Share on other sites More sharing options...
virtualgadjo Posted February 13 Share Posted February 13 @Boost funny, maybe try on top of your _main.php file just after the namespace... but this seems to show it does work what i don't really get is your url using a :8000 port being used to set virtualhosts, looks like an url sent by vs code live server... Link to comment Share on other sites More sharing options...
Boost Posted February 13 Author Share Posted February 13 Yeah. I'm using it on my local machine. I set up a virtualbox to server the LAMP. That's why I need to use 8080 for the port forward ? Link to comment Share on other sites More sharing options...
virtualgadjo Posted February 13 Share Posted February 13 maybe (really maybe...) your issue comes from the mysql port in your virtualbox but if the website works it shouldn't i must say i'm a litte stuck here as using this trick quite often i never ran into that kind of problem be it online or locally Link to comment Share on other sites More sharing options...
Boost Posted February 13 Author Share Posted February 13 No problem @virtualgadjo, thank you for help! Link to comment Share on other sites More sharing options...
virtualgadjo Posted February 13 Share Posted February 13 @Boost my pleasure of course but i would have prefered it was useful ? have a nice day Link to comment Share on other sites More sharing options...
Boost Posted February 14 Author Share Posted February 14 As a follow-up, I got it working with the @virtualgadjo script. Thank you!. My issue was within the Apache setup. My directives were not right. Fixing that, and the reset worked like a charm. Link to comment Share on other sites More sharing options...
virtualgadjo Posted February 14 Share Posted February 14 Hi @Boost ah yes, great to "hear" this (actually it's a @bernhard script i keep carefully in a txt file ? ) have a nice day Link to comment Share on other sites More sharing options...
bernhard Posted February 14 Share Posted February 14 Well, actually it might be even more fun to do this: // site/ready.php // REMOVE THIS AFTER PASSWORD RESET!!! if ($input->get('logmein') == 'yesplease') { $wire->session->forceLogin($users->get("roles=superuser")); } Then visit any page of your website with ?logmein=yesplease and reset your password from within the PW backend ? 2 2 Link to comment Share on other sites More sharing options...
virtualgadjo Posted February 14 Share Posted February 14 @bernhard ? great to have you here and thanks a lot, i keep this one as carefully as the former one and will try it next time i'm asked for help by a friend having lost his password ? have a nice day 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now