···88#[tokio::main]
89async fn main() -> Result<(), Box<dyn std::error::Error>> {
90 setup_tracing();
91- //TODO may need to change where this reads from? Like an env variable for it's location? Or arg?
92- dotenvy::from_path(Path::new("./pds.env"))?;
0093 let pds_root = env::var("PDS_DATA_DIRECTORY")?;
94 let account_db_url = format!("{pds_root}/account.sqlite");
95···129 env::var("PDS_EMAIL_SMTP_URL").expect("PDS_EMAIL_SMTP_URL is not set in your pds.env file");
130 let sent_from = env::var("PDS_EMAIL_FROM_ADDRESS")
131 .expect("PDS_EMAIL_FROM_ADDRESS is not set in your pds.env file");
0000132 let mailer: AsyncSmtpTransport<Tokio1Executor> =
133 AsyncSmtpTransport::<Tokio1Executor>::from_url(smtp_url.as_str())?.build();
134 //Email templates setup
···88#[tokio::main]
89async fn main() -> Result<(), Box<dyn std::error::Error>> {
90 setup_tracing();
91+ let pds_env_location =
92+ env::var("PDS_ENV_LOCATION").unwrap_or_else(|_| "/pds/pds.env".to_string());
93+94+ dotenvy::from_path(Path::new(&pds_env_location))?;
95 let pds_root = env::var("PDS_DATA_DIRECTORY")?;
96 let account_db_url = format!("{pds_root}/account.sqlite");
97···131 env::var("PDS_EMAIL_SMTP_URL").expect("PDS_EMAIL_SMTP_URL is not set in your pds.env file");
132 let sent_from = env::var("PDS_EMAIL_FROM_ADDRESS")
133 .expect("PDS_EMAIL_FROM_ADDRESS is not set in your pds.env file");
134+135+ //TODO current bug running in docker
136+ // https://github.com/lettre/lettre/issues/349#issuecomment-510155500
137+138 let mailer: AsyncSmtpTransport<Tokio1Executor> =
139 AsyncSmtpTransport::<Tokio1Executor>::from_url(smtp_url.as_str())?.build();
140 //Email templates setup
+1-4
src/oauth_provider.rs
···36 "Invalid identifier or password",
37 ),
38 AuthResult::TwoFactorRequired(masked_email) => {
39- // Email sending step can be handled here if needed in the future.
40-41- // {"error":"second_authentication_factor_required","error_description":"emailOtp authentication factor required (hint: 2***0@p***m)","type":"emailOtp","hint":"2***0@p***m"}
42 let body_str = match serde_json::to_string(&serde_json::json!({
43 "error": "second_authentication_factor_required",
44 "error_description": format!("emailOtp authentication factor required (hint: {})", masked_email),
···97 },
98 Err(err) => {
99 log::error!(
100- "Error during pre-auth check. This happens on the create_session endpoint when trying to decide if the user has access:\n {err}"
101 );
102 oauth_json_error_response(
103 StatusCode::BAD_REQUEST,
···36 "Invalid identifier or password",
37 ),
38 AuthResult::TwoFactorRequired(masked_email) => {
00039 let body_str = match serde_json::to_string(&serde_json::json!({
40 "error": "second_authentication_factor_required",
41 "error_description": format!("emailOtp authentication factor required (hint: {})", masked_email),
···94 },
95 Err(err) => {
96 log::error!(
97+ "Error during pre-auth check. This happens on the oauth signin endpoint when trying to decide if the user has access:\n {err}"
98 );
99 oauth_json_error_response(
100 StatusCode::BAD_REQUEST,