Remove unnecessary code
This commit is contained in:
parent
d6b351f860
commit
cb8fb2dfc2
|
|
@ -47,9 +47,6 @@ func (a *UserAPI) GetCurrentUser(ctx *gin.Context) {
|
||||||
func (a *UserAPI) CreateUser(ctx *gin.Context) {
|
func (a *UserAPI) CreateUser(ctx *gin.Context) {
|
||||||
user := model.UserExternalWithPass{}
|
user := model.UserExternalWithPass{}
|
||||||
if err := ctx.Bind(&user); err == nil {
|
if err := ctx.Bind(&user); err == nil {
|
||||||
if len(user.Pass) == 0 {
|
|
||||||
ctx.AbortWithError(400, errors.New("password may not be empty"))
|
|
||||||
} else {
|
|
||||||
internal := a.toInternal(&user, []byte{})
|
internal := a.toInternal(&user, []byte{})
|
||||||
if a.DB.GetUserByName(internal.Name) == nil {
|
if a.DB.GetUserByName(internal.Name) == nil {
|
||||||
a.DB.CreateUser(internal)
|
a.DB.CreateUser(internal)
|
||||||
|
|
@ -58,7 +55,6 @@ func (a *UserAPI) CreateUser(ctx *gin.Context) {
|
||||||
ctx.AbortWithError(400, errors.New("username already exists"))
|
ctx.AbortWithError(400, errors.New("username already exists"))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserByID returns the user by id
|
// GetUserByID returns the user by id
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue