Added new checks (#2)
* added gocyclo-check * Added new tests to drone * Added new checks to makefile
This commit is contained in:
@ -39,7 +39,7 @@ func GetListsByNamespaceID(c echo.Context) error {
|
||||
if models.IsErrUserDoesNotHaveAccessToNamespace(err) {
|
||||
return c.JSON(http.StatusForbidden, models.Message{"You don't have access to this namespace."})
|
||||
}
|
||||
return c.JSON(http.StatusInternalServerError, models.Message{"An error occured."})
|
||||
return c.JSON(http.StatusInternalServerError, models.Message{"An error occurred."})
|
||||
}
|
||||
|
||||
// Get the lists
|
||||
@ -48,7 +48,7 @@ func GetListsByNamespaceID(c echo.Context) error {
|
||||
if models.IsErrNamespaceDoesNotExist(err) {
|
||||
return c.JSON(http.StatusNotFound, models.Message{"Namespace not found."})
|
||||
}
|
||||
return c.JSON(http.StatusInternalServerError, models.Message{"An error occured."})
|
||||
return c.JSON(http.StatusInternalServerError, models.Message{"An error occurred."})
|
||||
}
|
||||
return c.JSON(http.StatusOK, lists)
|
||||
}
|
||||
|
@ -32,7 +32,7 @@ func UserList(c echo.Context) error {
|
||||
users, err := models.ListUsers(s)
|
||||
if err != nil {
|
||||
models.Log.Error(err.Error())
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, "An error occured.")
|
||||
return echo.NewHTTPError(http.StatusInternalServerError, "An error occurred.")
|
||||
}
|
||||
|
||||
// Obfuscate the mailadresses
|
||||
|
@ -30,6 +30,9 @@ func UserChangePassword(c echo.Context) error {
|
||||
|
||||
// Check if the user is itself
|
||||
userJWTinfo, err := models.GetCurrentUser(c)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, models.Message{"Error getting current user."})
|
||||
}
|
||||
|
||||
if userJWTinfo.ID != userID {
|
||||
return echo.ErrUnauthorized
|
||||
|
Reference in New Issue
Block a user