Cleaning
This commit is contained in:
parent
198bff6e4a
commit
6f014ef238
19 changed files with 118 additions and 81 deletions
|
|
@ -5,7 +5,6 @@ use axum::{
|
|||
response::{Html, IntoResponse},
|
||||
};
|
||||
use serde::Deserialize;
|
||||
// use tracing::{event, Level};
|
||||
|
||||
use crate::{
|
||||
app::{Context, Result},
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use axum::response::Result;
|
||||
|
||||
use crate::{data::db, data::model, ron_utils::ron_error_not_autorized};
|
||||
use crate::{data::db, data::model, ron_utils::ron_error_not_authorized};
|
||||
|
||||
pub async fn check_user_rights_recipe(
|
||||
connection: &db::Connection,
|
||||
|
|
@ -9,7 +9,7 @@ pub async fn check_user_rights_recipe(
|
|||
) -> Result<()> {
|
||||
match user {
|
||||
Some(user) if connection.can_edit_recipe(user.id, recipe_id).await? => Ok(()),
|
||||
_ => Err(ron_error_not_autorized()),
|
||||
_ => Err(ron_error_not_authorized()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -20,7 +20,7 @@ pub async fn check_user_rights_recipe_group(
|
|||
) -> Result<()> {
|
||||
match user {
|
||||
Some(user) if connection.can_edit_recipe_group(user.id, group_id).await? => Ok(()),
|
||||
_ => Err(ron_error_not_autorized()),
|
||||
_ => Err(ron_error_not_authorized()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -37,7 +37,7 @@ pub async fn check_user_rights_recipe_groups(
|
|||
{
|
||||
Ok(())
|
||||
}
|
||||
_ => Err(ron_error_not_autorized()),
|
||||
_ => Err(ron_error_not_authorized()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -48,7 +48,7 @@ pub async fn check_user_rights_recipe_step(
|
|||
) -> Result<()> {
|
||||
match user {
|
||||
Some(user) if connection.can_edit_recipe_step(user.id, step_id).await? => Ok(()),
|
||||
_ => Err(ron_error_not_autorized()),
|
||||
_ => Err(ron_error_not_authorized()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -65,7 +65,7 @@ pub async fn check_user_rights_recipe_steps(
|
|||
{
|
||||
Ok(())
|
||||
}
|
||||
_ => Err(ron_error_not_autorized()),
|
||||
_ => Err(ron_error_not_authorized()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -82,7 +82,7 @@ pub async fn check_user_rights_recipe_ingredient(
|
|||
{
|
||||
Ok(())
|
||||
}
|
||||
_ => Err(ron_error_not_autorized()),
|
||||
_ => Err(ron_error_not_authorized()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -99,7 +99,7 @@ pub async fn check_user_rights_recipe_ingredients(
|
|||
{
|
||||
Ok(())
|
||||
}
|
||||
_ => Err(ron_error_not_autorized()),
|
||||
_ => Err(ron_error_not_authorized()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -116,6 +116,6 @@ pub async fn check_user_rights_shopping_list_entry(
|
|||
{
|
||||
Ok(())
|
||||
}
|
||||
_ => Err(ron_error_not_autorized()),
|
||||
_ => Err(ron_error_not_authorized()),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ use tracing::{error, warn};
|
|||
|
||||
use crate::{
|
||||
app::{AppState, Context, Result},
|
||||
config::Config,
|
||||
consts,
|
||||
data::db,
|
||||
email,
|
||||
|
|
@ -88,6 +89,7 @@ enum SignUpError {
|
|||
#[debug_handler(state = AppState)]
|
||||
pub async fn sign_up_post(
|
||||
Host(host): Host,
|
||||
State(config): State<Config>,
|
||||
State(connection): State<db::Connection>,
|
||||
State(email_service): State<Arc<dyn email::EmailServiceTrait>>,
|
||||
Extension(context): Extension<Context>,
|
||||
|
|
@ -171,6 +173,7 @@ pub async fn sign_up_post(
|
|||
let email = form_data.email.clone();
|
||||
match email_service
|
||||
.send_email(
|
||||
&config.email_address,
|
||||
&email,
|
||||
context.tr.t(Sentence::SignUpEmailTitle),
|
||||
&context.tr.tp(
|
||||
|
|
@ -385,7 +388,6 @@ pub async fn sign_in_post(
|
|||
#[debug_handler]
|
||||
pub async fn sign_out(
|
||||
State(connection): State<db::Connection>,
|
||||
Extension(context): Extension<Context>,
|
||||
req: Request<Body>,
|
||||
) -> Result<(CookieJar, Redirect)> {
|
||||
let mut jar = CookieJar::from_headers(req.headers());
|
||||
|
|
@ -450,6 +452,7 @@ enum AskResetPasswordError {
|
|||
#[debug_handler(state = AppState)]
|
||||
pub async fn ask_reset_password_post(
|
||||
Host(host): Host,
|
||||
State(config): State<Config>,
|
||||
State(connection): State<db::Connection>,
|
||||
State(email_service): State<Arc<dyn email::EmailServiceTrait>>,
|
||||
Extension(context): Extension<Context>,
|
||||
|
|
@ -522,6 +525,7 @@ pub async fn ask_reset_password_post(
|
|||
let url = utils::get_url_from_host(&host);
|
||||
match email_service
|
||||
.send_email(
|
||||
&config.email_address,
|
||||
&form_data.email,
|
||||
context.tr.t(Sentence::AskResetEmailTitle),
|
||||
&context.tr.tp(
|
||||
|
|
@ -755,6 +759,7 @@ enum ProfileUpdateError {
|
|||
#[debug_handler(state = AppState)]
|
||||
pub async fn edit_user_post(
|
||||
Host(host): Host,
|
||||
State(config): State<Config>,
|
||||
State(connection): State<db::Connection>,
|
||||
State(email_service): State<Arc<dyn email::EmailServiceTrait>>,
|
||||
Extension(context): Extension<Context>,
|
||||
|
|
@ -859,6 +864,7 @@ pub async fn edit_user_post(
|
|||
let email = form_data.email.clone();
|
||||
match email_service
|
||||
.send_email(
|
||||
&config.email_address,
|
||||
&email,
|
||||
context.tr.t(Sentence::ProfileFollowEmailTitle),
|
||||
&context.tr.tp(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue