LoginSystem/src/main/java/fr/xephi/authme/cache/auth/EmailRecoveryData.java
ljacqu c5f5c0d2fd #472 Require recovery code before resetting password
- /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
2016-09-10 14:27:26 +02:00

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;
}
}