Skip to content

Commit

Permalink
remove useless code & log in api_webui.go
Browse files Browse the repository at this point in the history
  • Loading branch information
brianchennn committed Sep 16, 2023
1 parent a5a7471 commit 4e9e3d6
Showing 1 changed file with 1 addition and 20 deletions.
21 changes: 1 addition & 20 deletions backend/WebUI/api_webui.go
Original file line number Diff line number Diff line change
Expand Up @@ -494,16 +494,6 @@ func JWT(email, userId, tenantId string) string {
return tokenString
}

func generateHash(password string) error {
hash, err := bcrypt.GenerateFromPassword([]byte(password), 12)
if err != nil {
logger.ProcLog.Errorf("generateHash err: %+v", err)
return err
}
logger.ProcLog.Warnln("Password hash:", hash)
return err
}

func Login(c *gin.Context) {
setCorsHeader(c)

Expand All @@ -515,13 +505,6 @@ func Login(c *gin.Context) {
return
}

err = generateHash(login.Password)
if err != nil {
logger.ProcLog.Errorf("Login err: %+v", err)
c.JSON(http.StatusInternalServerError, gin.H{})
return
}

filterEmail := bson.M{"email": login.Username}
userData, err := mongoapi.RestfulAPIGetOne(userDataColl, filterEmail)
if err != nil {
Expand All @@ -548,7 +531,7 @@ func Login(c *gin.Context) {
userId := userData["userId"].(string)
tenantId := userData["tenantId"].(string)

logger.ProcLog.Warnln("Login success {",
logger.ProcLog.Infoln("Login success {",
"username:", login.Username,
", userid:", userId,
", tenantid:", tenantId,
Expand All @@ -557,8 +540,6 @@ func Login(c *gin.Context) {
token := JWT(login.Username, userId, tenantId)
if token == "" {
logger.ProcLog.Errorln("token is empty")
} else {
logger.ProcLog.Warnln("token", token)
}

oauth := OAuth{}
Expand Down

0 comments on commit 4e9e3d6

Please sign in to comment.