1
0
Fork 0
forked from jriou/coller

feat: Add copier and curl links

Signed-off-by: Julien Riou <julien@riou.xyz>
This commit is contained in:
Julien Riou 2025-10-02 09:23:40 +02:00
commit b316c6ef67
Signed by: jriou
GPG key ID: 9A099EDA51316854
4 changed files with 77 additions and 3 deletions

View file

@ -213,8 +213,14 @@ func (h *GetProtectedNoteHandler) ServeHTTP(w http.ResponseWriter, r *http.Reque
}
}
password, err := internal.Decode(body.Password)
if err != nil {
APIError(w, logger, ErrCouldNotDecodePassword, err)
return
}
if len(note.PasswordHash) > 0 {
err := bcrypt.CompareHashAndPassword(note.PasswordHash, []byte(body.Password))
err := bcrypt.CompareHashAndPassword(note.PasswordHash, password)
if err != nil {
APIErrorBadRequest(w, logger, ErrInvalidPassword, err)
return