Jump to content

gebeer

Members
  • Posts

    1,386
  • Joined

  • Last visited

  • Days Won

    39

Everything posted by gebeer

  1. I am experiencing problems when sending through Gmail on a site that is sending out quite a lot of emails to different recipients. It used to work for about a month and now suddenly Google is blocking my app. It seems that Google regards the app as less secure. I am wondering if someone has had similar issues with Gmail? I know there is a setting in Gmail to allow less secure apps. But I would like to know why Google thinks the app is less secure. Does it have something to do with headers being sent by WireMail that Google disqualifies as insecure? Here is the data array from the WireMailSmtp object (sensitive data has been replaced by xxx): default_charset => "UTF-8" (5) localhost => "dev.xxxtors.com" (31) smtp_host => "smtp.gmail.com" (14) smtp_port => 587 smtp_ssl => "" smtp_start_tls => 1 smtp_user => "info@xxxtors.com" (32) smtp_password => "xxx" (11) smtp_password2 => "" clear_smtp_password => "" realm => "" workstation => "" authentication_mechanism => "" smtp_debug => 0 smtp_html_debug => 0 sender_name => "xxx" (24) sender_email => "info@xxxtors.com" (32) sender_reply => "" sender_errors_to => "" sender_signature => "" sender_signature_html => "" send_sender_signature => "1" extra_headers => "" valid_recipients => "" smtp_certificate => "" And here the mail object data to => array (2) "xxx@gmail.com" => "xxx@gmail.com" (26) "xxx@mailbox.org" => "xxx@mailbox.org" (28) toName => array (2) "xxx@gmail.com" => "" "xxx@mailbox.org" => "" cc => array () ccName => array () bcc => array () from => "info@xxxtors.com" (32) fromName => "xxx" (24) priority => "" dispositionNotification => "" subject => "xxx" (51) body => "This is an automatically created email. Please do not reply. xxx" (139) bodyHTML => "xxx" (183) addSignature => NULL attachments => array () header => array (1) "X-Mailer" => "ProcessWire/WireMailSmtp" (24) sendSingle => FALSE sendBulk => FALSE useSentLog => FALSE wrapText => FALSE Does anyone have an idea why Gmail thinks these mails are less secure?
  2. Hi, I had the same situation as the OP described: URL sent by email to go to a specific page after login. I solved it with 2 small hooks that I added to a module. You could also add them to your admin.php or ready.php My URL looks like .../?member=1222 where 1222 is the id of a user 1. hook adds a session variable before Login $this->addHookBefore('ProcessLogin::execute', $this, 'setRedirectId'); public function setRedirectId(HookEvent $event) { if($this->input->get('member')) { $this->session->set('goToMember', $this->sanitizer->int($this->input->get('member')); } } 2. hook has the redirect logic and removes the session variable $this->addHookAfter('Session::login', $this, 'loginRedirects'); public function loginRedirects(HookEvent $event) { if($this->user->hasRole('certificationadmin') && $this->session->get('goToMember')) { $member = $this->pages->get($this->session->get('goToMember')); if($member && $member->id) { $this->session->remove('goToMember'); $this->session->redirect($member->statusPageUrl); // statusPageUrl is a custom property for users that I added via another hook } } }
  3. The problem in my case is that this project will have more than 2000 users that will logon from all over the world. So I guess I will have to disable session fingerprinting to make sure that everyone can connect without issues.
  4. @bernhard I'll see what I can do with the $config->sessionFingerprint settings to avoid these problems. Although I don't feel comfortable messing with security features...
  5. thank you both for your feedback. Is there anything we can do to work around those security restrictions? EDIT: guess it has something to do with $config->sessionFingerprint setting. I'll play around with that.
  6. Hello, I have a situation were a user cannot logon to several different PW installs fromdifferent machines on his workplace network. Sometimes the initial logon is working but when navigating the PW backend he gets thrown out. Sometimes even the initial logon is not working and he is redirected too many times and the browser throws a redirection error. This points to PW loosing it's session. But the same sites are working fine when accessed from within other network environments. The user's workplace network has some pretty tight security (firewall) restrictions in place that prevent PW keeping it's session. I don't know enough about network security so I can't tell what exactly could cause that problem. I checked in the browser settings to make sure session cookies are allowed and there. Has anyone ever experienced issues like that and would there be a way to make PW keep it's session under these circumstances?
  7. @adrian unfortunately I couldn't find the reason for this. My workaround with the new user is still working, though. The install where the error occured is running on 3.0.42. I can't say if it was related to an update. Really stepping in the dark on this one...
  8. Update: working with this setup for a few months, I had quite a few permission related issues which were frustrating. So I decided to do some more research on existing docker projects that are well maintained and bring the features I need. Finally I found http://laradock.io/. I've been using it for 3 months now and I am really happy with it. Very flexible and well maintained set of docker containers. I'm totally happy and can recommend it to devs who are interested in this topic.
  9. @Robin S thank you! I didn't find this in my search. Great that it is being taken care of
  10. Hello, on a fresh 3.0.62 install I have a page reference field 'mypages' with these settings for selectable pages: In my site/ready.php I have this hook: /** * custom page select */ wire()->addHookAfter('InputfieldPage::getSelectablePages', function($event) { if($event->object->name != 'mypages') return; $pages = new PageArray(); $pages->add($this->pages->get(1)); $ids = $pages->explode('id'); $event->return = $event->pages->getById($ids); }); On a normal page, the hook is working and the mypages field has only 'Home' in the select dropdown . But when I put the mypages field inside a repeater, it is not working. I have this problem on a project that is in development right now and have spent quite some time to try and find the reason. Then I made a fresh PW install to verify the behavior. No matter if repeater dynamic loading is on or off, the page reference field always returns the set of pages defined by the settings in the page reference field. The hook is ignored. Can anyone please verify this and let me know so I can file a bug report. Also if you have an idea how to fix this, I would be happy.
  11. I agree with @Juergen on the start/end time input workflow with separate time input fields. Would like to use this module for a room occupancy calendar. @joshuag Is it possible with your module to have multiple events for one day with start and end times that recur daily/weekly/monthly? E.g. 17.00 - 19.00 every Monday 19.00 - 21.00 twice a month on Mondays etc.
  12. @Macrura the page edit process already loads the correct page when I call $processUser->executeEdit(); The problem is the redirection to accss/users/edit/&id=xxx that happens because of this line in ProcessPageEdit.module @Robin S fortunately PW's role/permission system got me covered here. The user is a 'member' user with own user template and parent. They have edit permissions for member users only. I restrict them from editing other member users by using a hook to ProcessPageEdit::loadPage that redirects them to their own user edit page when they try to access another user's edit page. So no security issues here. I was already thinking about making a feature request on github to support tabs in user profiles. Not too long ago I had opened a thread about this. It seems I'm not the only one who would need this. Thanks for your suggestion and code for the accordion. But I really do need tabs here. Otherwise the edit form gets too confusing for users because there are more than 20 fields. I had a look at the ProcessProfile to see if I could add the tabs functionality through a hook. But this seems not possible. Would have to extend the class and overwrite the buildForm method. Better open that feature request... But in the meantime it would be great to find a way around that redirection issue. I still don't understand why this hook in my process module public function ___executeMyprofile() { $this->addHookBefore("ProcessPageEdit::loadPage", $this, "interceptRedirect"); $processUser = $this->modules->get('ProcessUser'); return $processUser->executeEdit(); } protected function interceptRedirect(HookEvent $event) { $event->replace = true; $event->return = $this->user; } is not called at all.
  13. @benbyf thank you for your input. This is a process module called ProcessMemberDashboard that extends Process and it is for the backend. The module is built using the Hello Process Module Skeleton. I already have a working dashboard that is rendered by this module in the admin. There is a page under Admin with template admin and my ProcessMemberDashboard process assigned. Now I want to extend the module with the methods that I pasted in my first post to show the user edit screen from within my dashboard under the URL dashboard/myprofile. The problem really is the redirection that is happening. And that I can't seem to hook into the ProcessPageEdit::loadPage method from within my module. I just accidently found out that the hook is being called, when I open the URL access/users/edit/?id=5522 directly. Whereas it is not called when I open dashboard/myprofile which redirects me (through 4 redirect steps) to access/users/edit/?id=5522. So for the moment I'm still lost...
  14. @benbyf good point. It is a process module that creates a custom page in the admin. I don't know if autoload also applies to those. But I tested and added 'singular' => true, 'autoload' => true, to the module's .info.php. But same behaviour. The code in my hook method does not get executed and I still get redirected to /access/users/edit/?id=5522
  15. Hello, I have a Process module with a user dashboard and I would like to have the user page edit screen at a custom URL 'myprofile'. I cannot use the default profile edit page because it does not support tabbed interfaces. The method for executing the user edit page from within my module looks like this public function ___executeMyprofile() { $processUser = $this->modules->get('ProcessUser'); return $processUser->executeEdit(); } The user edit screen displays when I go to /dashboard/myprofile. But the request is redirected several times and I end up at the URL /access/users/edit/?id=5522 which I wanted to avoid. This happens because of this line in ProcessPageEdit.module. I guess the solution lies in hooking into the ___loadPage() method from within my Process module. But, honestly, I have no clue on how to put the pieces together. So I need some pointers on how to best achieve the goal of having the current user's edit page under a custom URL in the admin area, ideally in the scenario of a custom Process module. Any help would be much appreciated. EDIT: I tried some variations of hooking like public function ___executeMyprofile() { $this->addHookBefore("ProcessPageEdit::loadPage", $this, "interceptRedirect"); $processUser = $this->modules->get('ProcessUser'); return $processUser->executeEdit(); } protected function interceptRedirect(HookEvent $event) { $event->replace = true; $event->return = $this->user; } but the hook is not being executed at all. Also when placing the call to the hook in my Process module's init() method. Also when using an After hook and not replacing the hooked method. No luck so far...
  16. One more thing comes to mind: we aere always talking file permissions. Did you also check folder ownership/permissions?
  17. 3) when checking for file_exists, always use full path. Does it return false? If not, the file is readable. In the docs it says This function returns FALSE for files inaccessible due to safe mode restrictions. However these files still can be included if they are located in safe_mode_include_dir. So you might want to check for safe_mode. But you are saying other sites on the same server are running fine. So I guess its not safe_mode related 1+2) Did you compare file ownership and permissions with other sites installed on the server, anything unusual? Maybe have a look here to understand how permissions on host europe servers work: https://www.hosteurope.de/faq/webhosting/webpack/dateirechtestruktur/ Other than that I would have no clue either...
  18. @Robin S spot on! Thank you very much. This is working. Except for I had to exit the hook for template repeater_repeater. Otherwise I got an error "Call to a member function not() on null" for the "->repeater->not('published=0')" part of your code. The working version now reads wire()->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments[0]; if($page->template == 'repeater_repeater') return; if($page->isChanged('repeater')) { $old_repeater_value = $this->pages->getById($page->id, array( 'cache' => false, 'getFromCache' => false, 'getOne' => true, ))->repeater->not('published=0'); // exclude as-yet-unpublished items bd($page->repeater->count, 'new count'); bd($old_repeater_value->count, 'old count'); } });
  19. Did you also check the owner:group for the images that are not loaded, e.g. /site/templates/img/square/kinderlieder-ueber-den-fruehling.jpg? I had an issue once with host europe where the owner:group of files were wrong after uploading through FTP. I needed to ask their support to change file ownership to default. In the logs it says: No such file or directory for the images that are problematic. Are you sure that they are there? And in your templates/php/site/SquareImage.php you could do a check like file_exists() before processing the images to avoid a crash in case the image is not there.
  20. Hello, To compare repeater items when someone added or removed items to/from the repeater, I use this hook wire()->addHookAfter('Pages::saveReady', function($event) { $page = $event->arguments[0]; if($page->isChanged('repeater')) { //get page before changes : https://processwire.com/talk/topic/9734-determine-old-vs-new-value-of-field-when-saving/?do=findComment&comment=106166 $oldPage = $this->wire('pages')->getById($page->id, array( 'cache' => false, // don't let it write to cache 'getFromCache' => false, // don't let it read from cache 'getOne' => true, // return a Page instead of a PageArray )); bardump("new count: {$page->repeater->count}"); bardump("old count: {$oldPage->repeater->count}"); } }); When I add a repeater item, both counts are identical. But they shouldn't. When I remove a repeater item, the counts come out correct. I verified this behavior on a blank PW 3.0.62 install. So I think it is a bug. Can someone please check if they find the same behavior? Thank you. I also tried it with this hook wire()->addHookAfter('Page(template=basic-page)::changed(repeater)', function($event) { // old value bardump($event->arguments[1]->count); // new value bardump($event->arguments[2]->count); }); Same outcome. For the second hook to fire, you need to adjust line 1005 in wire/core/Wire.php to read if(($hooks && $hooks->isHooked('changed()')) || !$hooks) { because of this bug.
  21. @Robin S thank you for looking into this. I can confirm that after making the change to Wir.php the hook fires. I will open an issue. EDIT: added issue on github
  22. A quick google search brings up a relatively recent module Facebook Events. Reading through the docs and code should get you started.
  23. @SteveB Have you been able to solve this? I also needed a hook to intercept ProcessPageAdd. Following Pete's concept, I hook into ProcessPageAdd::execute. This works fine. The hook is placed in admin.php.
  24. Hello, I read about conditional hooks and wanted to utilize them. In the process of trying to implement them I found that they do not get called. So I reduced my hook to a minimum wire()->addHookAfter('Page::changed', function($event) { die('changed'); }); And nothing happens at all. Also with Page::changed(title) or Page(template=basic-page)::changed(title) no luck. In the code comment in Wire.php it says: "Hookable method that is called whenever a property has changed while change tracking is enabled" I see that change tracking is enabled as wire()->addHookAfter('Pages::saveReady', function($event) { if($event->arguments[0]->isChanged('title')) die('changed'); }); is working. The hookable method ___changed() in Wire.php is empty. I tried this on 2 different installs PW 3.0.61 and 3.0.62 Can anyone please confirm or let me know if I'm doing anything wrong here. Thank you.
  25. @kixe thank you for clarifying. I had already suspected the repeater to be the cause.
×
×
  • Create New...