Add a way to reset password (WIP)
This commit is contained in:
parent
ebdcb6a90a
commit
5d343c273f
8 changed files with 265 additions and 12 deletions
|
|
@ -249,7 +249,7 @@ pub async fn sign_up_post(
|
|||
}
|
||||
.to_string(),
|
||||
message: match error {
|
||||
SignUpError::UserAlreadyExists => "This email is already taken",
|
||||
SignUpError::UserAlreadyExists => "This email is not available",
|
||||
SignUpError::DatabaseError => "Database error",
|
||||
SignUpError::UnableSendEmail => "Unable to send the validation email",
|
||||
_ => "",
|
||||
|
|
@ -491,8 +491,51 @@ pub async fn sign_out(
|
|||
Ok((jar, Redirect::to("/")))
|
||||
}
|
||||
|
||||
///// 404 /////
|
||||
///// RESET PASSWORD /////
|
||||
|
||||
#[derive(Template)]
|
||||
#[template(path = "ask_reset_password.html")]
|
||||
struct AskResetPasswordTemplate {
|
||||
user: Option<model::User>,
|
||||
email: String,
|
||||
message: String,
|
||||
message_email: String,
|
||||
}
|
||||
|
||||
#[debug_handler]
|
||||
pub async fn ask_reset_password_get(
|
||||
Extension(user): Extension<Option<model::User>>,
|
||||
) -> Result<Response> {
|
||||
if user.is_some() {
|
||||
Ok(MessageTemplate {
|
||||
user,
|
||||
message: "Can't ask to reset password when already logged in",
|
||||
}
|
||||
.into_response())
|
||||
} else {
|
||||
Ok(AskResetPasswordTemplate {
|
||||
user,
|
||||
email: String::new(),
|
||||
message: String::new(),
|
||||
message_email: String::new(),
|
||||
}
|
||||
.into_response())
|
||||
}
|
||||
}
|
||||
|
||||
#[debug_handler]
|
||||
pub async fn ask_reset_password_post(
|
||||
Extension(user): Extension<Option<model::User>>,
|
||||
) -> Result<Response> {
|
||||
Ok("todo".into_response())
|
||||
}
|
||||
|
||||
#[debug_handler]
|
||||
pub async fn reset_password() -> Result<Response> {
|
||||
Ok("todo".into_response())
|
||||
}
|
||||
|
||||
///// 404 /////
|
||||
#[debug_handler]
|
||||
pub async fn not_found() -> Result<impl IntoResponse> {
|
||||
Ok(MessageWithoutUser {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue