mirror of
https://github.com/ngoduykhanh/wireguard-ui.git
synced 2025-06-06 00:37:24 +03:00
chore: code adjustment (#512)
This commit is contained in:
parent
8cfe9a3d5b
commit
45849a2aee
9 changed files with 79 additions and 69 deletions
|
@ -75,7 +75,8 @@ func Login(db store.IStore) echo.HandlerFunc {
|
|||
|
||||
dbuser, err := db.GetUserByName(username)
|
||||
if err != nil {
|
||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Cannot query user from DB"})
|
||||
log.Infof("Cannot query user %s from DB", username)
|
||||
return c.JSON(http.StatusInternalServerError, jsonHTTPResponse{false, "Invalid credentials"})
|
||||
}
|
||||
|
||||
userCorrect := subtle.ConstantTimeCompare([]byte(username), []byte(dbuser.Username)) == 1
|
||||
|
@ -173,7 +174,7 @@ func Logout() echo.HandlerFunc {
|
|||
}
|
||||
|
||||
// LoadProfile to load user information
|
||||
func LoadProfile(db store.IStore) echo.HandlerFunc {
|
||||
func LoadProfile() echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
return c.Render(http.StatusOK, "profile.html", map[string]interface{}{
|
||||
"baseData": model.BaseData{Active: "profile", CurrentUser: currentUser(c), Admin: isAdmin(c)},
|
||||
|
@ -182,7 +183,7 @@ func LoadProfile(db store.IStore) echo.HandlerFunc {
|
|||
}
|
||||
|
||||
// UsersSettings handler
|
||||
func UsersSettings(db store.IStore) echo.HandlerFunc {
|
||||
func UsersSettings() echo.HandlerFunc {
|
||||
return func(c echo.Context) error {
|
||||
return c.Render(http.StatusOK, "users_settings.html", map[string]interface{}{
|
||||
"baseData": model.BaseData{Active: "users-settings", CurrentUser: currentUser(c), Admin: isAdmin(c)},
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue