NCBACK-23 add full logic to reset
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-01-22 03:39:49 +07:00
parent d1b5b6eb5c
commit a982eef9c6
16 changed files with 535 additions and 13 deletions
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
import jakarta.persistence.*;
import jakarta.validation.constraints.Size;
import lombok.*;
import org.hibernate.annotations.ColumnDefault;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import ru.soune.nocopy.entity.file.ImageProtection;
@@ -76,6 +77,11 @@ public class User {
@ToString.Exclude
private List<AuthToken> tokens = new ArrayList<>();
@OneToOne(mappedBy = "user", cascade = CascadeType.ALL, orphanRemoval = true)
@JsonIgnore
@ToString.Exclude
private UserNotActive userNotActive;
@OneToMany(mappedBy = "user", cascade = CascadeType.ALL, orphanRemoval = true)
@JsonIgnore
@ToString.Exclude
@@ -90,4 +96,8 @@ public class User {
@JsonIgnore
@ToString.Exclude
private List<ImageProtection> imageProtections = new ArrayList<>();
@Column(name = "failed_login_attempts")
@ColumnDefault("0")
private Integer failedLoginAttempts = 0;
}
@@ -0,0 +1,32 @@
package ru.soune.nocopy.entity.user;
import jakarta.persistence.*;
import lombok.*;
import org.springframework.data.annotation.CreatedDate;
import java.time.LocalDateTime;
@Entity
@Table(name = "user_not_active")
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
@ToString
@Builder
public class UserNotActive {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private Long id;
@OneToOne(fetch = FetchType.LAZY)
private User user;
@CreatedDate
@Column(name = "created_at", updatable = false)
private LocalDateTime createdAt;
@Column(name = "blocked_until")
private LocalDateTime blockedUntil;
}