mirror of
https://github.com/semaphoreui/semaphore.git
synced 2025-01-20 15:29:28 +01:00
fix(be): returns correct error object if user not found
This commit is contained in:
parent
e5bfe764e0
commit
a1b2d2dc7f
@ -128,7 +128,7 @@ func login(w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
user, err := helpers.Store(r).GetUserByLoginOrEmail(login.Auth, login.Auth)
|
||||
|
||||
if err != nil && err == db.ErrNotFound {
|
||||
if err == db.ErrNotFound {
|
||||
if ldapUser != nil {
|
||||
// create new LDAP user
|
||||
user = *ldapUser
|
||||
|
@ -201,5 +201,10 @@ func (d *SqlDb) GetUsers(params db.RetrieveQueryParams) (users []db.User, err er
|
||||
|
||||
func (d *SqlDb) GetUserByLoginOrEmail(login string, email string) (existingUser db.User, err error) {
|
||||
err = d.sql.SelectOne(&existingUser, "select * from `user` where email=? or username=?", email, login)
|
||||
|
||||
if err == sql.ErrNoRows {
|
||||
err = db.ErrNotFound
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user