mirror of
https://github.com/donl/gPanel.git
synced 2026-05-26 06:12:20 -06:00
Merge pull request #38 from george-e-shaw-iv/master
Check if user already exists in registration process
This commit is contained in:
commit
4a29c8a683
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