~bigbes/core-go

6c1036e2705d93e1cb71476ac78499ae27f0d326 — Adnan Maolood 4 years ago d0bf115
auth: Use canonical user IDs

When adding users to the database, use the canonical user ID from
meta.sr.ht.
1 files changed, 4 insertions(+), 3 deletions(-)

M auth/middleware.go
M auth/middleware.go => auth/middleware.go +4 -3
@@ 337,6 337,7 @@ func FetchMetaProfile(ctx context.Context, username string, user *AuthContext) e
			INSERT INTO "user" (
				created,
				updated,
				id,
				username,
				email,
				user_type,


@@ 348,7 349,7 @@ func FetchMetaProfile(ctx context.Context, username string, user *AuthContext) e
			VALUES (
				NOW() at time zone 'utc',
				NOW() at time zone 'utc',
				$1, $2, $3, $4, $5, $6, $7
				$1, $2, $3, $4, $5, $6, $7, $8
			)
			ON CONFLICT DO NOTHING
			RETURNING


@@ 362,8 363,8 @@ func FetchMetaProfile(ctx context.Context, username string, user *AuthContext) e
				location,
				bio,
				suspension_notice;`,
			&profile.Username, &profile.Email, &ut, &profile.URL,
			&profile.Location, &profile.Bio, &profile.SuspensionNotice)
			profile.ID, profile.Username, profile.Email, ut, profile.URL,
			profile.Location, profile.Bio, profile.SuspensionNotice)

		// TODO: Register webhooks
		if err := row.Scan(&user.UserID, &user.Created, &user.Updated,