This commit is contained in:
konrad 2018-08-30 19:14:16 +02:00 committed by kolaente
parent 478c98fb8d
commit 76f3357a0c
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
3 changed files with 22 additions and 22 deletions

View file

@ -22,7 +22,7 @@ type List struct {
func (l *List) AfterLoad() { func (l *List) AfterLoad() {
// Get the owner // Get the owner
l.Owner, _= GetUserByID(l.OwnerID) l.Owner, _ = GetUserByID(l.OwnerID)
// Get the list tasks // Get the list tasks
l.Tasks, _ = GetTasksByListID(l.ID) l.Tasks, _ = GetTasksByListID(l.ID)

View file

@ -84,27 +84,27 @@ func UpdateUser(user User) (updatedUser User, err error) {
return User{}, err return User{}, err
} }
// Check if we have at least a username // Check if we have at least a username
if user.Username == "" { if user.Username == "" {
//return User{}, ErrNoUsername{user.ID} //return User{}, ErrNoUsername{user.ID}
user.Username = theUser.Username // Dont change the username if we dont have one user.Username = theUser.Username // Dont change the username if we dont have one
} }
user.Password = theUser.Password // set the password to the one in the database to not accedently resetting it user.Password = theUser.Password // set the password to the one in the database to not accedently resetting it
// Update it // Update it
_, err = x.Id(user.ID).Update(user) _, err = x.Id(user.ID).Update(user)
if err != nil { if err != nil {
return User{}, err return User{}, err
} }
// Get the newly updated user // Get the newly updated user
updatedUser, err = GetUserByID(user.ID) updatedUser, err = GetUserByID(user.ID)
if err != nil { if err != nil {
return User{}, err return User{}, err
} }
return updatedUser, err return updatedUser, err
} }
// UpdateUserPassword updates the password of a user // UpdateUserPassword updates the password of a user

View file

@ -61,10 +61,10 @@ func userAddOrUpdate(c echo.Context) error {
var exists bool var exists bool
_, err := models.GetUserByID(datUser.ID) _, err := models.GetUserByID(datUser.ID)
if err != nil { if err != nil {
if models.IsErrUserDoesNotExist(err) { if models.IsErrUserDoesNotExist(err) {
exists = true exists = true
} else { } else {
return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the user exists."}) return c.JSON(http.StatusInternalServerError, models.Message{"Could not check if the user exists."})
} }
} }