mirror of
				https://github.com/nitnelave/lldap.git
				synced 2023-04-12 14:25:13 +00:00 
			
		
		
		
	Merge branch 'main' into owners
This commit is contained in:
		
						commit
						1736ad057e
					
				@ -177,7 +177,13 @@ impl App {
 | 
				
			|||||||
                Some(AppRoute::StartResetPassword | AppRoute::FinishResetPassword { token: _ }),
 | 
					                Some(AppRoute::StartResetPassword | AppRoute::FinishResetPassword { token: _ }),
 | 
				
			||||||
                _,
 | 
					                _,
 | 
				
			||||||
                _,
 | 
					                _,
 | 
				
			||||||
            ) if self.password_reset_enabled == Some(false) => Some(AppRoute::Login),
 | 
					            ) => {
 | 
				
			||||||
 | 
					                if self.password_reset_enabled == Some(false) {
 | 
				
			||||||
 | 
					                    Some(AppRoute::Login)
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    None
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
            (None, _, _) | (_, None, _) => Some(AppRoute::Login),
 | 
					            (None, _, _) | (_, None, _) => Some(AppRoute::Login),
 | 
				
			||||||
            // User is logged in, a URL was given, don't redirect.
 | 
					            // User is logged in, a URL was given, don't redirect.
 | 
				
			||||||
            (_, Some(_), Some(_)) => None,
 | 
					            (_, Some(_), Some(_)) => None,
 | 
				
			||||||
 | 
				
			|||||||
@ -18,7 +18,7 @@ use hmac::Hmac;
 | 
				
			|||||||
use jwt::{SignWithKey, VerifyWithKey};
 | 
					use jwt::{SignWithKey, VerifyWithKey};
 | 
				
			||||||
use sha2::Sha512;
 | 
					use sha2::Sha512;
 | 
				
			||||||
use time::ext::NumericalDuration;
 | 
					use time::ext::NumericalDuration;
 | 
				
			||||||
use tracing::{debug, instrument, warn};
 | 
					use tracing::{debug, info, instrument, warn};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use lldap_auth::{login, password_reset, registration, JWTClaims};
 | 
					use lldap_auth::{login, password_reset, registration, JWTClaims};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -183,6 +183,7 @@ where
 | 
				
			|||||||
    .await
 | 
					    .await
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        warn!("Error sending email: {:#?}", e);
 | 
					        warn!("Error sending email: {:#?}", e);
 | 
				
			||||||
 | 
					        info!("Reset token: {}", token);
 | 
				
			||||||
        return Err(TcpError::InternalServerError(format!(
 | 
					        return Err(TcpError::InternalServerError(format!(
 | 
				
			||||||
            "Could not send email: {}",
 | 
					            "Could not send email: {}",
 | 
				
			||||||
            e
 | 
					            e
 | 
				
			||||||
 | 
				
			|||||||
@ -132,6 +132,10 @@ pub enum SmtpEncryption {
 | 
				
			|||||||
#[derive(Debug, Parser, Clone)]
 | 
					#[derive(Debug, Parser, Clone)]
 | 
				
			||||||
#[clap(next_help_heading = Some("SMTP"))]
 | 
					#[clap(next_help_heading = Some("SMTP"))]
 | 
				
			||||||
pub struct SmtpOpts {
 | 
					pub struct SmtpOpts {
 | 
				
			||||||
 | 
					    /// Enable password reset.
 | 
				
			||||||
 | 
					    #[clap(long, env = "LLDAP_SMTP_OPTIONS__ENABLE_PASSWORD_RESET")]
 | 
				
			||||||
 | 
					    pub smtp_enable_password_reset: Option<bool>,
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /// Sender email address.
 | 
					    /// Sender email address.
 | 
				
			||||||
    #[clap(long, env = "LLDAP_SMTP_OPTIONS__FROM")]
 | 
					    #[clap(long, env = "LLDAP_SMTP_OPTIONS__FROM")]
 | 
				
			||||||
    pub smtp_from: Option<Mailbox>,
 | 
					    pub smtp_from: Option<Mailbox>,
 | 
				
			||||||
 | 
				
			|||||||
@ -276,6 +276,9 @@ impl ConfigOverrider for SmtpOpts {
 | 
				
			|||||||
        if let Some(tls_required) = self.smtp_tls_required {
 | 
					        if let Some(tls_required) = self.smtp_tls_required {
 | 
				
			||||||
            config.smtp_options.tls_required = Some(tls_required);
 | 
					            config.smtp_options.tls_required = Some(tls_required);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        if let Some(enable_password_reset) = self.smtp_enable_password_reset {
 | 
				
			||||||
 | 
					            config.smtp_options.enable_password_reset = enable_password_reset;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
		Reference in New Issue
	
	Block a user