aboutsummaryrefslogtreecommitdiff
path: root/src/controller/login.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/controller/login.rs')
-rw-r--r--src/controller/login.rs14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/controller/login.rs b/src/controller/login.rs
index 036e6fc..dd50a3a 100644
--- a/src/controller/login.rs
+++ b/src/controller/login.rs
@@ -1,6 +1,8 @@
use bcrypt;
+use http_body_util::Full;
+use hyper::body::Bytes;
use hyper::header::SET_COOKIE;
-use hyper::{Body, Response};
+use hyper::Response;
use sqlx::sqlite::SqlitePool;
use std::collections::HashMap;
use tera::{Context, Tera};
@@ -18,7 +20,7 @@ pub async fn page(
assets: &HashMap<String, String>,
templates: &Tera,
error: Option<&str>,
-) -> Response<Body> {
+) -> Response<Full<Bytes>> {
let connected_user: Option<User> = None;
let mut context = Context::new();
@@ -34,7 +36,7 @@ pub async fn login(
templates: &Tera,
form: HashMap<String, String>,
pool: SqlitePool,
-) -> Response<Body> {
+) -> Response<Full<Bytes>> {
match validation::login::login(&form) {
Some(login) => {
match db::users::get_password_hash(&pool, login.email.clone()).await
@@ -88,14 +90,14 @@ async fn server_error(
assets: &HashMap<String, String>,
templates: &Tera,
msg: &str,
-) -> Response<Body> {
+) -> Response<Full<Bytes>> {
page(assets, templates, Some(msg)).await
}
async fn not_authorized(
assets: &HashMap<String, String>,
templates: &Tera,
-) -> Response<Body> {
+) -> Response<Full<Bytes>> {
page(
assets,
templates,
@@ -104,7 +106,7 @@ async fn not_authorized(
.await
}
-pub async fn logout(config: &Config, wallet: &Wallet) -> Response<Body> {
+pub async fn logout(config: &Config, wallet: &Wallet) -> Response<Full<Bytes>> {
if db::users::remove_login_token(&wallet.pool, wallet.user.id).await {
with_headers(
utils::redirect("/"),