Fix: no password case
This commit is contained in:
@@ -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)
|
||||||
// hash the password with md5
|
var hashedPass string
|
||||||
hash := md5.Sum([]byte(clearPass))
|
if clearPass != "" {
|
||||||
hashedPass := hex.EncodeToString(hash[:])
|
// hash the password with md5
|
||||||
|
hash := md5.Sum([]byte(clearPass))
|
||||||
|
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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user