Fix: no password case

This commit is contained in:
Grail Finder
2026-02-20 09:37:58 +03:00
parent 83d4f88eb5
commit 9809cc5050

View File

@@ -79,9 +79,12 @@ func HandleFrontLogin(w http.ResponseWriter, r *http.Request) {
// make sure username does not exists // make sure username does not exists
cleanName := utils.RemoveSpacesFromStr(username) cleanName := utils.RemoveSpacesFromStr(username)
clearPass := utils.RemoveSpacesFromStr(password) clearPass := utils.RemoveSpacesFromStr(password)
var hashedPass string
if clearPass != "" {
// hash the password with md5 // hash the password with md5
hash := md5.Sum([]byte(clearPass)) hash := md5.Sum([]byte(clearPass))
hashedPass := hex.EncodeToString(hash[:]) hashedPass = hex.EncodeToString(hash[:])
}
// check if that user was already in db // check if that user was already in db
userstate, err := repo.PlayerGetByName(r.Context(), cleanName) userstate, err := repo.PlayerGetByName(r.Context(), cleanName)
if err != nil || userstate == nil { if err != nil || userstate == nil {