mirror of
https://github.com/sigmasternchen/threadule
synced 2025-03-15 08:09:01 +00:00
style(backend): revert some style changes
This commit is contained in:
parent
0154537fde
commit
ff535a616f
2 changed files with 8 additions and 10 deletions
|
@ -7,13 +7,11 @@ import (
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const defaultPasswordLength = 16
|
||||||
defaultPasswordLength = 16
|
const defaultPasswordCharSet = "abcdefghijklmnopqrstuvwxyz" +
|
||||||
defaultPasswordCharSet = "abcdefghijklmnopqrstuvwxyz" +
|
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
|
||||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
|
"0123456789" +
|
||||||
"0123456789" +
|
"=!$%&+#-_.,;:"
|
||||||
"=!$%&+#-_.,;:"
|
|
||||||
)
|
|
||||||
|
|
||||||
func (l *Logic) defaultPassword() string {
|
func (l *Logic) defaultPassword() string {
|
||||||
builder := strings.Builder{}
|
builder := strings.Builder{}
|
||||||
|
|
|
@ -3,7 +3,7 @@ package router
|
||||||
import (
|
import (
|
||||||
"net/http"
|
"net/http"
|
||||||
"strings"
|
"strings"
|
||||||
"threadule/backend/internal/presentation"
|
. "threadule/backend/internal/presentation"
|
||||||
"threadule/backend/internal/web"
|
"threadule/backend/internal/web"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -13,14 +13,14 @@ func authenticated(next web.Handler) web.Handler {
|
||||||
return func(ctx *web.Context) {
|
return func(ctx *web.Context) {
|
||||||
authHeader := ctx.Request.Header.Get("Authorization")
|
authHeader := ctx.Request.Header.Get("Authorization")
|
||||||
if !strings.HasPrefix(authHeader, authPrefix) {
|
if !strings.HasPrefix(authHeader, authPrefix) {
|
||||||
presentation.StatusResponse(ctx, http.StatusBadRequest, "Authorization header missing or malformed")
|
StatusResponse(ctx, http.StatusBadRequest, "Authorization header missing or malformed")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
authHeader = strings.TrimPrefix(authHeader, authPrefix)
|
authHeader = strings.TrimPrefix(authHeader, authPrefix)
|
||||||
|
|
||||||
user, err := ctx.AppCtx.Logic.AuthenticateSession(authHeader)
|
user, err := ctx.AppCtx.Logic.AuthenticateSession(authHeader)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
presentation.StatusResponse(ctx, http.StatusUnauthorized, err.Error())
|
StatusResponse(ctx, http.StatusUnauthorized, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue