srht/oauth: Use canonical user IDs

When adding users to the database, use the canonical user ID from
meta.sr.ht.
This commit is contained in:
Adnan Maolood 2022-07-13 14:30:43 -04:00 committed by Drew DeVault
parent 030a0cd789
commit 27509d25bf
1 changed files with 4 additions and 3 deletions

View File

@ -151,16 +151,17 @@ If you are the admin of {metasrht}, run the following SQL to correct this:
# I hate SQLAlchemy SO FUCKING MUCH
results = db.engine.execute(text("""
INSERT INTO "user" (
created, updated, username, email, user_type, url, location,
created, updated, id, username, email, user_type, url, location,
bio, suspension_notice
) VALUES (
NOW() at time zone 'utc',
NOW() at time zone 'utc',
:name, :email, :user_type, :url, :location, :bio, :suspension_notice
:id, :name, :email, :user_type, :url, :location, :bio, :suspension_notice
)
ON CONFLICT (username)
ON CONFLICT (id)
DO UPDATE SET
updated = NOW() at time zone 'utc',
username = :name,
email = :email,
user_type = :user_type,
url = :url,