ostap

ostap

Can I skip or automate the "confirmation step" for magic links?

After opening a magic link, the user must click a confirmation button to log in and invalidate the token. I assume this exists to prevent email scanners from consuming links.

Could this be automated with a short JS setTimeout that submits the confirmation request automatically? Or is this a bad idea? I assume that scanners only fetch the HTML and don’t always have a headless browser or keep it open for long.

Current behaviour after the registration link is opened:

Current behaviour after the login link is opened:

mix phx.new example --module=Example --database=sqlite3 --no-live
cd example
mix ecto.create
mix phx.server
mix phx.gen.auth Accounts User users # n - Using Phoenix.Controller only
mix deps.get
mix ecto.migrate
mix phx.server

Most Liked

garrison

garrison

I would say this is a dangerous assumption. If the scanners don’t use a headless browser that would make it trivial for bad actors to bypass the scanners with a simple React app. Given that the scanners and the bad actors are locked in an endless back-and-forth my guess would be that the scanners have been running JS for a while.

There is a mutual understanding between the scanner developers and web developers that scanners will not issue POST requests. Everyone is on the same page about this, so it is unlikely to change.

On the other hand, if you design a login page using some timeout, even if you test to ensure that it works today the scanner could always change its behavior tomorrow and break your website while you’re asleep.

I think it would be wise to stick with the standard method.

Last Post!

ostap

ostap

Thank you! Decided to try a slightly riskier/novel approach:

My BotD library fork detects whether the visitor is not a bot (headless chromium), and only then will the form be submitted automatically.

I think it’ll be worth it as a UX improvement. But we’ll see if anyone complains :grinning_face_with_smiling_eyes:; it’s a small side project where I’m testing this out.

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
lastday4you
I wanted to check elixir version in phoenix because i found that my elixir is 1.5 but when i use Enum.chunk_by it said the function is un...
New
Darmani72
If I have a post route which an argument: post /my_post_route/:my_param1, MyController.my_post_handler How would get the post params ...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New

Other popular topics Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 records...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New

We're in Beta

About us Mission Statement