File tree Expand file tree Collapse file tree
crates/api/api/src/local_user Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,13 +12,22 @@ pub async fn resend_verification_email(
1212 Json ( data) : Json < ResendVerificationEmail > ,
1313 context : Data < LemmyContext > ,
1414) -> LemmyResult < Json < SuccessResponse > > {
15- let site_view = SiteView :: read_local ( & mut context. pool ( ) ) . await ?;
1615 let email = data. email . to_string ( ) ;
1716
17+ // For security, errors are not returned.
18+ // https://github.com/LemmyNet/lemmy/issues/5277
19+ let _ = try_resend_verification_email ( & email, & context) . await ;
20+
21+ Ok ( Json ( SuccessResponse :: default ( ) ) )
22+ }
23+
24+ async fn try_resend_verification_email ( email : & str , context : & LemmyContext ) -> LemmyResult < ( ) > {
1825 // Fetch that email
19- let local_user_view = LocalUserView :: find_by_email ( & mut context. pool ( ) , & email) . await ?;
26+ let local_user_view = LocalUserView :: find_by_email ( & mut context. pool ( ) , email) . await ?;
2027 check_local_user_valid ( & local_user_view) ?;
2128
29+ let site_view = SiteView :: read_local ( & mut context. pool ( ) ) . await ?;
30+
2231 send_verification_email_if_required (
2332 & site_view. local_site ,
2433 & local_user_view,
@@ -27,5 +36,5 @@ pub async fn resend_verification_email(
2736 )
2837 . await ?;
2938
30- Ok ( Json ( SuccessResponse :: default ( ) ) )
39+ Ok ( ( ) )
3140}
You can’t perform that action at this time.
0 commit comments