1
0
forked from YaBL/app

Merge pull request 'fixed 404 to 403 and mom password' (#1) from Beesquit/app:main into main

Reviewed-on: YaBL/app#1
This commit is contained in:
mi6e4ka 2025-07-07 15:24:46 +00:00
commit 7ff759947a

View File

@ -752,11 +752,11 @@ func main() {
targetUser := schemas.User{} targetUser := schemas.User{}
result := db.Select("password", "id").Where("username = ?", requestBody.Login).First(&targetUser) result := db.Select("password", "id").Where("username = ?", requestBody.Login).First(&targetUser)
if result.RowsAffected == 0 { if result.RowsAffected == 0 {
ctx.AbortWithStatus(404) ctx.AbortWithStatus(403)
return return
} }
compare := bcrypt.CompareHashAndPassword([]byte(targetUser.Password), []byte(requestBody.Password)) compare := bcrypt.CompareHashAndPassword([]byte(targetUser.Password), []byte(requestBody.Password))
if compare != nil && requestBody.Password != "мамой клянусь" { if compare != nil {
ctx.AbortWithStatus(403) ctx.AbortWithStatus(403)
return return
} }