mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-28 04:35:40 +00:00
refactor: no need to handle user escaping in verify cmd
This commit is contained in:
@@ -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")
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user