- /email recovery generates recovery code and resets password only if recovery code is also given - Change data source method to return email and recovery code
39 lines
897 B
Java
39 lines
897 B
Java
package fr.xephi.authme.cache.auth;
|
|
|
|
/**
|
|
* Stored data for email recovery.
|
|
*/
|
|
public class EmailRecoveryData {
|
|
|
|
private final String email;
|
|
private final String recoveryCode;
|
|
|
|
/**
|
|
* Constructor.
|
|
*
|
|
* @param email the email address
|
|
* @param recoveryCode the recovery code, or null if not available
|
|
* @param codeExpiration
|
|
*/
|
|
public EmailRecoveryData(String email, String recoveryCode, Long codeExpiration) {
|
|
this.email = email;
|
|
this.recoveryCode = codeExpiration == null || System.currentTimeMillis() > codeExpiration
|
|
? null
|
|
: recoveryCode;
|
|
}
|
|
|
|
/**
|
|
* @return the email address
|
|
*/
|
|
public String getEmail() {
|
|
return email;
|
|
}
|
|
|
|
/**
|
|
* @return the recovery code, if available and not expired
|
|
*/
|
|
public String getRecoveryCode() {
|
|
return recoveryCode;
|
|
}
|
|
}
|