Skip to content

Commit

Permalink
cleanup: clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
drew-harris committed Aug 28, 2024
1 parent c60c895 commit ba77a44
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions server/src/handlers/auth_handler.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use crate::data::models::{Organization, RedisPool, StripePlan, UserRole};
use crate::data::schema::user_organizations;
use crate::get_env;
use crate::operators::invitation_operator::check_inv_valid;
use crate::operators::organization_operator::{get_org_from_id_query, get_user_org_count};
Expand Down Expand Up @@ -542,17 +541,16 @@ pub async fn callback(
// Use the new_user_redirect_uri if the user has just been created and is the owner of
// one organization
let mut final_redirect = login_state.redirect_uri.clone();
if user_is_new {
if user_orgs
if user_is_new
&& user_orgs
.clone()
.into_iter()
.any(|org_user| return org_user.role == 2)
&& user_orgs.len() == 1
{
final_redirect = login_state
.new_user_redirect_uri
.unwrap_or(login_state.redirect_uri);
}
.any(|org_user| org_user.role == 2)
&& user_orgs.len() == 1
{
final_redirect = login_state
.new_user_redirect_uri
.unwrap_or(login_state.redirect_uri);
}

Ok(HttpResponse::SeeOther()
Expand Down

0 comments on commit ba77a44

Please sign in to comment.