Split "auth" and "user" routes
This commit is contained in:
parent
f3939c5016
commit
59b565ae19
15 changed files with 148 additions and 99 deletions
|
|
@ -6,10 +6,8 @@ import (
|
|||
"encoding/base64"
|
||||
"fmt"
|
||||
"image/png"
|
||||
"net/http"
|
||||
|
||||
"github.com/FAU-CDI/wisski-distillery/internal/models"
|
||||
"github.com/FAU-CDI/wisski-distillery/pkg/httpx"
|
||||
"github.com/pkg/errors"
|
||||
"github.com/pquerna/otp"
|
||||
"github.com/pquerna/otp/totp"
|
||||
|
|
@ -292,18 +290,3 @@ func (au *AuthUser) Delete(ctx context.Context) error {
|
|||
|
||||
return table.Delete(&au.User).Error
|
||||
}
|
||||
|
||||
type userFormContext struct {
|
||||
httpx.FormContext
|
||||
User *models.User
|
||||
}
|
||||
|
||||
func (au *Auth) UserFormContext(ctx httpx.FormContext, r *http.Request) any {
|
||||
user, err := au.UserOf(r)
|
||||
|
||||
uctx := userFormContext{FormContext: ctx}
|
||||
if err == nil {
|
||||
uctx.User = &user.User
|
||||
}
|
||||
return uctx
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue