Search code examples
laravelnewsletter

How to properly secure laravel newsletter subscription?


I have a newsletter powered by an laravel application. It lets subscribers select an area and set some filters to receive mail notifications on new housing for sale.

To solve this in an easy way for the user I did not want to use passwords and a long registration process with names etc. Instead, you just get an email, in that email there is an edit link with a secret token:

https://myapp.com/subscribers/42/edit?token=gwoi6n4ginagrpoargp4ar5gp14a

Would this be considered a safe approach? When a user clicks the link, it is over HTTPS so it is encrypted, but it will still show in the current browsers history..

Will I get flamed for doing this and if so what are some ways to improve it?


Solution

  • with encrypted data in ssl communications yes it's safe. but in my opinion there is some offers:

    1-remove token word from the address.

    2- this link should not show the user edit page directly. instead sends arguments to a controller and controller redirects user to a new page with a clean link. just save token in the page for authorizing your user.

    3- why not to produce longer (just a bit longer!) tokens?

    4- for being safer each link should have an expire time. new link will be sent with each newsletter mail.