Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Email confirmation system #143

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

Kubaryt
Copy link
Member

@Kubaryt Kubaryt commented Feb 5, 2025

Resolves: #130

Features:

  • backend email confirmation
  • frontend email confirmation
  • also logo display in email template still to be fixed
  • add possibility to include sender name in email

frontend/app/pages/confirm.vue Outdated Show resolved Hide resolved
frontend/app/pages/confirm.vue Outdated Show resolved Hide resolved
backend/tests/auth.rs Outdated Show resolved Hide resolved
backend/src/utils/env.rs Show resolved Hide resolved
backend/src/utils/emails_assets/email_confirmation.html Outdated Show resolved Hide resolved
# Conflicts:
#	frontend/openapi/api/openapi.json

# Conflicts:
#	backend/src/utils/error.rs
…ed email on /login when parameter redirect_from_confirming is set to true, minor changes and fixes
@@ -0,0 +1,92 @@
<!DOCTYPE html>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add comment describing how it was generated

let smtp_client = &app_state.smtp_client;

let html = self.parse_placeholders()?;

let logo_attachment = Attachment::new_inline("hack4krak_logo".to_string()).body(
std::fs::read("src/utils/emails_assets/images/hack4krak_logo_black.webp")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use tokio, we don't want to lag entire thread :3

"user".to_string(),
"link".to_string(),
"link".to_string(),
"link".to_string(),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use replace all, do not define placeholders 3 times

("user".to_string(), register_json.name.clone()),
("link".to_string(), confirmation_link.clone()),
("link".to_string(), confirmation_link.clone()),
("link".to_string(), confirmation_link),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as somewhere else

.await?;

let confirmation_link = format!(
"{}/{}",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

format! ain't efficent, use push_srt

backend/src/models/user.rs Show resolved Hide resolved
use uuid::Uuid as uuid_gen;

#[derive(Serialize, Deserialize, Debug)]
pub struct UserInfo {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub struct UserInfo {
pub struct UserInformation {

ColumnDef::new(EmailConfirmation::ExpirationDate)
.timestamp()
.not_null()
.extra("DEFAULT NOW() + INTERVAL '30 minutes'".to_string()),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DB shouldn't be responsible for business logic... Move this + 30 to backend

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feat]: Email confirmation
2 participants