-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implemented forgot-password endpoint
- Loading branch information
Showing
4 changed files
with
119 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
app/backend/src/main/java/com/app/gamereview/model/ResetCode.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
package com.app.gamereview.model; | ||
|
||
import org.springframework.data.annotation.Id; | ||
import org.springframework.data.mongodb.core.index.Indexed; | ||
import org.springframework.data.mongodb.core.mapping.Document; | ||
import java.util.Date; | ||
|
||
@Document(collection = "resetCodes") | ||
public class ResetCode { | ||
|
||
@Id | ||
private String id; | ||
|
||
public String getId() { | ||
return id; | ||
} | ||
|
||
public void setId(String id) { | ||
this.id = id; | ||
} | ||
|
||
public String getCode() { | ||
return code; | ||
} | ||
|
||
public void setCode(String code) { | ||
this.code = code; | ||
} | ||
|
||
public String getUserId() { | ||
return userId; | ||
} | ||
|
||
public void setUser(String userId) { | ||
this.userId = userId; | ||
} | ||
|
||
public Date getExpirationDate() { | ||
return expirationDate; | ||
} | ||
|
||
public void setExpirationDate(Date expirationDate) { | ||
this.expirationDate = expirationDate; | ||
} | ||
|
||
private String code; | ||
@Indexed(unique = true) // Ensures a unique constraint on userId field | ||
private String userId; // ID of the associated user | ||
private Date expirationDate; | ||
|
||
public ResetCode(String code, String userId, Date expirationDate) { | ||
|
||
this.code = code; | ||
this.userId = userId; | ||
this.expirationDate = expirationDate; | ||
} | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
app/backend/src/main/java/com/app/gamereview/repository/ResetCodeRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package com.app.gamereview.repository; | ||
|
||
import com.app.gamereview.model.ResetCode; | ||
import org.springframework.data.mongodb.repository.MongoRepository; | ||
|
||
public interface ResetCodeRepository extends MongoRepository<ResetCode, String> { | ||
ResetCode findByUserId(String userId); | ||
ResetCode findByCode(String code); | ||
void deleteByUserId(String userId); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,8 @@ | ||
spring.data.mongodb.database=${MONGO_DATABASE} | ||
spring.data.mongodb.uri=mongodb+srv://${MONGO_USER}:${MONGO_PASSWORD}@${MONGO_CLUSTER} | ||
spring.mail.host=${MAIL_HOST} | ||
spring.mail.port=${MAIL_PORT} | ||
spring.mail.username=${MAIL_USERNAME} | ||
spring.mail.password=${MAIL_PASSWORD} | ||
spring.mail.properties.mail.smtp.auth=${MAIL_AUTH} | ||
spring.mail.properties.mail.smtp.starttls.enable=${MAIL_STARTTLS} |