feat(handlers): add duplicate login check and improve request handling
refactor: move postLog package to root directory and enhance logging fix(frpc): improve request parsing and type handling for instance creation chore: update config paths and enable debug mode
This commit is contained in:
+7
-1
@@ -7,7 +7,7 @@ import (
|
||||
"io"
|
||||
"net/http"
|
||||
"strconv"
|
||||
"super-frpc/modules"
|
||||
"super-frpc/postLog"
|
||||
"time"
|
||||
)
|
||||
|
||||
@@ -150,6 +150,12 @@ func LoginHandler(w http.ResponseWriter, r *http.Request) {
|
||||
return
|
||||
}
|
||||
|
||||
existingTokenInfo, err := GetTokenInfo(user.UserID)
|
||||
if err == nil && existingTokenInfo != nil {
|
||||
SendErrorResponse(w, http.StatusConflict, "user is already logged in")
|
||||
return
|
||||
}
|
||||
|
||||
token, err := GenerateToken(user.UserID)
|
||||
if err != nil {
|
||||
SendErrorResponse(w, http.StatusInternalServerError, "failed to generate token")
|
||||
|
||||
Reference in New Issue
Block a user