Implementing custom approval/deny functionality for registered users
Hello, i am new Sitefinity developer, and i am trying to evaluate if
this product is right for my client so i am trying to duplicate their
current functionality into Sitefinity. What my client want is to allow
site visitors to register on their site, and be able to approve/deny
them access to certain areas of the site.
Now, i did most of this by creating a custom role called "Users",
placing registration form assigned to "Users" role, i got my logins. I
created restricted access pages that are only visible to the users from
my role. Everything works great but:
1. How do i accomplish the approval process from the client side? Custom control? Would that be on the back end or i have to implement this on front end?
2. How do i stop them from logging in until they get approved by a client?
Thanks
Hello,
I answered in your support ticket, but I will copy my answer here, as well:
We already have the "stop from login until confirmation" logic implemented. However, confirmation email is by default sent to the registering user, so you need to change it to be always sent to the admin email, so that the admin can approve the registering user. Here's what you need to do:
1) Inherit from RegistrationForm and change the user's email to be the desired one:
public
class
CustomRegistration : RegistrationForm
protected
override
void
SendRegistrationConfirmationEmail(Telerik.Sitefinity.Security.Model.User user, Telerik.Sitefinity.Security.UserManager userManager)
user.Email =
"admin@admin.admin"
;
base
.SendRegistrationConfirmationEmail(user, userManager);
Hi Svetoslav,
Do i need to generate the custom registration widget for that in order to override the method??
Hello,
You can just change the type of the out-of-the-box widget, to use your custom class, but it is recommendable that you register it as a new control.
Also, is it possible for you to keep the correspondence either in the support ticket or in the forum thread, as it would be easier for us to process the answers, when they are in one place. Thanks in advance.