fixed lint + gofmt
the build was successful Details

This commit is contained in:
konrad 2018-01-23 16:20:37 +01:00 committed by kolaente
parent bcb8b08001
commit d309d5b3b6
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
3 changed files with 7 additions and 7 deletions

View File

@ -42,7 +42,7 @@ type ErrUserDoesNotExist struct {
UserID int64
}
// IsErrNoUsername checks if an error is a ErrUsernameExists.
// IsErrUserDoesNotExist checks if an error is a ErrUsernameExists.
func IsErrUserDoesNotExist(err error) bool {
_, ok := err.(ErrUserDoesNotExist)
return ok

View File

@ -1,12 +1,13 @@
package v1
import (
"git.mowie.cc/konrad/Library/models"
"github.com/labstack/echo"
"net/http"
"strconv"
"git.mowie.cc/konrad/Library/models"
)
// UserShow gets all informations about a user
func UserShow(c echo.Context) error {
// Check if the user is admin
@ -39,4 +40,4 @@ func UserShow(c echo.Context) error {
}
return c.JSON(http.StatusOK, userInfos)
}
}

View File

@ -4,8 +4,8 @@ import (
"net/http"
"strconv"
"github.com/labstack/echo"
"git.mowie.cc/konrad/Library/models"
"github.com/labstack/echo"
)
type datPassword struct {
@ -28,7 +28,6 @@ func UserChangePassword(c echo.Context) error {
return c.JSON(http.StatusInternalServerError, models.Message{"Error getting user infos."})
}
// Check if the user is admin or itself
userJWTinfo, err := models.GetCurrentUser(c)
if !models.IsAdmin(c) || userJWTinfo.ID == userID {
@ -59,7 +58,7 @@ func UserChangePassword(c echo.Context) error {
if !exists {
return c.JSON(http.StatusNotFound, models.Message{"User not found."})
}
err = models.UpdateUserPassword(userID, datPw.Password)
if err != nil {
@ -67,4 +66,4 @@ func UserChangePassword(c echo.Context) error {
}
return c.JSON(http.StatusOK, models.Message{"The password was updated successfully"})
}
}