Merge pull request #1058 from AppFlowy-IO/gotrue-admin-creation-2

fix: gotrue admin creation without email verification
This commit is contained in:
Khor Shu Heng 2024-12-10 08:57:21 +08:00 committed by GitHub
commit ee2ff899a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 18 additions and 1 deletions

View File

@ -132,6 +132,12 @@ jobs:
echo "Running tests for ${{ matrix.test_service }} with flags: ${{ matrix.test_cmd }}"
RUST_LOG="info" DISABLE_CI_TEST_LOG="true" cargo test ${{ matrix.test_cmd }}
- name: Server Logs
if: failure()
run: |
docker ps -a
docker compose -f docker-compose-ci.yml logs
- name: Docker Logs
if: always()
run: |

View File

@ -15,3 +15,4 @@
- Go to [web server](localhost)
- After editing source files, do `docker compose up -d --no-deps --build admin_frontend`
- You might need to add `--force-recreate` flag for non build changes to take effect

View File

@ -42,6 +42,7 @@ impl AdminFrontendClient {
.send()
.await
.unwrap();
let resp = check_resp(resp).await;
let c = resp.cookies().find(|c| c.name() == "session_id").unwrap();
self.session_id = Some(c.value().to_string());
}
@ -84,3 +85,12 @@ impl AdminFrontendClient {
self.session_id.as_ref().unwrap()
}
}
async fn check_resp(resp: reqwest::Response) -> reqwest::Response {
if resp.status() != 200 {
println!("resp: {:#?}", resp);
let payload = resp.text().await.unwrap();
panic!("payload: {:#?}", payload)
}
resp
}

View File

@ -5,7 +5,7 @@ set -e
if [ -n "${GOTRUE_ADMIN_EMAIL}" ] && [ -n "${GOTRUE_ADMIN_PASSWORD}" ]; then
set +e
echo "Creating admin user for gotrue..."
command_output=$(./auth admin createuser --admin "${GOTRUE_ADMIN_EMAIL}" "${GOTRUE_ADMIN_PASSWORD}" 2>&1)
command_output=$(./auth admin createuser --admin --confirm "${GOTRUE_ADMIN_EMAIL}" "${GOTRUE_ADMIN_PASSWORD}" 2>&1)
command_status=$?
# Check if the command failed
if [ $command_status -ne 0 ]; then