|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.jalios.jcms.context.JcmsContext com.jalios.jcms.context.JcmsJspContext com.jalios.jcms.handler.JcmsFormHandler com.jalios.jcms.handler.ResetPasswordHandler
public class ResetPasswordHandler
Handle lost password request from end user.
Also provides API to obtain valid password reset link for user : getPasswordResetUrl(HttpServletRequest, Member)
Field Summary | |
---|---|
static String |
EXPIRATION_DURATION_PROP
Property key that defines the password reset link validity duration. |
Fields inherited from class com.jalios.jcms.handler.JcmsFormHandler |
---|
contextMap, editFieldSet, noRedirect, noSendRedirect, popupEdition, redirect, redirectOnClosePopup, REVISION, workspaceForced |
Fields inherited from class com.jalios.jcms.context.JcmsJspContext |
---|
AJAX_REQUEST_ATTRIBUTES, BODY_HEADER, CSS_HEADER, cssboMap, cssfoMap, CUSTOM_HEADER, editIcon, HTTPEQUIV_HEADER, httpequivMap, HTTPNAME_HEADER, httpnameMap, initEditIcon, JAVASCRIPT_CODE_SET_ATTRIBUTE, JAVASCRIPT_SET_ATTRIBUTE, jsboSet, jsfoSet, out, pageContext, SHOW_EDIT_ICON, STYLE_HEADER |
Fields inherited from class com.jalios.jcms.context.JcmsContext |
---|
browser, caddy, channel, inFO, initDone, initWorkspace, isAdmin, isAjaxRequest, isDBMember, isDebug, isLogged, loggedMember, request, response, userCountry, userLang, userLocale, workspace |
Fields inherited from interface com.jalios.util.JaliosConstants |
---|
CRLF, MILLIS_IN_ONE_DAY, MILLIS_IN_ONE_HOUR, MILLIS_IN_ONE_MINUTE, MILLIS_IN_ONE_MONTH, MILLIS_IN_ONE_SECOND, MILLIS_IN_ONE_WEEK, MILLIS_IN_ONE_YEAR |
Constructor Summary | |
---|---|
ResetPasswordHandler()
|
Method Summary | |
---|---|
static String |
generatePasswordResetToken(Member member,
long tokenDuration)
Compute and generate a password reset token suitable for a password reset modification |
String |
getEmail()
The email as entered by the user. |
static long |
getExpirationDuration()
|
Member |
getMember()
Retrieve the member for which a password reset is performed. |
static Member |
getMemberFromPasswordResetToken(String token)
Validate a password reset token and retrieve the corresponding member. |
String |
getPasswordResetToken()
Retrieve the internal security token used to validate the password reset. |
static String |
getPasswordResetUrl(javax.servlet.http.HttpServletRequest request,
Member mbr)
Retrieve an absolute URL suitable for the specified member to change his password. |
static String |
getPasswordResetUrl(javax.servlet.http.HttpServletRequest request,
Member mbr,
long tokenDuration)
Retrieve an absolute URL suitable for the specified member to change his password. |
boolean |
isResetFormDisplayed()
Check if the "reset password" form should be displayed. |
boolean |
isResetRequestFormDisplayed()
Check if the "request reset password" form should be displayed. |
boolean |
performRequestReset()
Perform the password reset request for the specified email |
boolean |
performReset()
Perform the password reset request for the specified email |
boolean |
processAction()
Method to be implemented to check/validate action to be performed and process them. |
void |
setEmail(String email)
The the email for which a password reset request will be sent |
void |
setOpRequestReset(String value)
Set this parameter to trigger a password request reset. |
void |
setOpReset(String value)
Set this parameter to trigger a password reset. |
void |
setPassword1(String password)
Set the new password to use |
void |
setPassword2(String password)
Set the new password confirmation |
void |
setPasswordResetToken(String token)
Set the internal security token validating the password reset. |
boolean |
validateRequestReset()
Check all information required for a password reset request have been provided |
boolean |
validateReset()
Check all information required for a password reset have been provided |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String EXPIRATION_DURATION_PROP
Constructor Detail |
---|
public ResetPasswordHandler()
Method Detail |
---|
public boolean processAction() throws IOException
JcmsFormHandler
Default implementation is to return false. No need to call super method.
This method may NOT be invoked at all if security validation are not met.
You must ensure your handler and JSP can work properly without any code invoked
in this method.
processAction
in class JcmsFormHandler
IOException
public boolean validateRequestReset()
public boolean performRequestReset() throws IOException
IOException
- on redirect errorpublic static String getPasswordResetUrl(javax.servlet.http.HttpServletRequest request, Member mbr)
The returned URL will be valid during the default duration defined by property "channel.reset-password-link.duration".
The specified member MUST be a member authorized to update his password, that is :
request
- optionnal current request to retrieve base url (site's base url is used if null)mbr
- required member
IllegalArgumentException
- if member does not match any of the expected constraintspublic static String getPasswordResetUrl(javax.servlet.http.HttpServletRequest request, Member mbr, long tokenDuration)
The specified member MUST be a member authorized to update his password, that is :
request
- optionnal current request to retrieve base url (site's base url is used if null)mbr
- required membertokenDuration
- a duration in millisecond during which the URL is valid, after this duration the token won't be accepted.
Specify 0 or a negative value to use the default duration.IllegalArgumentException
- if member does not match any of the expected constraintspublic boolean validateReset()
public boolean performReset() throws IOException
IOException
- on redirect errorpublic static String generatePasswordResetToken(Member member, long tokenDuration)
member
- the member for which token is generated, must not be nulltokenDuration
- a duration in millisecond during which the token is valid, after this duration the token won't be accepted.
Specify 0 or a negative value to use the default duration.IllegalArgumentException
- if member is disabled, or does not have any password, or is not persistedpublic static Member getMemberFromPasswordResetToken(String token)
token
- the password reset token value as computed by generatePasswordResetToken(Member, long)
public void setOpRequestReset(String value)
Fields which must be specified : email.
value
- any valuepublic void setOpReset(String value)
Fields which must be specified : mbrId, password1, password2, passwordResetToken.
value
- any valuepublic boolean isResetRequestFormDisplayed()
public boolean isResetFormDisplayed()
public void setEmail(String email)
email
- a valid emailpublic String getEmail()
public Member getMember()
public void setPassword1(String password)
password
- the clear text password to use for the memberpublic void setPassword2(String password)
password
- the clear text password, which must match password1public void setPasswordResetToken(String token)
This parameter has several purpose : - storing the token in handler for access in form - reading member for which operation is performed - trigger the "reset" form and hide the "request reset" form.
token
- a security token internally build by this handler and specified in the validation emailpublic String getPasswordResetToken()
public static long getExpirationDuration()
It is defined by property EXPIRATION_DURATION_PROP
="channel.reset-password-link.duration".
If this property does not represent a valid long number, 24 Hours will be used as fallback.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |