mirror of
https://github.com/juspay/hyperswitch.git
synced 2025-10-28 04:04:55 +08:00
refactor(users): Move hardcoded email subjects to constants (#6110)
This commit is contained in:
@ -87,6 +87,11 @@ pub const EMAIL_TOKEN_TIME_IN_SECS: u64 = 60 * 60 * 24; // 1 day
|
||||
#[cfg(feature = "email")]
|
||||
pub const EMAIL_TOKEN_BLACKLIST_PREFIX: &str = "BET_";
|
||||
|
||||
pub const EMAIL_SUBJECT_API_KEY_EXPIRY: &str = "API Key Expiry Notice";
|
||||
pub const EMAIL_SUBJECT_DASHBOARD_FEATURE_REQUEST: &str = "Dashboard Pro Feature Request by";
|
||||
pub const EMAIL_SUBJECT_APPROVAL_RECON_REQUEST: &str =
|
||||
"Approval of Recon Request - Access Granted to Recon Dashboard";
|
||||
|
||||
pub const ROLE_INFO_CACHE_PREFIX: &str = "CR_INFO_";
|
||||
|
||||
#[cfg(feature = "olap")]
|
||||
|
||||
@ -26,3 +26,10 @@ pub const REDIS_TOTP_SECRET_TTL_IN_SECS: i64 = 15 * 60; // 15 minutes
|
||||
|
||||
pub const REDIS_SSO_PREFIX: &str = "SSO_";
|
||||
pub const REDIS_SSO_TTL: i64 = 5 * 60; // 5 minutes
|
||||
|
||||
/// Email subject
|
||||
pub const EMAIL_SUBJECT_SIGNUP: &str = "Welcome to the Hyperswitch community!";
|
||||
pub const EMAIL_SUBJECT_INVITATION: &str = "You have been invited to join Hyperswitch Community!";
|
||||
pub const EMAIL_SUBJECT_MAGIC_LINK: &str = "Unlock Hyperswitch: Use Your Magic Link to Sign In";
|
||||
pub const EMAIL_SUBJECT_RESET_PASSWORD: &str = "Get back to Hyperswitch - Reset Your Password Now";
|
||||
pub const EMAIL_SUBJECT_NEW_PROD_INTENT: &str = "New Prod Intent";
|
||||
|
||||
@ -39,7 +39,8 @@ pub async fn send_recon_request(
|
||||
.attach_printable("Failed to convert recipient's email to UserEmail")?,
|
||||
settings: state.conf.clone(),
|
||||
subject: format!(
|
||||
"Dashboard Pro Feature Request by {}",
|
||||
"{} {}",
|
||||
consts::EMAIL_SUBJECT_DASHBOARD_FEATURE_REQUEST,
|
||||
user_email.expose().peek()
|
||||
),
|
||||
};
|
||||
@ -145,7 +146,7 @@ pub async fn recon_merchant_account_update(
|
||||
.change_context(errors::ApiErrorResponse::InternalServerError)
|
||||
.attach_printable("Failed to form username")?,
|
||||
settings: state.conf.clone(),
|
||||
subject: "Approval of Recon Request - Access Granted to Recon Dashboard",
|
||||
subject: consts::EMAIL_SUBJECT_APPROVAL_RECON_REQUEST,
|
||||
};
|
||||
|
||||
if req.recon_status == enums::ReconStatus::Active {
|
||||
|
||||
@ -74,7 +74,7 @@ pub async fn signup_with_merchant_id(
|
||||
recipient_email: user_from_db.get_email().try_into()?,
|
||||
user_name: domain::UserName::new(user_from_db.get_name())?,
|
||||
settings: state.conf.clone(),
|
||||
subject: "Get back to Hyperswitch - Reset Your Password Now",
|
||||
subject: consts::user::EMAIL_SUBJECT_RESET_PASSWORD,
|
||||
auth_id,
|
||||
};
|
||||
|
||||
@ -202,7 +202,7 @@ pub async fn connect_account(
|
||||
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
|
||||
settings: state.conf.clone(),
|
||||
user_name: domain::UserName::new(user_from_db.get_name())?,
|
||||
subject: "Unlock Hyperswitch: Use Your Magic Link to Sign In",
|
||||
subject: consts::user::EMAIL_SUBJECT_MAGIC_LINK,
|
||||
auth_id,
|
||||
};
|
||||
|
||||
@ -251,7 +251,7 @@ pub async fn connect_account(
|
||||
let email_contents = email_types::VerifyEmail {
|
||||
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
|
||||
settings: state.conf.clone(),
|
||||
subject: "Welcome to the Hyperswitch community!",
|
||||
subject: consts::user::EMAIL_SUBJECT_SIGNUP,
|
||||
auth_id,
|
||||
};
|
||||
|
||||
@ -371,7 +371,7 @@ pub async fn forgot_password(
|
||||
recipient_email: domain::UserEmail::from_pii_email(user_from_db.get_email())?,
|
||||
settings: state.conf.clone(),
|
||||
user_name: domain::UserName::new(user_from_db.get_name())?,
|
||||
subject: "Get back to Hyperswitch - Reset Your Password Now",
|
||||
subject: consts::user::EMAIL_SUBJECT_RESET_PASSWORD,
|
||||
auth_id,
|
||||
};
|
||||
|
||||
@ -709,7 +709,7 @@ async fn handle_existing_user_invitation(
|
||||
recipient_email: invitee_email,
|
||||
user_name: domain::UserName::new(invitee_user_from_db.get_name())?,
|
||||
settings: state.conf.clone(),
|
||||
subject: "You have been invited to join Hyperswitch Community!",
|
||||
subject: consts::user::EMAIL_SUBJECT_INVITATION,
|
||||
entity,
|
||||
auth_id: auth_id.clone(),
|
||||
};
|
||||
@ -840,7 +840,7 @@ async fn handle_new_user_invitation(
|
||||
recipient_email: invitee_email,
|
||||
user_name: domain::UserName::new(new_user.get_name())?,
|
||||
settings: state.conf.clone(),
|
||||
subject: "You have been invited to join Hyperswitch Community!",
|
||||
subject: consts::user::EMAIL_SUBJECT_INVITATION,
|
||||
entity,
|
||||
auth_id: auth_id.clone(),
|
||||
};
|
||||
@ -959,7 +959,7 @@ pub async fn resend_invite(
|
||||
recipient_email: invitee_email,
|
||||
user_name: domain::UserName::new(user.get_name())?,
|
||||
settings: state.conf.clone(),
|
||||
subject: "You have been invited to join Hyperswitch Community!",
|
||||
subject: consts::user::EMAIL_SUBJECT_INVITATION,
|
||||
entity: email_types::Entity {
|
||||
entity_id,
|
||||
entity_type,
|
||||
@ -1498,7 +1498,7 @@ pub async fn send_verification_mail(
|
||||
let email_contents = email_types::VerifyEmail {
|
||||
recipient_email: domain::UserEmail::from_pii_email(user.email)?,
|
||||
settings: state.conf.clone(),
|
||||
subject: "Welcome to the Hyperswitch community!",
|
||||
subject: consts::user::EMAIL_SUBJECT_SIGNUP,
|
||||
auth_id,
|
||||
};
|
||||
|
||||
|
||||
@ -417,7 +417,7 @@ impl BizEmailProd {
|
||||
state.conf.email.prod_intent_recipient_email.clone(),
|
||||
)?,
|
||||
settings: state.conf.clone(),
|
||||
subject: "New Prod Intent",
|
||||
subject: consts::user::EMAIL_SUBJECT_NEW_PROD_INTENT,
|
||||
user_name: data.poc_name.unwrap_or_default().into(),
|
||||
poc_email: data.poc_email.unwrap_or_default().into(),
|
||||
legal_business_name: data.legal_business_name.unwrap_or_default(),
|
||||
|
||||
@ -6,7 +6,7 @@ use router_env::{logger, metrics::add_attributes};
|
||||
use scheduler::{workflows::ProcessTrackerWorkflow, SchedulerSessionState};
|
||||
|
||||
use crate::{
|
||||
errors,
|
||||
consts, errors,
|
||||
logger::error,
|
||||
routes::{metrics, SessionState},
|
||||
services::email::types::ApiKeyExpiryReminder,
|
||||
@ -81,7 +81,7 @@ impl ProcessTrackerWorkflow<SessionState> for ApiKeyExpiryWorkflow {
|
||||
);
|
||||
errors::ProcessTrackerError::EApiErrorResponse
|
||||
})?,
|
||||
subject: "API Key Expiry Notice",
|
||||
subject: consts::EMAIL_SUBJECT_API_KEY_EXPIRY,
|
||||
expires_in: *expires_in,
|
||||
api_key_name,
|
||||
prefix,
|
||||
|
||||
Reference in New Issue
Block a user