Skip to content

Commit

Permalink
fix the issue on obtaining the user's information
Browse files Browse the repository at this point in the history
  • Loading branch information
huangcheng committed Dec 16, 2023
1 parent 1301546 commit 4369b23
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/routes/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ pub async fn me(
config: &State<Config>,
jwt: Middleware,
) -> Result<Json<User>, Status> {
let username = jwt.session;
let session = &jwt.session;

let user = get_user(&username, &config.upload_url, &mut db)
let username = match session.split(':').next() {
Some(username) => username,
None => return Err(Status::Unauthorized),
};

let user = get_user(username, &config.upload_url, &mut db)
.await
.map_err(|e| {
error!("{}", e);
Expand Down

0 comments on commit 4369b23

Please sign in to comment.