style(backend): revert some style changes

This commit is contained in:
Nina Siegel 2021-12-19 19:34:00 +01:00
parent 0154537fde
commit ff535a616f
2 changed files with 8 additions and 10 deletions

View file

@ -7,13 +7,11 @@ import (
"time"
)
const (
defaultPasswordLength = 16
defaultPasswordCharSet = "abcdefghijklmnopqrstuvwxyz" +
const defaultPasswordLength = 16
const defaultPasswordCharSet = "abcdefghijklmnopqrstuvwxyz" +
"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +
"0123456789" +
"=!$%&+#-_.,;:"
)
func (l *Logic) defaultPassword() string {
builder := strings.Builder{}

View file

@ -3,7 +3,7 @@ package router
import (
"net/http"
"strings"
"threadule/backend/internal/presentation"
. "threadule/backend/internal/presentation"
"threadule/backend/internal/web"
)
@ -13,14 +13,14 @@ func authenticated(next web.Handler) web.Handler {
return func(ctx *web.Context) {
authHeader := ctx.Request.Header.Get("Authorization")
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
}
authHeader = strings.TrimPrefix(authHeader, authPrefix)
user, err := ctx.AppCtx.Logic.AuthenticateSession(authHeader)
if err != nil {
presentation.StatusResponse(ctx, http.StatusUnauthorized, err.Error())
StatusResponse(ctx, http.StatusUnauthorized, err.Error())
return
}