+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Implementing custom approval/deny functionality for registered users

Implementing custom approval/deny functionality for registered users

4 posts, 0 answered
  1. W
    W avatar
    1 posts
    Registered:
    20 Jan 2012
    26 Jan 2012
    Link to this post
    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
  2. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    31 Jan 2012
    Link to this post
    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
  3. Rajesh
    Rajesh avatar
    13 posts
    Registered:
    11 Jan 2012
    31 Jan 2012
    Link to this post
    Hi Svetoslav,

    Do i need to generate the custom registration widget for that in order  to override the method??
  4. Svetoslav Petsov
    Svetoslav Petsov avatar
    456 posts
    Registered:
    24 Sep 2012
    01 Feb 2012
    Link to this post
    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
4 posts, 0 answered