mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
use quarkus mailer for password recovery
This commit is contained in:
@@ -56,7 +56,7 @@ public class ServerREST {
|
||||
infos.setGitCommit(version.getGitCommit());
|
||||
infos.setAllowRegistrations(config.users().allowRegistrations());
|
||||
infos.setGoogleAnalyticsCode(config.googleAnalyticsTrackingCode().orElse(null));
|
||||
infos.setSmtpEnabled(config.smtp().isPresent());
|
||||
infos.setSmtpEnabled(config.passwordRecoveryEnabled());
|
||||
infos.setDemoAccountEnabled(config.users().createDemoAccount());
|
||||
infos.setWebsocketEnabled(config.websocket().enabled());
|
||||
infos.setWebsocketPingInterval(config.websocket().pingInterval().toMillis());
|
||||
|
||||
@@ -267,6 +267,10 @@ public class UserREST {
|
||||
@Transactional
|
||||
@Operation(summary = "send a password reset email")
|
||||
public Response sendPasswordReset(@Valid @Parameter(required = true) PasswordResetRequest req) {
|
||||
if (!config.passwordRecoveryEnabled()) {
|
||||
throw new IllegalArgumentException("Password recovery is not enabled on this CommaFeed instance");
|
||||
}
|
||||
|
||||
User user = userDAO.findByEmail(req.getEmail());
|
||||
if (user == null) {
|
||||
return Response.ok().build();
|
||||
|
||||
@@ -14,18 +14,19 @@ import jakarta.ws.rs.GET;
|
||||
import jakarta.ws.rs.Path;
|
||||
import jakarta.ws.rs.core.NewCookie;
|
||||
import jakarta.ws.rs.core.Response;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Path("/logout")
|
||||
@PermitAll
|
||||
@RequiredArgsConstructor
|
||||
@Singleton
|
||||
public class LogoutServlet {
|
||||
|
||||
@ConfigProperty(name = "quarkus.http.auth.form.cookie-name")
|
||||
String cookieName;
|
||||
|
||||
private final CommaFeedConfiguration config;
|
||||
private final String cookieName;
|
||||
|
||||
public LogoutServlet(CommaFeedConfiguration config, @ConfigProperty(name = "quarkus.http.auth.form.cookie-name") String cookieName) {
|
||||
this.config = config;
|
||||
this.cookieName = cookieName;
|
||||
}
|
||||
|
||||
@GET
|
||||
public Response get() {
|
||||
|
||||
Reference in New Issue
Block a user