User Login
One of the most important functions of a community site is that it should identify the requesting user. VCE comes with built-in functionality that allows a developer to implement user login in a very short time.
The Struts configuration for the login action may look as follows:
<form-bean name="signinForm" type="com.ndc.usercontent.struts.actions.forms.SigninForm" /> <action path="/auth/login" name="signinForm" scope="request" validate="true" input="/index.jsp" type="com.escenic.profile.presentation.struts.LoginAction"> <forward name="success" path="/auth/community/login.do"/> <forward name="error" path="/"/> </action> <action path="/auth/community/login" scope="request" name="signinForm" validate="true" input="/index.jsp" parameter="userProfile" type="com.ndc.usercontent.struts.actions.login.Login"> <forward name="error" path="/" /> </action>
Since VCE works as a plug-in on top of ECE, we need to delegate control from the first login action to the second one.
The first action, /Login
, makes the user log into ECE and the second action
/auth/community/login
makes the user log into VCE.
To add SSO support to your login component, please have a look at: SSO Support
The JSP template that renders the form to the user may look as follows:
<html:form action="/auth/login"> <div> <label for="userName">User name:</label> <html:text tabindex="1" property="userName" size="10"/> <label for="userPassword">Password:</label> <html:password tabindex="2" property="password" size="10"/> <br/> <html:checkbox property="savePassword">Remember me</html:checkbox> <br/> <html:submit value="Login" tabindex="3" /> <html:hidden property="targetUrl" value="/profile/"/> <html:hidden property="errorUrl" value="/profile/"/> <div> </html:form>
Form Property | Description |
---|---|
|
The user name of the requesting user |
|
The password that identifies the requesting user |
|
Indicates if the login action should remember the user or not. If selected, the user will remain authenticated for a certain period of time. |
|
The URL (absolute or relative to the publication) where the requesting user should be directed to
after a successful login. If not specified, the action tries to find the configured forward named
|
|
The URL (absolute or relative to the publication) where the requesting user should be directed to if the login attempt fails. On failure, the login action binds the relevant error messages to the request scope so that the template developer can display information relevant to the failed login attempt.
|