Jump to content
danielholanda

forgot backend password, how do you reset?!

Recommended Posts

Hello,

I see that the backend of processwire is simple. I like that but... I've forgotton my email for my backend project I'm creating locally with MAMP. Simple but... where is the button such as, "forgot password". I suppose I missing something obviuos but I cannot find it in the display neither in google or in these forums.

So,

How do you reset/retieve your password from you backend of processwire?

Greetings,

Dani

Share this post


Link to post
Share on other sites

There's a Password Forgot module but not installed by default.

I think only solution would be to install new, or do this:

Create a /tool.php in the same directory as the /index.php in the root of PW install.

Paste in this code:

<?php
include("index.php");
wire("modules")->get("ProcessForgotPassword");

Save it and if necessary upload it to your server. Remember the file as you'll need it shortly.

Now call it from the browser http://yourdomain.com/tool.php and the Module will get installed and a Password forgot link should show up on the login screen.

Delete the tool.php.

Edit: You can, using this technique, also set a new password for the admin, see on the link Diogo posted.

Share this post


Link to post
Share on other sites

Thanks... Luckily I dodnt do too much, I will resintall and activate module. There should be a PDF with instructions and one of the first should be reset password module. If you have a lot of work already done... ufffff I would get mad. Thanks for your answers

Share this post


Link to post
Share on other sites

As being said you can set a new password through a script, install the module through the php script or if nothing helps reinstall (of course only if you haven't done anything yet). So no biggy at all if you have access to your files, which I assume you should have. This would be a matter of 1 minute and no need to reinstall.

So no need to going mad even if you developed for days on it.

The password is something you shouldn't forget, and the forgot password module isn't installed by default for security reasons.

Share this post


Link to post
Share on other sites

You can always reset your password just by pasting this temporarily into any one of your templates, and then viewing a page that uses the template:

$u = $users->get('admin'); // or whatever your username is
$u->of(false); 
$u->pass = 'your-new-password';
$u->save();
  • Like 16

Share this post


Link to post
Share on other sites

BTW, what is the location of login/password in the database? I didn't go into it but it would be practical to know.

Share this post


Link to post
Share on other sites

I think from memory that the table is called users (can't check from my phone) but the password would of course be encrypted so that wouldn't do you much good if you we're intending to reset it there.

Share this post


Link to post
Share on other sites

Passwords are in a table called field_password. They are hashed and salted, and not reversible, so no way to set or change them without going directly through the API.

Share this post


Link to post
Share on other sites

Little OT: is it possible to use password field on other templates?

Share this post


Link to post
Share on other sites

Where getting a little old!

It's field_pass not field_password

And yes you can put a "password" field in other templates :P

Share this post


Link to post
Share on other sites

Add new field, select "password" field and enter name..

Ahhh you mean so it get's used as a real password field with encryption? I don't think but should be possible to add functionality through a module?

Edit: look normal so far, it works without anything!

  • Like 1

Share this post


Link to post
Share on other sites

Ah, brilliant! I tried to add the existing password field into a template without any luck on that :) Never realized that I could create new password fields, but it is indeed possible! Thanks Soma! Of course need to know how to calculate the password hash (to compare the one that gets added into a db), but that should be easy enough.

Share this post


Link to post
Share on other sites

you can use the $page->passwordfield->match("somepasswordstring") function to compare hashs.

  • Like 1

Share this post


Link to post
Share on other sites

Passwords are in a table called field_password. They are hashed and salted, and not reversible, so no way to set or change them without going directly through the API.

But... if you just need to reset a password and using a Mysql prompt feels easier than adding temporary .php files, this brutal SQL clause sets admin's password to 'admin1': 

UPDATE field_pass f, pages p, templates t SET f.data='rO65UGbDmOQYVanmOznTp1zJMhM1p2e', salt='$2y$11$Y89v0EVaoVB7Vg/Yiq7xqO' WHERE f.pages_id=p.id AND p.name="admin" AND p.templates_id=t.id AND t.name="user";

Just remember to change it later on. :)

