passport-magic-login icon indicating copy to clipboard operation
passport-magic-login copied to clipboard

What's the best strategy to have sendMagicLink fail?

Open dbismut opened this issue 4 years ago • 1 comments

I'd like to use sendMagicLink only to pre-registered users. At the moment, I'm throwing an error if the submitted email isn't in the database.

This prints something on my server console because of this line: https://github.com/mxstbr/passport-magic-login/blob/dca2bcc2638d74290e218de3a4fd8d92c1aa48e2/src/index.ts#L78

Is that expected? I understand that sendMagicLink might fail for unexpected reasons, but I would have hoped that somehow there was a more elegant way so that no "intended" error is printed in the console.

dbismut avatar Nov 12 '21 12:11 dbismut

Maybe sendMagicLink could return void when successful and a custom object when failing?

dbismut avatar Nov 12 '21 13:11 dbismut