-
Hi, I'm writing APIs for a headless CMS project using Orchard Core 1.8.3. I have used the Now, I'm adding a new feature: when a new user registers on the website, an email is sent to the Admin with two URIs: one to approve (enable) the user, and the other to refuse (leave the user disabled, or delete it. We still decide what to do).
Any suggestions or best practices for implementing this? Thank you so much |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 7 replies
-
That being said, if it's already admins who approve/refuse users, then I don't really see the point of adding a token to the URL (unless you want only the recipients of the e-mail to be able to manage these users, not any admin with the necessary permissions, what I'd instead recommend). Instead, I'd only include GET links in the e-mail, pointing to an admin UI where they have the two operations as two buttons (or just link to the given user's built-in edit screen on the OC admin). Otherwise, you're binding a state-changing operation to a GET request, what should otherwise be a POST or something else. |
Beta Was this translation helpful? Give feedback.
-
a possible alternative might be to use |
Beta Was this translation helpful? Give feedback.
@Piedone @MikeAlhayek @weirdyang sorry for the late reply, I totally forgot to update this discussion 😅
@MikeAlhayek, unfortunately, I can't use the 2.0.0-previews because I'm going into production soon. I'm not comfortable using an unstable release for production.
In the end, I created my own token handler and passed it in Dependency Injection as a singleton. Of course, if the server reboots, I will lose the token list, but this is not a problem for my requirements since the tokens are not meant to be permanent.
I used the
Purpose
value to be able to generate multiple tokens for the sameUserId
. This could be useful if you need it in multiple parts of your code.Here is the interface I made