Use log crate for logging instead of println
All checks were successful
Core Repos/ImageApi/pipeline/head This commit looks good
Core Repos/ImageApi/pipeline/pr-master This commit looks good

This commit is contained in:
Cameron Cordes
2021-02-24 21:26:11 -05:00
parent 8b5ba9d48c
commit f9983240df
7 changed files with 86 additions and 17 deletions

View File

@@ -2,6 +2,7 @@ use actix_web::web::{HttpResponse, Json};
use actix_web::{post, Responder};
use chrono::{Duration, Utc};
use jsonwebtoken::{encode, EncodingKey, Header};
use log::debug;
use crate::data::LoginRequest;
use crate::data::{secret_key, Claims, CreateAccountRequest, Token};
@@ -24,7 +25,7 @@ async fn register(user: Json<CreateAccountRequest>) -> impl Responder {
#[post("/login")]
async fn login(creds: Json<LoginRequest>) -> impl Responder {
println!("Logging in: {}", creds.username);
debug!("Logging in: {}", creds.username);
if let Some(user) = get_user(&creds.username, &creds.password) {
let claims = Claims {
sub: user.id.to_string(),