fix: user not allowed
This commit is contained in:
parent
17044ad4f0
commit
32390676f1
2
dev.env
2
dev.env
|
|
@ -8,7 +8,7 @@ GOTRUE_JWT_SECRET=hello456
|
||||||
# user sign up will automatically be confirmed if this is set to true
|
# user sign up will automatically be confirmed if this is set to true
|
||||||
# if you have OAuth2 set up or smtp configured, you can set this to false
|
# if you have OAuth2 set up or smtp configured, you can set this to false
|
||||||
# to enforce email confirmation or OAuth2 login instead
|
# to enforce email confirmation or OAuth2 login instead
|
||||||
GOTRUE_MAILER_AUTOCONFIRM=true
|
GOTRUE_MAILER_AUTOCONFIRM=false
|
||||||
|
|
||||||
# if you enable mail confirmation, you need to set the SMTP configuration below
|
# if you enable mail confirmation, you need to set the SMTP configuration below
|
||||||
GOTRUE_SMTP_HOST=smtp.gmail.com
|
GOTRUE_SMTP_HOST=smtp.gmail.com
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,7 @@ we recommend using cloud compute services (as your host server) such as
|
||||||
## Software Requirements
|
## Software Requirements
|
||||||
- [docker compose](https://docs.docker.com/compose)
|
- [docker compose](https://docs.docker.com/compose)
|
||||||
This is needed be installed in your host server
|
This is needed be installed in your host server
|
||||||
|
- We recommend using approach as proposed by offical docker website: [Install Docker Engine](https://docs.docker.com/engine/install/)
|
||||||
|
|
||||||
## Steps
|
## Steps
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -231,21 +231,20 @@ async fn setup_admin_account(
|
||||||
Err(err.into())
|
Err(err.into())
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
Ok(resp) => match resp {
|
Ok(resp) => {
|
||||||
gotrue_entity::dto::SignUpResponse::Authenticated(resp) => {
|
let admin_user = {
|
||||||
tracing::info!(
|
match resp {
|
||||||
"Admin user already created and authenticated at {:?}",
|
gotrue_entity::dto::SignUpResponse::Authenticated(resp) => resp.user,
|
||||||
resp.user.email_confirmed_at
|
gotrue_entity::dto::SignUpResponse::NotAuthenticated(user) => user,
|
||||||
);
|
}
|
||||||
Ok(())
|
};
|
||||||
},
|
match admin_user.role.as_str() {
|
||||||
gotrue_entity::dto::SignUpResponse::NotAuthenticated(user) => match user.role.as_str() {
|
|
||||||
"supabase_admin" => {
|
"supabase_admin" => {
|
||||||
tracing::info!("Admin user already created and set role to supabase_admin");
|
tracing::info!("Admin user already created and set role to supabase_admin");
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
_ => {
|
_ => {
|
||||||
let user_id = user.id.parse::<uuid::Uuid>().unwrap();
|
let user_id = admin_user.id.parse::<uuid::Uuid>().unwrap();
|
||||||
let result = sqlx::query(
|
let result = sqlx::query(
|
||||||
r#"
|
r#"
|
||||||
UPDATE auth.users
|
UPDATE auth.users
|
||||||
|
|
@ -263,7 +262,7 @@ async fn setup_admin_account(
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
},
|
},
|
||||||
},
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue