Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/defguard_core/src/handlers/openid_flow.rs
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ pub async fn secure_authorization(
&mut conn,
Some(&session_info.session.into()),
&oauth2client.name,
&session_info.user.username,
)
.await?;
}
Expand Down
3 changes: 2 additions & 1 deletion crates/defguard_mail/src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,11 @@ pub async fn new_device_oidc_login_mail(
conn: &mut PgConnection,
session: Option<&SessionContext>,
oauth2client_name: &str,
username: &str,
) -> Result<(), TemplateError> {
let (mut tera, mut context) = get_base_tera_mjml(Context::new(), session, None, None)?;

let url = format!("{}me", Settings::url()?);
let url = format!("{}user/{}", Settings::url()?, username);
context.insert("oauth2client_name", &oauth2client_name);
context.insert("profile_url", &url);

Expand Down
2 changes: 2 additions & 0 deletions crates/defguard_mail/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,13 @@ fn send_new_device_oidc_login_mail(_: PgPoolOptions, options: PgConnectOptions)

let mut conn = pool.begin().await.unwrap();
let client_name = "RemoteApp";
let username = "testuser";
templates::new_device_oidc_login_mail(
&env::var("SMTP_TO").unwrap(),
&mut conn,
None,
client_name,
username,
)
.await
.unwrap();
Expand Down
4 changes: 2 additions & 2 deletions migrations/20251218140442_[2.0.0]_initial.up.sql
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ CREATE TABLE mail_context (
);

INSERT INTO mail_context (template, section, language_tag, text) VALUES
('desktop-start', 'title', 'en_US', 'You''re receiving this email to configure a new desktop client.'),
('desktop-start', 'title', 'en_US', 'You''re receiving this email to configure a new desktop client'),
('desktop-start', 'subtitle', 'en_US', 'Please paste this URL and token in your desktop client:'),
('desktop-start', 'label_url', 'en_US', 'URL'),
('desktop-start', 'label_token', 'en_US', 'Token'),
Expand Down Expand Up @@ -343,7 +343,7 @@ INSERT INTO mail_context (template, section, language_tag, text) VALUES
('new-device-login', 'label_device', 'en_US', 'Device name:'),
('new-device-login', 'label_date', 'en_US', 'Date:'),
('new-device-oidc-login', 'title', 'en_US', 'Your account was just logged into a system using OpenID Connect authorization'),
('new-device-oidc-login', 'subtitle', 'en_US', 'You can deauthorize all applications that have access to your account from the web vault under (My Profile > Apps).'),
('new-device-oidc-login', 'subtitle', 'en_US', 'You can deauthorize all applications that have access to your account from the web vault under (Profile > Authorized Apps).'),
('new-device-oidc-login', 'label_profile', 'en_US', 'Profile URL:'),
('new-device-oidc-login', 'label_oauth2client', 'en_US', 'System name:'),
('password-reset', 'title', 'en_US', 'Password reset'),
Expand Down
Loading