refactor: no need to handle user escaping in verify cmd

This commit is contained in:
Stavros
2025-10-06 21:26:31 +03:00
parent fa62ba2e33
commit e1dcbda4ec

View File

@@ -2,7 +2,6 @@ package cmd
import ( import (
"errors" "errors"
"strings"
"tinyauth/internal/utils" "tinyauth/internal/utils"
"github.com/charmbracelet/huh" "github.com/charmbracelet/huh"
@@ -96,14 +95,7 @@ func (c *verifyUserCmd) run(cmd *cobra.Command, args []string) {
log.Fatal().Msg("Username is incorrect") log.Fatal().Msg("Username is incorrect")
} }
var passwd string err = bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(c.password))
if strings.Contains(user.Password, "$$") {
passwd = strings.ReplaceAll(user.Password, "$$", "$")
} else {
passwd = c.password
}
err = bcrypt.CompareHashAndPassword([]byte(user.Password), []byte(passwd))
if err != nil { if err != nil {
log.Fatal().Msg("Password is incorrect") log.Fatal().Msg("Password is incorrect")
} }