Last change
on this file since 775e15e was dfd5d87, checked in by Marko <Marko@…>, 23 months ago |
Registration logic with confirmation token implemented
|
-
Property mode
set to
100644
|
File size:
881 bytes
|
Rev | Line | |
---|
[dfd5d87] | 1 | package finki.it.phoneluxbackend.services;
|
---|
| 2 |
|
---|
| 3 | import finki.it.phoneluxbackend.repositories.ConfirmationTokenRepository;
|
---|
| 4 | import finki.it.phoneluxbackend.entities.ConfirmationToken;
|
---|
| 5 | import lombok.AllArgsConstructor;
|
---|
| 6 | import org.springframework.stereotype.Service;
|
---|
| 7 |
|
---|
| 8 | import java.time.LocalDateTime;
|
---|
| 9 | import java.util.Optional;
|
---|
| 10 |
|
---|
| 11 | @Service
|
---|
| 12 | @AllArgsConstructor
|
---|
| 13 | public class ConfirmationTokenService {
|
---|
| 14 | private final ConfirmationTokenRepository confirmationTokenRepository;
|
---|
| 15 |
|
---|
| 16 | public void saveConfirmationToken(ConfirmationToken token) {
|
---|
| 17 | confirmationTokenRepository.save(token);
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | public Optional<ConfirmationToken> getToken(String token) {
|
---|
| 21 | return confirmationTokenRepository.findByToken(token);
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | public int setConfirmedAt(String token) {
|
---|
| 25 | return confirmationTokenRepository.updateConfirmedAt(
|
---|
| 26 | token, LocalDateTime.now());
|
---|
| 27 | }
|
---|
| 28 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.