Class SignUpAssistantComponent
java.lang.Object
com.smartfoxserver.extensions.BaseClientRequestHandler
com.smartfoxserver.components.signup.SignUpAssistantComponent
- All Implemented Interfaces:
IClientRequestHandler
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 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.- See Also:
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidhandleClientRequest(User sender, ISFSObject params, TransportType txType) Handle a client requestMethods inherited from class com.smartfoxserver.extensions.BaseClientRequestHandler
getApi, getBuddyApi, getGameApi, getLogger, getMMOApi, getParentExtension, send, send, send, send, setParentExtension, trace, trace
-
Field Details
-
COMMAND_PREFIX
- See Also:
-
-
Constructor Details
-
SignUpAssistantComponent
public SignUpAssistantComponent()
-
-
Method Details
-
getConfig
-
handleClientRequest
Description copied from interface:IClientRequestHandlerHandle a client request- Parameters:
sender- the sender of the requestparams- the parameters of the requesttxType- the network transport used for the request (TCP, UDP etc...)- See Also:
-
getDbManager
-