Jump to content

All Activity

This stream auto-updates

  1. Past hour
  2. Thanks - that did it! Looks like forcing "isLocal" was what I needed here. In this case it's not a guest, though I'm guessing the permission level is equivalent to guest. (I haven't explicitly added any tracy related permissions to roles.)
  3. Today
  4. I'd prefer to not use iframe but when searching it was flagged as the best option. Any suggestions instead of iframe. I'm not a dev so just learn as I go, so any direction to go would be appreciated.
  5. I had to do this just the other week. We had an old CMSMS site that we'd moved to PW. We had a db table with the old user names and passwords in which we stuck on the new site, and then just created our own login page which first checked to see if we had the user in PW already. If the user isn't already in PW then check the password against the old table; If it matches then use that information to add a new user to PW. The users don't really notice that anything has changed. Here's the code I used for that - you'll have to adapt to your circumstances of course but it worked well for our move. if ($input->post('ml_name')) { // when processing form (POST request), check to see if token is present // (we have a CSRF field on our login form) if ($session->CSRF->hasValidToken()) { // form submission is valid // okay to process } else { // form submission is NOT valid throw new WireException('CSRF check failed!'); } $ml_name = $sanitizer->name($input->post('ml_name')); $ml_pass = $input->post('ml_pass'); // dont allow the guest username if ($ml_name === 'guest') { throw new WireException('Invalid username'); }; // do we have this user in PW already? $u_exists = $users->get("$ml_name"); if ($u_exists->id) { // user exists // lets try and log them in try { if ($session->login($ml_name, $ml_pass)) { $session->redirect('/'); } else { $ml_feedback = 'Unknown details.'; } } catch (WireException $e) { // show some error messages: // $e->getMessage(); } } else { // ok - well do we have this user in the old CMS table? $query = $this->database->prepare("SELECT * FROM `cms_module_feusers_users` WHERE username = :login_name LIMIT 1;"); try { $query->execute(['login_name' => $ml_name]); } catch (PDOException $e) { die ('Error querying table : ' . $e->getMessage()); } // we've got a user from the old table if($query && $row=$query->fetch()) { $ml_feedback='Is in old table'; $hash=$row['password']; // handily the old auth just uses password_verify if(password_verify($ml_pass, $hash)){ // Add this user to the PW users $new_user=$users->add($ml_name); if($new_user){ $new_user->pass=$ml_pass; $new_user->addRole('members'); $new_user->save(); $log->save("new_members_site", $ml_name . " added as user"); $u = $session->login($ml_name, $ml_pass); if($u) { $session->redirect('/'); } else { die("Error in logging in. Please contact admin."); } $ml_feedback='new user added to PW'; }else{ $ml_feedback='Unable to add new user. Please let admin know'; } }else{ $ml_feedback='No matching records found.'; } }else{ $ml_feedback='No record found.'; } } } and this is the login form that the we had on our new login page - this and the above was all in a single template. <form id="ml_login_form" class="ml_login_form" method="POST"> <?php echo $session->CSRF->renderInput(); ?> <label for="ml_name">Username</label> <input id="ml_name" name="ml_name" type="text" value="<?= $ml_name ?>" required> <label for="ml_pass">Password</label> <input id="ml_pass" name="ml_pass" type="password" value="<?= $ml_pass ?>" required> <div style="display: none;"> <label for="ml_pass_bear">Password</label> <input id="ml_pass_bear" name="ml_pass_bear" type="text" value=""> </div> <button type="submit" name="ml_submit" class="butt">Submit</button> <div class="ml_feedback"><?= $ml_feedback ?></div> </form>
  6. Loading a website after updating to PHP 8.x failed. The connection to the server was reset while the page was being loaded. NS_ERROR_NET_RESET PHP error was not catched, nothing displayed, nothing logged. After a long search, it turned out that the Gettext extension was responsible for the fatal error. Code example to reproduce: $locale = 'de_DE'; setlocale(LC_ALL, $locale); echo gettext("foo bar"); // NS_ERROR_NET_RESET After adding the environment variable LANG it worked as expected. $locale = 'de_DE'; setlocale(LC_ALL, $locale); putenv("LANG=$locale"); echo gettext("foo bar"); // foo bar Same behaviour with ngettext() and maybe other Gettext functions. Alternatively, the problem could also be solved with putenv("LC_ALL=$locale"); Possibly affected: ProcessWire\Languages::setLocale() I found little information about this behavior on the Internet.
  7. @Liam88 Check your header settings, maybe is set to deny https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-Options Do you really want to use iframe? It's obsolete.
  8. Hallo @Peter Knight Yes, it was referring to the /processwire/ manager login. I'm a bit surprised, because I thought it was already fixed.
  9. That's really good, thanks for the suggestions! I'm going to keep that as a potential way. I like it, thinking outside the box. 🙂 My somewhat liazier solution is simply to add a field to the user template: Legacy, Legacy converted, and New. If A Legacy user attempts a login it simply sends them to the password reset page. And when they do they become Legacy converted. Your way is far slicker so I'll present the client with both options.
  10. Hi @DrQuincy I think you can do this by hooking in to PW's login flow. Here's how I'd attempt to do this - untested - just to give you some inspiration... Create a new field on the User template for their hashed password from your old system. Write a script to populate this field where there's an email match between the old system and the new one. If the new system doesn't have users in it yet, then great, you'll be creating user records for everyone from the old system. Make sure you create a long, random, password for the initial processwire password on any new users you create and leave existing user passwords untouched. Store the hash from your system in the new field on the matching user and save any changes. You need a before hook on the session::login method. Use the name param (in $event->argument(0)) to match on emails if that's how you did it in the old system, if you have exactly one match, and this user has a non-empty value for your old password hash, use your existing pwd checking algorithm to authenticate them from the pass ($event->arguments(1)) parameter. If that works, the plaintext password they submitted to you is the correct password. Now set the PW password on that account using the plaintext password you just verified is correct AND delete the old password hash value. Now the correct password has been stored in the User's PW pass field, just exit the hook and PW should process the login as normal, or call the forceLogin method to log them in and do your own redirect. Basically, as people log in, they will auto-convert their accounts over to PWs way of doing things. Once they convert, the login process just reverts to using PWs method. Potential gotcha: more than one account in the PW system with the same email (if there are already accounts in there.) After a reasonable period has elapsed, you could then deal with seemingly dormant accounts by emailing non-converted users and asking them to login (or otherwise handle them as appropriate.) Hope that helps.
  11. Issue submitted: https://github.com/processwire/processwire-issues/issues/1911
  12. Hello @BrendonKoz, On the code above I didn't copy the namespace and use statements but this is not the issue, instead of using ProcesswireTemplate I can directly use strings but this is not working either. EDIT: I've edited my code to remove this ambiguity, using strings instead of class ProcesswireTemplate.
  13. I have an old custom site I built myself where the passwords are hashed using BCrypt. I'm assuming the answer is no due to the one-way nautre of hashing but is there any way to take my bcrypt-hashed passwords and import them into PW? Where as my passwords stored the BCrypt strength, hash and salt together, PW seems to store the hashed password in two parts. I think it's further complicated by the $config->userAuthSalt value (this looks more like a pepper to me). It can't be done, can it? In which case, will just have to copy the emails, etc across into PW and send them each an email asking they set a new password or display a message on the website if a legcay email is used to attempt a login.
  14. Yesterday
  15. Checking all 3 of these will probably do what you want, but I actually never use the second two because I make use of the "Enable Guest Dumps" button from the panel selector. Enable that, do what you need to do as a guest in a private window and then reload the PW admin where you are logged in as a superuser and you'll get the dumps recorded by the guest. Another thing is to make sure you have the "Tracy Exceptions" panel enabled so that if a guest user interaction results in an exception, the bluescreen with full stack trace will be made available for easy viewing. I rely on this for all my sites with Tracy's production mode. Hope that helps.
  16. I had thought I had Tracy enabled for all users (excluding guests) awhile back and disabled it. Now I can't seem to re-enable it now that I need to diagnose some things. I am not restricting non-superusers (or superusers for that matter), the Tracy Debugger is enabled, and I even tried to match the IP address using PCRE pattern of /.*/ with no luck.
  17. It works for me too in a similar context - i.e. when calling it to output: i.e in {$page->foo()} - but not when called in a variable declaration - ie. {var $foo = $page->foo()} That's when I seem to need {var $foo = $page->ProcessWire\foo()}. Odd. EDIT - Correction: The issue occurs not with page classes but just with functions defined in init.php (which is in the ProcessWire namespace.
  18. Agreed, because I read alot of forums and realized that it could allude to a myriad of reasons, only reason I was able to sort this was looking at the source and getting help from @Christophe
  19. I try to get info for an old url-path found in PagePathHistory. $p->getPathInfo() does not return anything but the basic empty reply. What am I doing wrong? $p = $modules->get('PagePathHistory'); $p->getPathInfo("/en/about/child-page-example/") array (10) 'id' => 0 'path' => '/en/about/child-page-example' 'language_id' => 0 'templates_id' => 0 'parent_id' => 0 'created' => '' 'status' => 0 'name' => '' 'matchType' => '' 'urlSegmentStr' => '' And that page is found in the database page_path_history table: INSERT INTO `page_path_history` (`path`, `pages_id`, `created`, `language_id`) VALUES ('/en/about/child-page-example', 1002, '2024-04-13 16:31:53', 0); The module PagePathHistory is version 0.0.8 and PW version 3.0.237.
  20. I'm responding with no experience using custom page classes, so if my reply is just silly, I apologize. 😁 Perhaps I'm missing something, but I think my question here is also the question that ProcessWire is throwing an error about. Where do your ProcesswireTemplate::INDIVIDUAL_CAR_CHOICES and ProcesswireTemplate::INDIVIDUAL_CAR_CHOICE variables' values come from? In fact, where is the ProcessWireTemplate class located? There's a Template class in wire/core, but I'm not seeing a Processwire* class anywhere. If those classes/values don't exist, that could cause the errors to be thrown. If you're moving the code to another class, maybe it's not actually being called/used and ProcessWire is falling back to using the standard Page class?
  21. If you have a look at the RockFrontend Site Profile you'll see that it should work without namespaces: https://github.com/baumrock/site-rockfrontend/blob/3c6dcc3d6a73432f4a98f5d47bec9858fa1fbd23/templates/sections/footer.latte#L17 https://github.com/baumrock/site-rockfrontend/blob/3c6dcc3d6a73432f4a98f5d47bec9858fa1fbd23/classes/HomePage.php#L27 I have no idea why the syntax you mention would work. I've never seen adding a namespace on the method call of an object 😮
  22. I do love Latte, but one little thing is puzzling me at the moment: namespaces. I am using custom page classes for all my 'business logic' - e.g a method getEmailHash() in the custom page class called in the Latte script with $page->getEmailHash(). The class has the namespace ProcessWire. It seems that I always need to specify the namespace in the method - i.e. $page->ProcessWire\getEmailHash(). Is there a way of avoiding this?
  23. There are several modules that might help. Most by Macrura here in the forums.
  24. You can use https://processwire.com/modules/fieldtype-runtime-markup/ for that.
  25. Hi all! Is there a way to add comments and documentation directly in the admin area, e.g. above the page editor? Field descriptions and notes are not sufficient in some cases, when one wants to document more complex things or explain something more detailed. I know that one can add a custom admin page, but I am searching for a way to document things directly in the pages where the editor users are working. Thanks in advance for any tips!
  26. Depending on your requirements, the Stripe payment processor for FormBuilder might be worth investigating. You can set Paypal to be a payment option in Stripe so that users can pay using PayPal but you can keep all your transactions on the same plaform. Out of the box FormBuilder might not do everything you need (if you need a basket etc) but it is possible to hook into the module to update line items / prices etc. We recently built a basket system for a site that we'd wired directly into Stripe but then shifted over to hook into Formbuilder instead because it already did a lot of the heavy lifting in using the Stripe API.
  27. I've only just spotted this but, in my ddev environment, if I modified a page the modified date was always recorded as one hour earlier. So appears on the settings tab immediately after doing a modification (at 14:55). The production environment was OK. I have $config->timezone = 'Europe/London'; throughout in config.php. It seems that you also need to set the timezone (in my case 'timezone: Europe/London') in the ddev config.yaml
  28. Maybe open an issue in the issue tracker if not yet done?
  1. Load more activity
×
×
  • Create New...