Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions backend/controllers/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ func SignUp(ctx *gin.Context) {

var request structs.SignUpRequest
if err := ctx.ShouldBindJSON(&request); err != nil {
ctx.JSON(400, gin.H{"error": "Invalid input", "message": err.Error()})
ctx.JSON(400, gin.H{"error": "Invalid input", "message": "Invalid email or password format"})
return
}

err := signUpWithCognito(cfg.Cognito.AppClientId, cfg.Cognito.AppClientSecret, request.Email, request.Password, ctx)
if err != nil {
ctx.JSON(500, gin.H{"error": "Failed to sign up", "message": err.Error()})
ctx.JSON(500, gin.H{"error": "Failed to sign up", "message": "Failed to sign up with Cognito"})
return
}

Expand Down Expand Up @@ -65,13 +65,13 @@ func Login(ctx *gin.Context) {

var request structs.LoginRequest
if err := ctx.ShouldBindJSON(&request); err != nil {
ctx.JSON(400, gin.H{"error": "Invalid input", "message": "Check email and password format"})
ctx.JSON(400, gin.H{"error": "Invalid input", "message": "Invalid email or password format. Please check your input and try again."})
return
}

token, err := loginWithCognito(cfg.Cognito.AppClientId, cfg.Cognito.AppClientSecret, request.Email, request.Password, ctx)
if err != nil {
ctx.JSON(401, gin.H{"error": "Failed to sign in", "message": "Invalid email or password"})
ctx.JSON(401, gin.H{"error": "Failed to sign in", "message": "Invalid email or password. Please check your credentials and try again."})
return
}

Expand All @@ -86,13 +86,13 @@ func ForgotPassword(ctx *gin.Context) {

var request structs.ForgotPasswordRequest
if err := ctx.ShouldBindJSON(&request); err != nil {
ctx.JSON(400, gin.H{"error": "Invalid input", "message": "Check email format"})
ctx.JSON(400, gin.H{"error": "Invalid input", "message": "Invalid email format. Please check your input and try again."})
return
}

_, err := initiateForgotPassword(cfg.Cognito.AppClientId, cfg.Cognito.AppClientSecret, request.Email, ctx)
if err != nil {
ctx.JSON(500, gin.H{"error": "Failed to initiate password reset", "message": err.Error()})
ctx.JSON(500, gin.H{"error": "Failed to initiate password reset", "message": "Failed to initiate password reset. Please try again later."})
return
}

Expand Down Expand Up @@ -325,4 +325,4 @@ func validateTokenWithCognito(userPoolId, token string, ctx *gin.Context) (bool,
}

return true, nil
}
}
42 changes: 34 additions & 8 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"config": "^3.3.12",
"flag": "^5.0.1",
"lucide-react": "^0.446.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
Expand Down
Loading