Show some errors to the user
This commit is contained in:
parent
5950fa7370
commit
ea75e1e3ee
@ -203,14 +203,11 @@ pub async fn process_edit_profile(
|
|||||||
id: Identity,
|
id: Identity,
|
||||||
user_id: web::Path<String>,
|
user_id: web::Path<String>,
|
||||||
) -> Result<HttpResponse, ServerError> {
|
) -> Result<HttpResponse, ServerError> {
|
||||||
if let Ok(query) = queries::update_user(&id, &user_id.0, &config, &data).await {
|
let query = queries::update_user(&id, &user_id.0, &config, &data).await?;
|
||||||
Ok(redirect_builder(&format!(
|
Ok(redirect_builder(&format!(
|
||||||
"admin/view/profile/{}",
|
"admin/view/profile/{}",
|
||||||
query.user.username
|
query.user.username
|
||||||
)))
|
)))
|
||||||
} else {
|
|
||||||
Ok(redirect_builder("/admin/index/"))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn download_png(
|
pub async fn download_png(
|
||||||
@ -263,10 +260,11 @@ pub async fn process_signup(
|
|||||||
id: Identity,
|
id: Identity,
|
||||||
) -> Result<HttpResponse, ServerError> {
|
) -> Result<HttpResponse, ServerError> {
|
||||||
slog_info!(config.log, "Creating a User: {:?}", &data);
|
slog_info!(config.log, "Creating a User: {:?}", &data);
|
||||||
if let Ok(item) = queries::create_user(&id, &data, &config).await {
|
match queries::create_user(&id, &data, &config).await {
|
||||||
|
Ok(item) => {
|
||||||
Ok(HttpResponse::Ok().body(format!("Successfully saved user: {}", item.item.username)))
|
Ok(HttpResponse::Ok().body(format!("Successfully saved user: {}", item.item.username)))
|
||||||
} else {
|
}
|
||||||
Ok(redirect_builder("/admin/login/"))
|
Err(e) => Err(e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user