fix: don't attempt to change client token on auth

This commit is contained in:
əlemi 2023-01-22 16:55:32 +01:00
parent 3fadbbba3d
commit 374765bd19
No known key found for this signature in database
GPG key ID: BBCBFE5D7244634E

View file

@ -71,6 +71,7 @@ pub async fn authenticate(State(state): State<AppState>, Json(payload): Json<pro
access_token: Set(access_token.clone()),
created_at: Set(Utc::now()),
}).exec(&state.db).await.unwrap();
let client_token = payload.clientToken.unwrap_or(Uuid::new_v4());
let profile = proto::Profile {
name: u.name.clone(),
id: u.uuid,
@ -79,7 +80,7 @@ pub async fn authenticate(State(state): State<AppState>, Json(payload): Json<pro
proto::AuthenticateResponse {
accessToken: access_token,
user: proto::User { id: u.uuid, username: u.name, properties: Some(vec![]) },
clientToken: Uuid::new_v4().to_string(),
clientToken: client_token.to_string(),
availableProfiles: vec![profile.clone()],
selectedProfile: profile,
}