Results 1 to 7 of 7

Thread: [solved]How to hash emails addresses in MM template ?

  1. #1
    User
    Join Date
    04-01-10.
    Posts
    218

    Default [solved]How to hash emails addresses in MM template ?

    Hi everyone,

    As a security, normal behavior in Contao for url (web or email addresses) is to hashe them in the source code.

    In MM, I'm using a text attribute for email data. But in my model, if I write
    HTML Code:
    <a href="<?php echo $item['text']['my_email_attribute']; ?>>mail</a>
    , the email address isn't hashed in the source code and is clearly visible.

    Is there a way ? Thanks.
    Last edited by charled; 01/23/2017 at 22:43.

  2. #2
    User Spooky's Avatar
    Join Date
    01-03-13.
    Posts
    336

    Default

    You can use
    PHP Code:
    <a href="{{email_url::<?= $item['text']['my_email_attribute']; ?>}}">mail</a>
    or
    PHP Code:
    {{email_open::<?= $item['text']['my_email_attribute'?>}}</a>
    or
    PHP Code:
    {{email::<?= $item['text']['my_email_attribute'?>}}
    Last edited by Spooky; 01/23/2017 at 20:28.

  3. #3
    User
    Join Date
    04-01-10.
    Posts
    218

    Default

    Contao rocks !! Thanks.

  4. #4
    User
    Join Date
    04-01-10.
    Posts
    218

    Default

    And is there the same for other url (http://…) ?

  5. #5
    User zonky's Avatar
    Join Date
    11-29-11.
    Location
    Berlin
    Posts
    142

    Default

    or you can use encodeEmail directly like https://github.com/contao/core/blob/...tTags.php#L142

  6. #6
    User Spooky's Avatar
    Join Date
    01-03-13.
    Posts
    336

    Default

    Quote Originally Posted by zonky View Post
    or you can use encodeEmail directly like https://github.com/contao/core/blob/...tTags.php#L142
    That does not encode the mailto: part though.

  7. #7
    User zonky's Avatar
    Join Date
    11-29-11.
    Location
    Berlin
    Posts
    142

    Default

    o.k. ...

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •