Moved login and register to users

This commit is contained in:
StNicolay 2024-08-04 12:38:50 +03:00
parent 7669a02a95
commit ea5c65b6e5
Signed by: StNicolay
GPG Key ID: 9693D04DCD962B0D
6 changed files with 6 additions and 7 deletions

View File

@ -1,2 +0,0 @@
pub mod auth_post;
pub mod register;

View File

@ -1,4 +1,3 @@
pub mod authorization;
pub mod file;
pub mod folder;
pub mod permissions;

View File

@ -11,7 +11,7 @@ pub struct Params {
password: String,
}
pub async fn post(
pub async fn login(
State(pool): State<Pool>,
Form(payload): Form<Params>,
) -> Result<Json<Token>, Error> {

View File

@ -1,4 +1,6 @@
pub mod delete;
pub mod get;
pub mod login;
pub mod put;
pub mod register;
pub mod search;

View File

@ -74,7 +74,7 @@ async fn main() -> anyhow::Result<()> {
fn app(state: AppState) -> Router {
use axum::{http::header, routing::get};
use endpoints::{
authorization, file, folder,
file, folder,
permissions::{self, get_top_level::get_top_level},
users,
};
@ -121,8 +121,8 @@ fn app(state: AppState) -> Router {
)
.route("/users/current", get(users::get::current))
.route("/users/search", get(users::search::search))
.route("/register", post(authorization::register::register))
.route("/authorize", post(authorization::auth_post::post))
.route("/users/register", post(users::register::register))
.route("/users/authorize", post(users::login::login))
.layer(middleware)
.with_state(state)
}