mirror of
https://github.com/perstarkse/minne.git
synced 2026-04-09 19:03:37 +02:00
fix: move ownership into auth fn
This commit is contained in:
@@ -127,7 +127,7 @@ pub async fn change_password(
|
||||
Form(form): Form<NewPasswordForm>,
|
||||
) -> Result<impl IntoResponse, HtmlError> {
|
||||
// Authenticate to make sure the password matches
|
||||
let authenticated_user = User::authenticate(user.email, form.old_password, &state.db).await?;
|
||||
let authenticated_user = User::authenticate(&user.email, &form.old_password, &state.db).await?;
|
||||
|
||||
User::patch_password(&authenticated_user.email, &form.new_password, &state.db).await?;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ pub async fn authenticate_user(
|
||||
auth: AuthSessionType,
|
||||
Form(form): Form<SignupParams>,
|
||||
) -> Result<impl IntoResponse, HtmlError> {
|
||||
let user = match User::authenticate(form.email, form.password, &state.db).await {
|
||||
let user = match User::authenticate(&form.email, &form.password, &state.db).await {
|
||||
Ok(user) => user,
|
||||
Err(_) => {
|
||||
return Ok(Html("<p>Incorrect email or password </p>").into_response());
|
||||
|
||||
Reference in New Issue
Block a user