Update: this doesn't work since PW also uses a static salt in config.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By schwarzdesign
      We recently rebuilt the Architekturführer Köln (architectural guide Cologne) as a mobile-first JavaScript web app, powered by VueJS in the frontend and ProcessWire in the backend. Concept, design and implementation by schwarzdesign!
      The Architekturführer Köln is a guidebook and now a web application about architectural highlights in Cologne, Germany. It contains detailled information about around 100 objects (architectural landmarks) in Cologne. The web app offers multiple ways to search through all available objects, including:
      An interactive live map A list of object near the user's location Filtering based on architect, district and category Favourites saved by the user The frontend is written entirely in JavaScript, with the data coming from a ProcessWire-powered API-first backend.
      Frontend
      The app is built with the Vue framework and compiled with Webpack 4. As a learning exercise and for greater customizability we opted to not use Vue CLI, and instead wrote our own Webpack config with individually defined dependencies.
      The site is a SPA (Single Page Application), which means all internal links are intercepted by the Vue app and the corresponding routes (pages) are generated by the framework directly in the browser, using data retrieved from the API. It's also a PWA (Progressive Web App), the main feature of which is that you can install it to your home screen on your phone and launch it from there like a regular app. It also includes a service worker which catches requests to the API and returns cached responses when the network is not available. The Architekturführer is supposed to be taken with you on a walk through the city, and will keep working even if you are completely offline.
      Notable mentions from the tech stack:
      Vue Vue Router for the SPA functionality VueX for state management and storage / caching of the data returned through the API Leaflet (with Mapbox tiles) for the interactive maps Webpack 4 for compilation of the app into a single distributable Babel for transpilation of ES6+ SASS & PostCSS with Autoprefixer as a convenience for SASS in SFCs Google Workbox to generate the service worker instead of writing lots of boilerplate code Bootstrap 4 is barely used here, but we still included it's reboot and grid system Backend
      The ProcessWire backend is API-only, there are no server-side rendered templates, which means the only PHP template is the one used for the API. For this API, we used a single content type (template) with a couple of pre-defined endpoints (url segments); most importantly we built entdpoints to get a list of all objects (either including the full data, or only the data necessary to show teaser tiles), as well as individual objects and taxonomies. The API template which acts as a controller contains all the necessary switches and selectors to serve the correct response in <100 lines of code.
      Since we wanted some flexibility regarding the format in which different fields were transmitted over the api, we wrote a function to extract arbitrary page fields from ProcessWire pages and return them as serializable standard objects. There's also a function that takes a Pageimage object, creates multiple variants in different sizes and returns an object containing their base path and an array of variants (identified by their basename and width). We use that one to generate responsive images in the frontend. Check out the code for both functions in this gist.
      We used native ProcessWire data wherever possible, so as to not duplicate that work in the frontend app. For example:
      Page names from the backend translate to URLs in the frontend in the form of route parameters for the Vue Router Page IDs from ProcessWire are included in the API responses, we use those to identify objects across the app, for example to store the user's favourites, and as render keys for object lists Taxonomies have their own API endpoints, and objects contain their taxonomies only as IDs (in the same way ProcessWire uses Page References) Finally, the raw JSON data is cached using the cache API and this handy trick by @LostKobrakai to store raw JSON strings over the cache API.
      Screenshots














    • By anttila
      We are developing an App that sends data over the Internet to ProcessWire (POST/JSON). We want password to be protected somehow when sending it, but I should be able to compare it to PW's passwords. We were thinking of using md5 encryption, but PW uses different encryption.
      How can I be sure that user has active account when they use the App?
    • By Margus Tamm | OnlineExpo
      Hi
       
      We need Processwire guru for our project onlineexpo.com. Project is "long term" and constantly evolving.
      We have Frontend developer, but we don't have backend guru yet.
      So, if you are interested at work, please contact me at "processwire@onlineexpo.com" and let's discuss about conditions.
       
      Margus
    • By activestate
      Hi,
      I have project done on localhost, all works fine. When i'm attempting to upload this project into live server all looks ok, but when i'll login as admin, i cannot edit anything. After saving, i see message that data is saved, but nothing happens. Impossible to edit nothing...
      Thanks for any tips.
      PS: No errors in  logs, data can be changed manually using phpmyadmin, so looks like no problems with database too....
      I've also noticed, that if some page has blank field i can add text and save. And this will be saved, but cannot be edit again.
    • By GWColeman
      Hi,
      I am working on a processwire project for my college. I created an entire site about a year ago without any problem. Today however, I was making some changes to the site and I was experimenting with duplicating data across multiple pages. There is a repeater on one of the pages that I need to be the same across all pages.

      I clicked the checkbox to autojoin within the field options for the repeater and processwire crashed. I am not able to make any changes to the page to uncheck and I cannot view the site any longer.
      This is the message I get on the page.
      Fatal error: Exception: Could not execute User::__construct() (in /var/www/html/wire/core/Pages.php line 323) #0 /var/www/html/wire/core/Pages.php(323): mysqli_result->fetch_object('User', Array) #1 /var/www/html/wire/core/PagesType.php(101): Pages->getById(Array, Object(Template), 29) #2 /var/www/html/wire/core/Session.php(64): PagesType->get(41) #3 /var/www/html/wire/core/ProcessWire.php(138): Session->__construct() #4 /var/www/html/wire/core/ProcessWire.php(46): ProcessWire->load(Object(Config)) #5 /var/www/html/index.php(185): ProcessWire->__construct(Object(Config)) #6 {main} in /var/www/html/index.php on line 217

      I tried to comment out 323 without any luck. I also took a look in the database to see if I could manually turn off the autojoin option. However, I was not able to figure out where the option was located within the database.
       
      Any help or suggestions would appreciated.
      EDIT:
      I was able to solve the issue on my own. I did a google search and found that I needed to change he flag for the field from 1 to 0 in the database, and everything works again.

      Here is the post that I found that solved the issue.
       
       
×
×
  • Create New...