Allow admin to deny or grant user account

Andrew33

Member
Joined
Oct 3, 2023
Messages
5
Programming Experience
5-10
Hi,
I have an MVC 5 project where a user can create their account:
pic_users00.PNG

pic_RegisterNewAcc.PNG

I'd like not to allow users to self register. Instead I'd like users to request access and an admin can accept or deny that account.
Does anyone have a working example ?
Thanks.
 
Start by thinking about the logic involved. Understand the logic and then think about the steps required to implement that logic. Finally, try to write code to implement those steps explicitly. Don't even think about code until you know what the code has to do. At a macro level, the steps would be:
  1. User enters data.
  2. Data gets saved to database.
  3. Admin views data.
  4. Admin edits data.
  5. Data gets saved to database.
You might just use one table with a single column to indicate whether the user record has been approved or you might have one table for the registration data and then another table for the user data once the registration is approved. Put a bit of thought into the problem and see what you can come up with, then ask specific questions about actual issues you encounter rather than looking for a turnkey solution to copy.
 
I think what the OP is failing to state is that they took the default MVC 5 template to create their project. Now they want to modify the project so that the account creation is moderated by an admin. I think basically they need some prompting on learning how the MVC membership works and how to modify how it works to accomplish what they need.
 
I think what the OP is failing to state is that they took the default MVC 5 template to create their project. Now they want to modify the project so that the account creation is moderated by an admin. I think basically they need some prompting on learning how the MVC membership works and how to modify how it works to accomplish what they need.

Yes, that's exactly what I'm after. Can you point me into the right direction ? do you know of a working example that would help me achieve my aim ? Thank you.
 
My gut feel is that of you look at the ASP.NET documentation, and look at the example of requiring a minimum age for certain pages; or the examples for role based authorization, this will lead to to a usable way to solve your problem. Instead of your custom authorization policy looking for a particular age or role, you could look for a admin approved flag, or add a registered user role.

Take the above with a huge grain of salt. I was just skimming the documentation with a splitting headache and people distracting me about their server being down. (Jeez so what if your server is down I've been warning you the past month that it was going to crash with the way you have abusing the system. You kept blowing me off. Why is it an emergency now?)
 
Hi,
Does anyone have an example of MVC 5 code where a user registers but an admin needs to approve their registration before they can login.
Only admins can approve new accounts.
Admins have access.
Admins can approve new user accounts.
Users have limited access.
Thanks
 
You already have a thread about this open. I've moved your new post into your old thread.
 
Back
Top Bottom