Class SignUpAssistantComponent

  • All Implemented Interfaces:
    IClientRequestHandler

    public class SignUpAssistantComponent
    extends BaseClientRequestHandler

    Overview

    The SignUpAssistant Component is a helper class that assist developers in creating a full-fledged database-driven sign up process without the hassle of writing all the server and database code.

    The component offers many features out of the box.

    • Automatically interface with the current Zone and relative database
    • Highly customizable: allows to store any number of custom user profile fields
    • Pre-process and post-process plugins for custom validation and sign up logic
    • HTML-Templates based confirmation emails
    • Unique activation codes for extra sign up security
    • Password Recovery service included
    • Easily works with the LoginAssistant Component to create a sign up and login system in minutes.
    • Fine grained configuration
    • Extremely simple to deploy and configure

    In a nutshell

    In a nutshell this is how it works:
    1. Configure the DBManager in your application's Zone
    2. Instantiate the component in the init() method of your Extension
    3. Configure the component
    The SignUp Assistant sets up three main commands that can be invoked by the client
    • $SignUp.Submit: sends the user's data to register a new account
    • $SignUp.Activate: sends the user's activation code to enable his account (optional)
    • $SignUp.Recover: sends the user name to recover his lost password (optional)
    • $SignUp.ResendEmail: resends the confirmation email with the activation code (takes no parameters)
    The parameters expected in each SFSObject will use the same name as the database field names configured in the component.
    If the user name field was set as username, the client SFSObject will contain a field with the same key and the value for that field, and so on and so forth.

    The only two mandatory fields are the user's name and password, the others (email, activation) can be configured and any number of custom fields can also be added and validated via custom plugin.

    Example of usage

    Once the Zone's Database Manager has been configured a simple SFSExtension can be created with this code to setup a sign up process
     public class SignUpTestExtension extends SFSExtension
     {
            private SignUpAssistantComponent suac;
     
            public void init()
            {
                    suac = new SignUpAssistantComponent();
                    
                    suac.getConfig().signUpTable = "signup_test";
                    suac.getConfig().extraFields = Arrays.asList("country", "age", "zone");
                    
                    suac.getConfig().emailResponse.isActive = true;
                    suac.getConfig().emailResponse.fromAddress = "info@mywebsite.com";
                    suac.getConfig().emailResponse.subject = "Thanks for signing up";
                    suac.getConfig().emailResponse.template = "SignUpEmailTemplates/SignUpConfirmation.html";
                    
                    addRequestHandler(SignUpAssistantComponent.COMMAND_PREFIX, suac);
            }
            
            public void destroy()
            {
                super.destroy();
            }
     }
    
     
    NOTE: You can learn more about these components by reading the tutorials here.
    Since:
    2.7.0
    See Also:
    SignUpConfiguration
    • Constructor Detail

      • SignUpAssistantComponent

        public SignUpAssistantComponent()
    • Method Detail

      • handleClientRequest

        public void handleClientRequest​(User sender,
                                        ISFSObject params)
        Description copied from interface: IClientRequestHandler
        Handle a client request
        Parameters:
        sender - the sender of the request
        params - the parameters of the request
        See Also:
        SFSObject