add some validation code

This commit is contained in:
Joerg Lehmann 2022-10-02 16:19:12 +02:00
parent d8eece9046
commit a827a6e91b
1 changed files with 7 additions and 8 deletions

View File

@ -119,15 +119,14 @@ func checkUserAvailable(username string) bool {
conn := globalPool.Get()
defer conn.Close()
_, err := conn.Do("HGETALL", userPrefix+username)
if err == redis.ErrNil {
logit("User does not exist and is therefore available:" + username)
exists, _ := redis.Bool(conn.Do("EXISTS", userPrefix+username))
if !exists {
logit("checkUserAvailable: User does not exist, so it is available: " + username)
return true
} else if err != nil {
logit("checkUserAvailable: Error to query Key Value Store")
} else {
logit("checkUserAvailable: User exist, so it is not available: " + username)
return false
}
return false
}
func getMyDevs(username string) []string {