From c11a0da9740ab8ad5b6baaa7df017937121f41f6 Mon Sep 17 00:00:00 2001 From: gazebo Date: Mon, 29 Oct 2018 14:54:40 +0800 Subject: [PATCH] - max username set to 30 --- business/jxutils/jxcontext/jxcontext.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/business/jxutils/jxcontext/jxcontext.go b/business/jxutils/jxcontext/jxcontext.go index eb379f49e..f75cd3b0d 100644 --- a/business/jxutils/jxcontext/jxcontext.go +++ b/business/jxutils/jxcontext/jxcontext.go @@ -18,6 +18,10 @@ type Context struct { locker sync.RWMutex } +const ( + MaxUserNameLen = 30 +) + var ( AdminCtx *Context ) @@ -43,8 +47,8 @@ func (ctx *Context) GetUserName() string { if ctx.userInfo != nil { userName = ctx.userInfo.ID } - if len(userName) > 10 { - userName = userName[:10] + if len(userName) > MaxUserNameLen { + userName = userName[:MaxUserNameLen] } return userName }