From f42c7109fb11b6f3d47cea40e6ed7cfc4ee92fd2 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Sat, 10 Feb 2024 11:39:34 +0000 Subject: [PATCH] /api_login: use UserToken --- src/server.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/server.rs b/src/server.rs index 9d3fe9f..316bf8c 100644 --- a/src/server.rs +++ b/src/server.rs @@ -5,11 +5,12 @@ use axum::{ routing::{get, post}, Form, Json, Router, }; +use secrecy::ExposeSecret; use serde::{Deserialize, Serialize}; use tracing::{event, instrument, Level}; use crate::auth::AuthenticationError; -use crate::secrets::Password; +use crate::secrets::{Password, UserToken}; #[instrument] pub async fn run() -> color_eyre::Result<()> { @@ -71,9 +72,10 @@ async fn api_login( Form(LoginRequest { username, password }): Form, ) -> ApiResult> { event!(Level::WARN, "Creating dummy token"); + let user_token = UserToken("invalid".to_owned().into()); Ok(Json(LoginResponse { username, - token: "invalid".to_string(), + token: user_token.0.expose_secret().to_owned(), })) }