"fix: add family to authorized_families on create and OAuth login
This commit is contained in:
@@ -119,6 +119,21 @@ pub async fn google_callback(
|
||||
.await
|
||||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?;
|
||||
|
||||
if let Some(family_id) = user.family_id {
|
||||
let mut authorized_families: Vec<i32> = session
|
||||
.get("authorized_families")
|
||||
.await
|
||||
.unwrap_or(None)
|
||||
.unwrap_or_default();
|
||||
if !authorized_families.contains(&family_id) {
|
||||
authorized_families.push(family_id);
|
||||
session
|
||||
.insert("authorized_families", authorized_families)
|
||||
.await
|
||||
.ok();
|
||||
}
|
||||
}
|
||||
|
||||
let redirect_url = frontend_url.unwrap_or_else(|| "http://localhost:3000".to_string());
|
||||
|
||||
Ok(Redirect::temporary(&redirect_url))
|
||||
|
||||
Reference in New Issue
Block a user