mirror of
https://github.com/donl/gPanel.git
synced 2026-05-26 14:22:18 -06:00
check if user already exists in registration process
This commit is contained in:
parent
7dbc9d39fe
commit
ecf359d3ce
1 changed files with 6 additions and 0 deletions
|
|
@ -84,6 +84,12 @@ func UserRegistration(res http.ResponseWriter, req *http.Request) bool {
|
|||
}
|
||||
defer ds.Close()
|
||||
|
||||
err = ds.Get(database.BUCKET_USERS, []byte(userRequestData.User), &userDatabaseData)
|
||||
if err != database.ErrKeyNotExist {
|
||||
http.Error(res, "Username already exists in the database", http.StatusBadRequest)
|
||||
return false
|
||||
}
|
||||
|
||||
userDatabaseData.Pass, err = encryption.HashPassword(userRequestData.Pass)
|
||||
if err != nil {
|
||||
http.Error(res, err.Error(), http.StatusBadRequest)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue