Class SignUpAssistantComponent
- java.lang.Object
-
- com.smartfoxserver.v2.extensions.BaseClientRequestHandler
-
- com.smartfoxserver.v2.components.signup.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:- Configure the DBManager in your application's Zone
- Instantiate the component in the init() method of your Extension
- Configure the component
- $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)
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 processpublic 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
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
COMMAND_PREFIX
-
Constructor Summary
Constructors Constructor Description SignUpAssistantComponent()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SignUpConfiguration
getConfig()
IDBManager
getDbManager()
void
handleClientRequest(User sender, ISFSObject params)
Handle a client request-
Methods inherited from class com.smartfoxserver.v2.extensions.BaseClientRequestHandler
getApi, getLogger, getParentExtension, send, send, send, send, setParentExtension, trace, trace
-
-
-
-
Field Detail
-
COMMAND_PREFIX
public static final java.lang.String COMMAND_PREFIX
- See Also:
- Constant Field Values
-
-
Method Detail
-
getConfig
public SignUpConfiguration getConfig()
-
handleClientRequest
public void handleClientRequest(User sender, ISFSObject params)
Description copied from interface:IClientRequestHandler
Handle a client request- Parameters:
sender
- the sender of the requestparams
- the parameters of the request- See Also:
SFSObject
-
getDbManager
public IDBManager getDbManager()
-
-