Class EmailVerificationServiceImpl
java.lang.Object
com.espacogeek.geek.services.impl.EmailVerificationServiceImpl
- All Implemented Interfaces:
EmailVerificationService
@Service
public class EmailVerificationServiceImpl
extends Object
implements EmailVerificationService
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateToken(UserModel user, String tokenType, String newEmail, int expirationHours) Create a new verification token for a uservoidDelete expired tokens (cleanup task)voiddeleteUserTokensByType(UserModel user, String tokenType) Delete all tokens for a user of a specific typevoidMark a token as usedvalidateToken(String token, String tokenType) Validate and retrieve a token
-
Constructor Details
-
EmailVerificationServiceImpl
public EmailVerificationServiceImpl()
-
-
Method Details
-
createToken
@Transactional public EmailVerificationTokenModel createToken(UserModel user, String tokenType, String newEmail, int expirationHours) Description copied from interface:EmailVerificationServiceCreate a new verification token for a user- Specified by:
createTokenin interfaceEmailVerificationService- Parameters:
user- The usertokenType- The type of token (e.g., "ACCOUNT_VERIFICATION", "PASSWORD_RESET", "EMAIL_CHANGE")newEmail- The new email (for email change requests), null otherwiseexpirationHours- Token expiration time in hours- Returns:
- The created token model
-
validateToken
Description copied from interface:EmailVerificationServiceValidate and retrieve a token- Specified by:
validateTokenin interfaceEmailVerificationService- Parameters:
token- The token stringtokenType- The expected token type- Returns:
- Optional containing the token if valid
-
markTokenAsUsed
Description copied from interface:EmailVerificationServiceMark a token as used- Specified by:
markTokenAsUsedin interfaceEmailVerificationService- Parameters:
token- The token to mark as used
-
deleteExpiredTokens
@Transactional public void deleteExpiredTokens()Description copied from interface:EmailVerificationServiceDelete expired tokens (cleanup task)- Specified by:
deleteExpiredTokensin interfaceEmailVerificationService
-
deleteUserTokensByType
Description copied from interface:EmailVerificationServiceDelete all tokens for a user of a specific type- Specified by:
deleteUserTokensByTypein interfaceEmailVerificationService- Parameters:
user- The usertokenType- The token type
-