Reserved username check on signup page
This commit is contained in:
parent
618acc9f92
commit
1e7ea6830c
|
@ -5,6 +5,7 @@ import (
|
|||
"net/http"
|
||||
"strings"
|
||||
|
||||
"code.nonshy.com/nonshy/website/pkg/config"
|
||||
"code.nonshy.com/nonshy/website/pkg/models"
|
||||
)
|
||||
|
||||
|
@ -49,6 +50,16 @@ func UsernameCheck() http.HandlerFunc {
|
|||
return
|
||||
}
|
||||
|
||||
// Is it reserved?
|
||||
for _, cmp := range config.ReservedUsernames {
|
||||
if username == cmp {
|
||||
SendJSON(w, http.StatusOK, Response{
|
||||
Error: "That username is reserved, please choose a different username.",
|
||||
})
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Send success response.
|
||||
SendJSON(w, http.StatusOK, Response{
|
||||
OK: true,
|
||||
|
|
Loading…
Reference in New Issue
Block a user