Jump to content

netcarver

PW-Moderators
  • Posts

    2,190
  • Joined

  • Last visited

  • Days Won

    45

netcarver last won the day on May 6

netcarver had the most liked content!

Profile Information

  • Gender
    Male
  • Location
    UK

Recent Profile Visitors

17,409 profile views

netcarver's Achievements

Hero Member

Hero Member (6/6)

3.1k

Reputation

18

Community Answers

  1. Yes, that's right. I use maybe 5 or so features from AoS and figured porting those over would be a good way to learn both how AoS does it, and how your tweaks work. I'll add as PRs, with attribution to tpr, as I go.
  2. Hi @bernhard I just tried adding the following tweak to the tweaks/ directory, and am getting an error from RockMigrations when the admin reloads. If I remove my attempted tweak, everything works again. I think this is in RM, rather than the tweak file. Thanks for the module, BTW. PageListShowExtras.php
  3. @d'Hinnisdaël Thank you. As an example with trailing hexadecimal video_id: https://vimeo.com/553329597/04c306a466 I've closed my PR for the time being.
  4. Thanks for the updates, Bernhard. Seems like I somewhat monopolised things this month :)
  5. Nice - I'll be able to make use of that at PWGeeks next time I update it. Thank you for the tip.
  6. I guess I'm just becomming really lazy as I age, and this tutorial can be taken as a sign of my growing sloth. I have a Yubikey that I use as my 2nd factor on a localy hosted PW site. And I've become tired of typing my admin username + password and hitting enter/clicking Submit + then having to tap the Yubikey to log in. I know, it's a local install, and I could just turn off my 2FA, but then I'd still have to type the username and password, and I'm too lazy even for that now (plus, I've started to hate passwords.) I'd really rather just tap the yubikey to be logged in! As PW's so hookable, I figured it would be pretty easy to modify the login process to allow me to do this, just for this site (well, maybe not just this one). Sure enough, it turned out to be pretty simple - though I do not recommend trying this on any sites hosted in the cloud. Firstly, you'll need the TfaWebAuthn module installed on the site, and have configured it on your superuser account. Once you are logging in successfully with that, add the following to site/templates/admin.php... /** * If there is only 1 superuser with TfaWebAuthn set up on the site, * and if the username is empty on login submission, we change the login_name * to the superuser's account name, and the login_pass to a dummy value to * allow the Session::authenticate hook to be called. * * Although the Session::authenticate method will fail we will hookAfter it * and pretend that it didn't. That will start 2FA credential collection * allowing us to proceed with just that protecting the account. * * For local installs where I have a YubiKey, this will be good enough. */ wire()->addHookAfter("ProcessLogin::loginFormProcessReady", function($event) { $uname = wire()->input->post->login_name ?? ''; if ('' === $uname) { $super_role_id = wire()->config->superUserRolePageID; $supers = wire()->users->find("roles=$super_role_id, tfa_type=TfaWebAuthn"); $num = count($supers); if (1 === $num) { $super = $supers->eq(0); wire()->input->post->login_name = $super->name; wire()->input->post->login_pass = 'dummy_password'; } } }); wire()->addHookAfter("Session::authenticate", function($event) { $super_role_id = wire()->config->superUserRolePageID; $supers = wire()->users->find("roles=$super_role_id, tfa_type=TfaWebAuthn"); $num = count($supers); if (1 === $num) { $user = $event->arguments(0); $super = $supers->eq(0); if ($user->id === $super->id && 'TfaWebAuthn' === $user->hasTfa()) { $event->return = true; // Override earlier failed authentication for this user } } }); As long as you leave the initial login details blank, all you need to do now is hit enter (or click Submit) and then tap the Yubikey to be logged in. Nice :)
  7. Just curious, can that also be done with page classes + magic pages, @bernhard ?
  8. In addition to the great suggestion from @Nicolas, you can also do it by prepending a Markup textfield to the edit form for just that particular template. Here's more code - I'd put this in site/templates/admin.php as this is only an admin feature. $pages->addHookAfter("ProcessPageEdit::buildForm", function($event) { $form = $event->return; $id = (int) wire("input")->get("id"); if (!$id) { return; } $editedPage = wire("pages")->get($id); if ($editedPage->template->name === "home") { // CHANGE TEMPLATE NAME HERE $f = wire()->modules->get('InputfieldMarkup'); $f->label = "Notes"; $f->value = "<p>Your HTML Notes in here.</p>"; $form->prepend($f); } });
  9. @Robin S @Mats @Marty Walker @ryan Pull request is in for this fix.
  10. @Marty Walker @Robin S @Mats Could you try the attached version of the module and see if it helps with your issues with Vimeo URL formats? Robin, Mats (I hope I got the right one), I've included you both as you have a similar issue open on the repo. TextformatterVideoEmbed.module
  11. Ok, other things that come to mind are... session.gc_maxlifetime is set to something low. You are using php-fpm and it has a different php.ini file with different settings to the one you looked at before (maybe)
  12. @Leftfield Got to run now, but can you check what your session.cookie_lifetime setting is (just in case it's this for you?)
×
×
  • Create New...