Compare commits
No commits in common. "b8a338d9baf681d2488dde6d0599a7018c790301" and "c2e28c3791647055dc8509ef30a0e3b401f088f5" have entirely different histories.
b8a338d9ba
...
c2e28c3791
2 changed files with 2 additions and 5 deletions
|
@ -15,7 +15,6 @@ mod process;
|
||||||
pub mod db;
|
pub mod db;
|
||||||
mod email;
|
mod email;
|
||||||
|
|
||||||
use std::env;
|
|
||||||
use std::string::ToString;
|
use std::string::ToString;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use std::sync::atomic::{AtomicI64, AtomicU64, Ordering};
|
use std::sync::atomic::{AtomicI64, AtomicU64, Ordering};
|
||||||
|
@ -37,8 +36,6 @@ pub static SMTP_URL: Lazy<String> = Lazy::new(|| std::env::var("SMTP_URL").expec
|
||||||
pub static SMTP_USERNAME: Lazy<String> = Lazy::new(|| std::env::var("SMTP_USERNAME").expect("NO SMTP_USERNAME DEFINED"));
|
pub static SMTP_USERNAME: Lazy<String> = Lazy::new(|| std::env::var("SMTP_USERNAME").expect("NO SMTP_USERNAME DEFINED"));
|
||||||
pub static SMTP_PASSWORD: Lazy<String> = Lazy::new(|| std::env::var("SMTP_PASSWORD").expect("NO SMTP_PASSWORD DEFINED"));
|
pub static SMTP_PASSWORD: Lazy<String> = Lazy::new(|| std::env::var("SMTP_PASSWORD").expect("NO SMTP_PASSWORD DEFINED"));
|
||||||
|
|
||||||
pub static AUTH_URL: Lazy<String> = Lazy::new(|| std::env::var("AUTH_URL").unwrap_or("https://auth.asklyphe.com".to_string()));
|
|
||||||
|
|
||||||
pub static PROCESSES_HANDLED: AtomicU64 = AtomicU64::new(0);
|
pub static PROCESSES_HANDLED: AtomicU64 = AtomicU64::new(0);
|
||||||
pub static LAST_MESSAGE: AtomicI64 = AtomicI64::new(0);
|
pub static LAST_MESSAGE: AtomicI64 = AtomicI64::new(0);
|
||||||
|
|
||||||
|
|
|
@ -21,7 +21,7 @@ use crate::db::{invite_code, session, user};
|
||||||
use crate::db::invite_code::ConsumeInviteCodeError;
|
use crate::db::invite_code::ConsumeInviteCodeError;
|
||||||
use crate::db::session::{CreateSessionError, DeleteSessionError, FetchSessionError};
|
use crate::db::session::{CreateSessionError, DeleteSessionError, FetchSessionError};
|
||||||
use crate::db::user::{CreateUserError, DeleteUserError, EmailChangeError, FetchUserError, RegisterVerificationCodeError, VerifyEmailPassComboError, VerifyVerificationCodeError};
|
use crate::db::user::{CreateUserError, DeleteUserError, EmailChangeError, FetchUserError, RegisterVerificationCodeError, VerifyEmailPassComboError, VerifyVerificationCodeError};
|
||||||
use crate::{email, AUTH_URL};
|
use crate::email;
|
||||||
|
|
||||||
fn generate_email_verification_code() -> String {
|
fn generate_email_verification_code() -> String {
|
||||||
rand::thread_rng()
|
rand::thread_rng()
|
||||||
|
@ -121,7 +121,7 @@ pub async fn register_request(db: &DatabaseConnection, request: RegisterRequest)
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("verification code for {} is \"{}\"", request.username, verification_code);
|
debug!("verification code for {} is \"{}\"", request.username, verification_code);
|
||||||
email::send_verification_code_email(&request.email, &request.username, format!("{}/verify?username={}&token={}", AUTH_URL.as_str(), request.username, verification_code).as_str());
|
email::send_verification_code_email(&request.email, &request.username, format!("https://auth.asklyphe.com/verify?username={}&token={}", request.username, verification_code).as_str());
|
||||||
|
|
||||||
RegisterResponse::Success
|
RegisterResponse::Success
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue