fmt
This commit is contained in:
parent
478c98fb8d
commit
76f3357a0c
3 changed files with 22 additions and 22 deletions
|
@ -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)
|
||||||
|
|
|
@ -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
|
||||||
|
|
|
@ -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."})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue