diff --git a/src/database/entities/channel.rs b/src/database/entities/channel.rs
index 63759f86cbb781cd6fb58d41e183de508e7c1c03..3ee927a122ba196b9573c3dfef407234d5c37429 100644
--- a/src/database/entities/channel.rs
+++ b/src/database/entities/channel.rs
@@ -79,8 +79,12 @@ impl Channel {
     pub async fn publish_update(&self, data: JsonValue) -> Result<()> {
         let id = self.id().to_string();
         ClientboundNotification::ChannelUpdate {
-            id: id.clone(), data
-        }.publish(id).await.ok();
+            id: id.clone(),
+            data,
+        }
+        .publish(id)
+        .await
+        .ok();
 
         Ok(())
     }
diff --git a/src/database/entities/message.rs b/src/database/entities/message.rs
index 91349a4ad90a98445a7a09ce77ad237c3d98a555..8f8fbe75dfa5c939ccb6de4d62bf3d9dc7de07b5 100644
--- a/src/database/entities/message.rs
+++ b/src/database/entities/message.rs
@@ -48,46 +48,48 @@ impl Message {
         let channels = get_collection("channels");
         match channel {
             Channel::DirectMessage { id, .. } => {
-                channels.update_one(
-                    doc! { "_id": id },
-                    doc! {
-                        "$set": {
-                            "active": true,
-                            "last_message": {
-                                "_id": self.id.clone(),
-                                "author": self.author.clone(),
-                                "short": self.content.chars().take(24).collect::<String>()
+                channels
+                    .update_one(
+                        doc! { "_id": id },
+                        doc! {
+                            "$set": {
+                                "active": true,
+                                "last_message": {
+                                    "_id": self.id.clone(),
+                                    "author": self.author.clone(),
+                                    "short": self.content.chars().take(24).collect::<String>()
+                                }
                             }
-                        }
-                    },
-                    None
-                )
-                .await
-                .map_err(|_| Error::DatabaseError {
-                    operation: "update_one",
-                    with: "channel",
-                })?;
-            },
+                        },
+                        None,
+                    )
+                    .await
+                    .map_err(|_| Error::DatabaseError {
+                        operation: "update_one",
+                        with: "channel",
+                    })?;
+            }
             Channel::Group { id, .. } => {
-                channels.update_one(
-                    doc! { "_id": id },
-                    doc! {
-                        "$set": {
-                            "last_message": {
-                                "_id": self.id.clone(),
-                                "author": self.author.clone(),
-                                "short": self.content.chars().take(24).collect::<String>()
+                channels
+                    .update_one(
+                        doc! { "_id": id },
+                        doc! {
+                            "$set": {
+                                "last_message": {
+                                    "_id": self.id.clone(),
+                                    "author": self.author.clone(),
+                                    "short": self.content.chars().take(24).collect::<String>()
+                                }
                             }
-                        }
-                    },
-                    None
-                )
-                .await
-                .map_err(|_| Error::DatabaseError {
-                    operation: "update_one",
-                    with: "channel",
-                })?;
-            },
+                        },
+                        None,
+                    )
+                    .await
+                    .map_err(|_| Error::DatabaseError {
+                        operation: "update_one",
+                        with: "channel",
+                    })?;
+            }
             _ => {}
         }
 
@@ -102,8 +104,12 @@ impl Message {
     pub async fn publish_update(&self, data: JsonValue) -> Result<()> {
         let channel = self.channel.clone();
         ClientboundNotification::MessageUpdate {
-            id: self.id.clone(), data
-        }.publish(channel).await.ok();
+            id: self.id.clone(),
+            data,
+        }
+        .publish(channel)
+        .await
+        .ok();
 
         Ok(())
     }
diff --git a/src/database/guards/user.rs b/src/database/guards/user.rs
index e021101ea5f6307a7441b5a38b09437dbc2397e4..1f44115f3c5d83dd4f88545ab48936b66a6c428c 100644
--- a/src/database/guards/user.rs
+++ b/src/database/guards/user.rs
@@ -29,7 +29,10 @@ impl<'a, 'r> FromRequest<'a, 'r> for User {
         } else {
             Outcome::Failure((
                 Status::InternalServerError,
-                rauth::util::Error::DatabaseError { operation: "find_one", with: "user" },
+                rauth::util::Error::DatabaseError {
+                    operation: "find_one",
+                    with: "user",
+                },
             ))
         }
     }
diff --git a/src/database/migrations/scripts.rs b/src/database/migrations/scripts.rs
index 7ebcb5c9ee0f743644cc77a97947a52f2cc27554..2c8d6eab01f7fa16928c429af8476cb4e7370ae6 100644
--- a/src/database/migrations/scripts.rs
+++ b/src/database/migrations/scripts.rs
@@ -1,9 +1,7 @@
-use super::super::{get_collection, get_db};
+use crate::database::get_collection;
 
-use crate::rocket::futures::StreamExt;
 use log::info;
 use mongodb::bson::{doc, from_document};
-use mongodb::options::FindOptions;
 use serde::{Deserialize, Serialize};
 
 #[derive(Serialize, Deserialize)]
diff --git a/src/main.rs b/src/main.rs
index 79109f2c92af240bacf3aeb0f458420488730a27..690a8ab41eb49b029193e9ab8231c7559e0c0e44 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -18,10 +18,13 @@ pub mod notifications;
 pub mod routes;
 pub mod util;
 
+use chrono::Duration;
 use futures::join;
 use log::info;
-use rauth::{self, options::Options};
+use rauth::auth::Auth;
+use rauth::options::{EmailVerification, Options, SMTP};
 use rocket_cors::AllowedOrigins;
+use util::variables::{PUBLIC_URL, SMTP_FROM, SMTP_HOST, SMTP_PASSWORD, SMTP_USERNAME, USE_EMAIL};
 
 #[async_std::main]
 async fn main() {
@@ -55,7 +58,27 @@ async fn launch_web() {
     .to_cors()
     .expect("Failed to create CORS.");
 
-    let auth = rauth::auth::Auth::new(database::get_collection("accounts"), Options::new());
+    let auth = Auth::new(
+        database::get_collection("accounts"),
+        Options::new()
+            .base_url(format!("{}/auth", *PUBLIC_URL))
+            .email_verification(if *USE_EMAIL {
+                EmailVerification::Enabled {
+                    success_redirect_uri: format!("{}/welcome", *PUBLIC_URL),
+                    verification_expiry: Duration::days(1),
+                    verification_ratelimit: Duration::minutes(1),
+
+                    smtp: SMTP {
+                        from: (*SMTP_FROM).to_string(),
+                        host: (*SMTP_HOST).to_string(),
+                        username: (*SMTP_USERNAME).to_string(),
+                        password: (*SMTP_PASSWORD).to_string(),
+                    },
+                }
+            } else {
+                EmailVerification::Disabled
+            }),
+    );
 
     routes::mount(rocket::ignite())
         .mount("/", rocket_cors::catch_all_options_routes())
diff --git a/src/notifications/events.rs b/src/notifications/events.rs
index 92c161e999de4cd166d5cb4d1cc00aac24590bd5..b21ffcac8571cfd14f23d0e88dada623f368dd30 100644
--- a/src/notifications/events.rs
+++ b/src/notifications/events.rs
@@ -41,7 +41,7 @@ pub enum ClientboundNotification {
     Message(Message),
     MessageUpdate {
         id: String,
-        data: JsonValue
+        data: JsonValue,
     },
     MessageDelete {
         id: String,
@@ -50,7 +50,7 @@ pub enum ClientboundNotification {
     ChannelCreate(Channel),
     ChannelUpdate {
         id: String,
-        data: JsonValue
+        data: JsonValue,
     },
     ChannelGroupJoin {
         id: String,
diff --git a/src/notifications/websocket.rs b/src/notifications/websocket.rs
index df4099b43940d4783ddb9fa7789bf2057a6d2ac0..841c437560f15f7f0e7634329409fc00c64f3cae 100644
--- a/src/notifications/websocket.rs
+++ b/src/notifications/websocket.rs
@@ -12,7 +12,10 @@ use futures::{pin_mut, prelude::*};
 use hive_pubsub::PubSub;
 use log::{debug, info};
 use many_to_many::ManyToMany;
-use rauth::{auth::{Auth, Session}, options::Options};
+use rauth::{
+    auth::{Auth, Session},
+    options::Options,
+};
 use std::collections::HashMap;
 use std::net::SocketAddr;
 use std::sync::{Arc, Mutex, RwLock};
@@ -84,9 +87,10 @@ async fn accept(stream: TcpStream) {
                             }
                         }
 
-                        if let Ok(validated_session) = Auth::new(get_collection("accounts"), Options::new())
-                            .verify_session(new_session)
-                            .await
+                        if let Ok(validated_session) =
+                            Auth::new(get_collection("accounts"), Options::new())
+                                .verify_session(new_session)
+                                .await
                         {
                             let id = validated_session.user_id.clone();
                             if let Ok(user) = (Ref { id: id.clone() }).fetch_user().await {
diff --git a/src/routes/channels/group_create.rs b/src/routes/channels/group_create.rs
index 65d6a16af59b95446069883c6204a29adf67a23e..c979b01224da1f812e9cef2e2deb686efe3ba26a 100644
--- a/src/routes/channels/group_create.rs
+++ b/src/routes/channels/group_create.rs
@@ -70,7 +70,7 @@ pub async fn req(user: User, info: Json<Data>) -> Result<JsonValue> {
             .unwrap_or_else(|| "A group.".to_string()),
         owner: user.id,
         recipients: set.into_iter().collect::<Vec<String>>(),
-        last_message: None
+        last_message: None,
     };
 
     channel.clone().publish().await?;
diff --git a/src/routes/onboard/complete.rs b/src/routes/onboard/complete.rs
index 1711c127fb602ffa58beaa75f6547ff995c70b25..45f30d7d6d7f67937dc7d3808a2ca18c1dc154cf 100644
--- a/src/routes/onboard/complete.rs
+++ b/src/routes/onboard/complete.rs
@@ -27,7 +27,7 @@ pub async fn req(session: Session, user: Option<User>, data: Json<Data>) -> Resu
 
     data.validate()
         .map_err(|error| Error::FailedValidation { error })?;
-    
+
     if data.username == "revolt" {
         Err(Error::UsernameTaken)?
     }
diff --git a/src/routes/users/open_dm.rs b/src/routes/users/open_dm.rs
index d36b6648ce3af3e03d13e92a4ce22334fd57626d..4712cba8ae51ef5c052d3d170c96260daf690844 100644
--- a/src/routes/users/open_dm.rs
+++ b/src/routes/users/open_dm.rs
@@ -40,7 +40,7 @@ pub async fn req(user: User, target: Ref) -> Result<JsonValue> {
                 id,
                 active: false,
                 recipients: vec![user.id, target.id],
-                last_message: None
+                last_message: None,
             }
         };