pass logger ctx under key 'l'
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
608b0952b2
commit
c6378d7dd3
@ -197,7 +197,7 @@ func SigninPost(client *ent.Client) echo.HandlerFunc {
|
||||
return c.Redirect(302, "/signin")
|
||||
}
|
||||
|
||||
ctx := context.WithValue(context.Background(), "logger", log)
|
||||
ctx := context.WithValue(context.Background(), "l", log)
|
||||
if usr, err := moduser.QueryUser(ctx, client, username); err == nil {
|
||||
log.Info("queried user:", &usr.ID)
|
||||
|
||||
@ -300,7 +300,7 @@ func SignupPost(client *ent.Client) echo.HandlerFunc {
|
||||
username = uname
|
||||
|
||||
if passwd := c.Request().FormValue("password"); passwd != "" {
|
||||
ctx := context.WithValue(context.Background(), "logger", log)
|
||||
ctx := context.WithValue(context.Background(), "l", log)
|
||||
|
||||
u, err := moduser.CreateUser(ctx, client, username, passwd)
|
||||
if err != nil {
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
|
||||
// CreateUser adds a user entry to the database.
|
||||
func CreateUser(ctx context.Context, client *ent.Client, username, password string) (*ent.User, error) {
|
||||
log := ctx.Value("logger").(*slogging.Logger)
|
||||
log := ctx.Value("l").(*slogging.Logger)
|
||||
|
||||
u, err := client.User.
|
||||
Create().
|
||||
@ -29,7 +29,7 @@ func CreateUser(ctx context.Context, client *ent.Client, username, password stri
|
||||
}
|
||||
|
||||
func QueryUser(ctx context.Context, client *ent.Client, username string) (*ent.User, error) {
|
||||
log := ctx.Value("logger").(*slogging.Logger)
|
||||
log := ctx.Value("l").(*slogging.Logger)
|
||||
|
||||
u, err := client.User.
|
||||
Query().
|
||||
|
Loading…
Reference in New Issue
Block a user