mirror of https://github.com/LemmyNet/lemmy.git
Co-authored-by: Dessalines <dessalines@users.noreply.github.com>limit-mod-actions
parent
ccb6435c1d
commit
70e3feb174
|
@ -8,6 +8,7 @@ use lemmy_db_schema::source::{
|
||||||
local_user::LocalUser,
|
local_user::LocalUser,
|
||||||
password_reset_request::PasswordResetRequest,
|
password_reset_request::PasswordResetRequest,
|
||||||
};
|
};
|
||||||
|
use lemmy_db_views::structs::SiteView;
|
||||||
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
|
use lemmy_utils::{claims::Claims, error::LemmyError, ConnectionId};
|
||||||
use lemmy_websocket::LemmyContext;
|
use lemmy_websocket::LemmyContext;
|
||||||
|
|
||||||
|
@ -42,16 +43,24 @@ impl Perform for PasswordChangeAfterReset {
|
||||||
.await
|
.await
|
||||||
.map_err(|e| LemmyError::from_error_message(e, "couldnt_update_user"))?;
|
.map_err(|e| LemmyError::from_error_message(e, "couldnt_update_user"))?;
|
||||||
|
|
||||||
// Return the jwt
|
// Return the jwt if login is allowed
|
||||||
|
let site_view = SiteView::read_local(context.pool()).await?;
|
||||||
|
let jwt =
|
||||||
|
if site_view.local_site.require_application && !updated_local_user.accepted_application {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
Some(
|
||||||
|
Claims::jwt(
|
||||||
|
updated_local_user.id.0,
|
||||||
|
&context.secret().jwt_secret,
|
||||||
|
&context.settings().hostname,
|
||||||
|
)?
|
||||||
|
.into(),
|
||||||
|
)
|
||||||
|
};
|
||||||
|
|
||||||
Ok(LoginResponse {
|
Ok(LoginResponse {
|
||||||
jwt: Some(
|
jwt,
|
||||||
Claims::jwt(
|
|
||||||
updated_local_user.id.0,
|
|
||||||
&context.secret().jwt_secret,
|
|
||||||
&context.settings().hostname,
|
|
||||||
)?
|
|
||||||
.into(),
|
|
||||||
),
|
|
||||||
verify_email_sent: false,
|
verify_email_sent: false,
|
||||||
registration_created: false,
|
registration_created: false,
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue