aboutsummaryrefslogtreecommitdiff
path: root/src/controller
diff options
context:
space:
mode:
Diffstat (limited to 'src/controller')
-rw-r--r--src/controller/login.rs3
-rw-r--r--src/controller/utils.rs4
2 files changed, 4 insertions, 3 deletions
diff --git a/src/controller/login.rs b/src/controller/login.rs
index d01f799..f7e0695 100644
--- a/src/controller/login.rs
+++ b/src/controller/login.rs
@@ -44,7 +44,8 @@ pub async fn login(
{
Some(hash) => match bcrypt::verify(login.password, &hash) {
Ok(true) => {
- let login_token = cookie::generate_token();
+ // TODO: error handling
+ let login_token = cookie::generate_token().unwrap();
if db::users::set_login_token(
&db_conn,
diff --git a/src/controller/utils.rs b/src/controller/utils.rs
index 340a5c7..ccef33c 100644
--- a/src/controller/utils.rs
+++ b/src/controller/utils.rs
@@ -71,8 +71,8 @@ fn server_error(
)
}
-pub fn text(str: String) -> Response<Full<Bytes>> {
- let mut response = Response::new(str.into());
+pub fn text(str: impl Into<String>) -> Response<Full<Bytes>> {
+ let mut response = Response::new(str.into().into());
*response.status_mut() = StatusCode::OK;
response
}