summaryrefslogtreecommitdiffstats
path: root/routers/admin/users.go
diff options
context:
space:
mode:
Diffstat (limited to 'routers/admin/users.go')
-rw-r--r--routers/admin/users.go17
1 files changed, 9 insertions, 8 deletions
diff --git a/routers/admin/users.go b/routers/admin/users.go
index 06c391b8e0..2ea496624b 100644
--- a/routers/admin/users.go
+++ b/routers/admin/users.go
@@ -6,6 +6,8 @@
package admin
import (
+ "fmt"
+ "strconv"
"strings"
"code.gitea.io/gitea/models"
@@ -17,8 +19,6 @@ import (
"code.gitea.io/gitea/modules/setting"
"code.gitea.io/gitea/routers"
"code.gitea.io/gitea/services/mailer"
-
- "github.com/unknwon/com"
)
const (
@@ -92,8 +92,9 @@ func NewUserPost(ctx *context.Context, form auth.AdminCreateUserForm) {
if len(form.LoginType) > 0 {
fields := strings.Split(form.LoginType, "-")
if len(fields) == 2 {
- u.LoginType = models.LoginType(com.StrTo(fields[0]).MustInt())
- u.LoginSource = com.StrTo(fields[1]).MustInt64()
+ lType, _ := strconv.ParseInt(fields[0], 10, 0)
+ u.LoginType = models.LoginType(lType)
+ u.LoginSource, _ = strconv.ParseInt(fields[1], 10, 64)
u.LoginName = form.LoginName
}
}
@@ -154,7 +155,7 @@ func NewUserPost(ctx *context.Context, form auth.AdminCreateUserForm) {
}
ctx.Flash.Success(ctx.Tr("admin.users.new_success", u.Name))
- ctx.Redirect(setting.AppSubURL + "/admin/users/" + com.ToStr(u.ID))
+ ctx.Redirect(setting.AppSubURL + "/admin/users/" + fmt.Sprint(u.ID))
}
func prepareUserInfo(ctx *context.Context) *models.User {
@@ -220,12 +221,12 @@ func EditUserPost(ctx *context.Context, form auth.AdminEditUserForm) {
fields := strings.Split(form.LoginType, "-")
if len(fields) == 2 {
- loginType := models.LoginType(com.StrTo(fields[0]).MustInt())
- loginSource := com.StrTo(fields[1]).MustInt64()
+ loginType, _ := strconv.ParseInt(fields[0], 10, 0)
+ loginSource, _ := strconv.ParseInt(fields[1], 10, 64)
if u.LoginSource != loginSource {
u.LoginSource = loginSource
- u.LoginType = loginType
+ u.LoginType = models.LoginType(loginType)
}
}