Implementing custom approval/deny functionality for register

Posted by Community Admin on 04-Aug-2018 20:22

Implementing custom approval/deny functionality for registered users

All Replies

Posted by Community Admin on 26-Jan-2012 00:00

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

Posted by Community Admin on 31-Jan-2012 00:00

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 voidSendRegistrationConfirmationEmail(Telerik.Sitefinity.Security.Model.User user, Telerik.Sitefinity.Security.UserManager userManager)
        
            user.Email = "admin@admin.admin";
            base.SendRegistrationConfirmationEmail(user, userManager);
        
    

2) Now build your project and go to Administration >> Settings >> Advanced >> Toolboxes >> Sections, create a new section (Custom) and register your custom Registration widget by entering Namespace.Class in the type field and then whatever title and name for the widget that you desire. 
3) Now place your newly registered widget on a page (no the default registration, but the custom one that you made) and click Edit. Then go to Account Activation and choose the "After confirmation" radio button. Choose a confirmation page and click Save.

Now when your users register, an email would be sent to the email that you specified and only until after the link in this email has been clicked, they will be able to log in. Also, don't forget that you will need SMTP settings in order to send e-mails. 

All the best,
Svetoslav Petsov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 31-Jan-2012 00:00

Hi Svetoslav,

Do i need to generate the custom registration widget for that in order  to override the method??

Posted by Community Admin on 01-Feb-2012 00:00

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.

All the best,
Svetoslav Petsov
the Telerik team
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

This thread is closed