Fix not checking for user credentials upon login (#9)
This commit is contained in:
parent
4713023a97
commit
9a5eb577b8
1 changed files with 5 additions and 0 deletions
|
@ -74,6 +74,11 @@ func GetUser(user User) (userOut User, err error) {
|
||||||
|
|
||||||
// CheckUserCredentials checks user credentials
|
// CheckUserCredentials checks user credentials
|
||||||
func CheckUserCredentials(u *UserLogin) (User, error) {
|
func CheckUserCredentials(u *UserLogin) (User, error) {
|
||||||
|
// Check if we have any credentials
|
||||||
|
if u.Password == "" || u.Username == "" {
|
||||||
|
return User{}, ErrNoUsernamePassword{}
|
||||||
|
}
|
||||||
|
|
||||||
// Check if the user exists
|
// Check if the user exists
|
||||||
user, err := GetUser(User{Username: u.Username})
|
user, err := GetUser(User{Username: u.Username})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in a new issue