There is already a direct URL to reset a user’s password: /password-reset
Is there a similar URL to take a user directly to the “email me a login link” feature?
There is already a direct URL to reset a user’s password: /password-reset
Is there a similar URL to take a user directly to the “email me a login link” feature?
I guess this topic may answer your queries, please have a look: Email me a login link post
That topic is about integrating Discourse with another website/app. I’m asking about linking to a login feature available by default in Discourse. There’s no SSO involved.
I think that the /login route is what you want. You have to enter a username or email address, so there is no shorter way to do it that I can think of.
Jay’s reply is not a “solution” for me, but it does, unfortunately, seem to be the correct answer to my question, so I’ve marked it appropriately.
What would solve the problem? Being able to include the email or username in the url?
Not quite. I’d like to be able to say something like this (this is part of a transition from an SSO integration back to vanilla Discourse):
I’d like to be able to link to two different places where the only thing that the user can do is to complete the option they have chosen. This is available for resetting your password, but not for requesting a login link. If I could prefill the user’s email – even better!
Fiddling with the regular approval messages, I realized that there is a direct URL for the email me a login link:
/login-helper/send-login-mail?login=USER_EMAIL&destination_url=%2F
It seems to work fine, but you do need to prefill the email address and a destination.
Just for reference, you can pre-fill the password reset UI as well:
/password-reset?email=USER_EMAIL
I’ll mark this as the solution for future visitors!
Edit: I removed this as an answer, due to the issues highlighted in further posts.
Can’t have it working
https://meta.discourse.org/login-helper/send-login-mail?login=myemail%40gmail.com&destination_url=%2F
returns a 404 and no email is received.
What do I miss?
I don’t have any idea why it works on my system, but not here on Meta.
Another issue I realized is that access to this helper is severely limited and will ask you to wait for just 1-2 tries. Our members are faculty and staff at academic institutions, and they will likely be connecting from the same IP. So unless that limit can be changed, this seems like a non-option
That’s a problem regardless of using the link. There is an environment variable you can set to allow more accounts to be created from the same ip.
I think that’s something different. I wasn’t prevented from creating an account. I was prevented from requesting more than 2 or 3 login links in a small period of time. I can see why Discourse would think that’s a problem, but it would be nice to be able to circumvent it.
Hmm. Not sure about rate limits per IP for login links, but if you’ve got a bunch of people all behind the same NAT address, then you should see Available settings for global rate limits and throttling.
I looked at the suggested link Jay, but I’m not quite sure which setting would impact the behavior I experienced above.
In other news, I discovered I can just do: https://my-discourse-site.com/?login=USER_EMAIL to trigger a login link.
This works for me because the entire site is set to private. So it doesn’t trigger on Meta, for example, where a login is not required to just view the site.
Maybe you haven’t described this issue yet, but when I’ve had a client that went to a conference where everyone was on the same WIFI with the same NAT IP address, I adjusted settings like this one to keep them all from getting rate limited:
That’s awsome! I can’t make it work, even on a login-required site that I tried, but I’ll trust that you did.
Hmmm, I wonder why that might be. I can’t think of any other setting that would impact that. Maybe that I have enabled DiscourseConnect (but not using the SSO features of it)?
Does your ip problem keep people from creating accounts or logging in to existing accounts? If it’s the former then max new accounts per registration
might be what you’re looking for. If not, what’s the exact error message? Then someone can search the source for that error to see what triggers it