Skip to content

Commit

Permalink
fix(web): add username in auth
Browse files Browse the repository at this point in the history
  • Loading branch information
i007c committed Apr 21, 2024
1 parent f2e0352 commit 452c80c
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions web/src/api/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,19 @@ async fn login_telegram(

sqlx::query_as! {
User,
"update users set name = ?, auth_date = ?,
"update users set name = ?, username = ?, auth_date = ?,
token = ?, photo = ? where id = ?",
name, q.auth_date, token_hashed, has_photo, user.id
name, q.username, q.auth_date, token_hashed, has_photo, user.id
}
.execute(&state.sql)
.await?;
}
Err(_) => {
sqlx::query_as! {
User,
"insert into users (id, name, auth_date, token, photo)
values(?, ?, ?, ?, ?)",
q.id, name, q.auth_date, token_hashed, has_photo
"insert into users (id, name, username, auth_date, token, photo)
values(?, ?, ?, ?, ?, ?)",
q.id, name, q.username, q.auth_date, token_hashed, has_photo
}
.execute(&state.sql)
.await?;
Expand Down

0 comments on commit 452c80c

Please sign in to comment.