Posts by JordinB

    Seems like pretty much any attribute i add gets stripped out when Perch renders the input so :


    Code
    1. <perch:content id="registrationSession" label="Session" type="text" help="Exemple: HH2019 pour l'hiver 2019" data-test-attr="test123" class="test-class" pattern="[A-Z]{2}[0-9]{4}" />


    renders:


    Code
    1. <input type="text" id="perch_18_registrationSession" name="perch_18_registrationSession" value="" class="text m input-simple">

    Hi,


    Is there a way to specify an input mask on a text field to be rendered within the Perch cms ? I'm searching the docs, but haven't run across anything. What i would like to do is to have a text region available that would limit the input to something like: AA9999 so that the editor could only enter a 2 uppercase letters followed by 4 numbers to help define a standardized input on the field.


    If it's not possible out of the box, is there a way I could implement it through a custom app ?


    Thanks.

    I actually wrote it because i find that tinify offeres a decent number of free optimizations per month. Most of my clients won't reach bust through that limit. I've never found the need to use Kraken honestly i was't aware of it until i saw the plug-in on the Perch site. I've always used Tinify.

    neahan,


    if you want to try to override the native browser validation messages, look into playing around with the custom validity and onInvalid event handlers:

    Code
    1. var myInput = document.getElementById('someid');
    2. myInput.oninvalid = function (e) {
    3. e.target.setCustomValidity("");
    4. if (!e.target.validity.valid) {
    5. e.target.setCustomValidity("MY INVALID MESSAGE");
    6. }
    7. };

    Browser support is pretty good: https://caniuse.com/#search=setCustomValidity . The only downside i see to this is you're overriding the messages that would normally be displayed in the users default language by something you're set explicitly. So if going that route, why not skip the html5 validation entirely and go with a JS based validation.

    @lauenceh,


    For your vhosts, yes on the host server you create a vhost that is just a proxy and passes the traffic for your domain name to localhost:port of your container. you may need to install some apache modules to be able to setup the proxy, i can't quite remember exactly which ones, but the first time i set this up there was a great tutorial in the digital ocean knowledge base I followed which was very helpful.


    I wouldn't install certbot on the host server, i would attach a certbot container to your docker-compose.yml so that it become part of that application ecosystem. I agree you probably shouldn't be installing a whole pack of stuff on the host to get something running on docker, that would seem to me to be against the Docker "philosophy" ... if you can call it that.


    For my setups, the only thing the server does is configure a proxy to pass traffic to a container depending on port and domain name and persist data outside the container using mounted directories.


    Good luck and post your result, it will surly be useful for others! :thumbup:

    So it sounds like your issue is not so much Perch related, but getting LetsEncrypt CertBot working in a Docker environment with Apache ?


    I havent specifically implemented Letsencrypt with Docker yet but I have a hard time seeing how a different web server would change anything. Essentially, you want CertBot to verify the host and save the certificate files locally on the server, then mount those certificates into your application container for use. So it wouldn't matter how / where the certificates come from. Apache or Nginx would see a .pem to use for a ssl certificate. I know there is a CertBot Docker image you could include into your systems docker-compose.yml to bring up a CertBot container. I would say you mount the location where CertBot saves the certificates into the container so you can share that between the CertBot container and the web server container. Then Apache should just be configured to use the .pem file like any other .pem certificate.


    As long as the server responds to the domain name for verification you should be good to go. And for renewal of the certificates, just setup a cron to issue the renew command within the CertBot container which will automatically update the certs available within the web server.


    Was there something specific that was giving you issues ?

    drewm - since it doesn’t look like there is a way to send email if the tradition methods fail, do you think it would be possible to add and event handler : email.send_fail that passes the message object as a parameter?


    I don’t think that wouldn’t impact existing functionality and allow us to handle issues like this.


    I’d be happy to help implement and test .

    Unfortunately, all this seems to be for nothing as in my case, both sending via sendmail or phpmailer both throw an exception and therefore the event is not fired, it doesn't look like i have much options here to get mail sending.


    It would be cool if I could override PerchEmail.class.php to change the send function to:


    That way the event would be fired, and I could set the PERCH_EMAIL_METHOD to 'API' or something just not 'sendmail' or 'smtp' the rest would keep on working as usual.

    So problem solved. I had it already in my runtime but in my testing, i had commented out the app in the apps.php :rolleyes:.. so of course it wasn't registering. Curious though that the app was still included in the Perch site though even though it wasn't included in the apps.php.



    Arg... sorry for wasting your time. Thanks Drew & Ryan for the awesome support as usual

    Here's my admin.php :


    I have debug break points throughout, none of them get triggered when sending a perch_forms form from the public site, but if i send the email diagnostic from the perch system, it works fine.

    I must be missing something here. I created a small app to handle the email.send event. If I send an email from the perch settings email diagnostic, my function is fired after the send as expected, but if I send from a public facing form that uses perch_forms, it doesn't get fired even though the email is sent.


    I have a runtime.php like:


    PHP
    1. <?php
    2. require_once('util/autoloader.php');
    3. include('util/events.php');


    and my events.php:


    PHP
    1. <?php
    2. $API = new PerchAPI(1.0, 'cognetif_apimail');
    3. $API->on('email.send', 'Cognetif\ApiMail\Manager::email_send');


    and finally Manager.php :




    Shouldn't the event get triggered when sending email through perch_forms ?

    Ah.. that looks like it could work. It won't fire the event if an exception is thrown during the send procedure though. The best chance looks like if I default back to the sendmail settings, let it error and hopefully it errors out quietly. Sending through SMTP and phpMailer is probably going to throw an exceptions for sure.


    I'll try it out and see how it goes.


    Thanks!

    Hi,


    So my web host apparently disallows sending email from an external SMTP host for reseller accounts like mine. And I have a client that is using office 365 to manage their domain email, i cannot connect perch to the office365 SMTP nor can I use the local sendmail or connect to smtp locally. I could however use a web API such as SendGrid or others that offer the same service to send mail, but I'm pretty sure i would be bypassing the perch_forms email settings, auto responders etc.


    Is there anyway to override the Perch email send to use an other library other than PHPmailer so that the new class is used to send mail globally within Perch?


    Thanks.

    Hi everyone,


    Just wanted to share a new image optimization app similar to perch_kraken, except it uses the Tinify API to optimize images (free upto 500/month);


    It can be configured to optimize images directly when uploading or it can also be setup to run as a scheduled task. The queue list shows the image, original and optimized image file size as well as a graphical output for the % saved. There is also options to re-queue, or manually run or clean the queue as well.


    Here is the GitHub repo. If you use it let me know where!