aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/juick/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/com/juick/server')
-rw-r--r--src/main/java/com/juick/server/api/Service.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/main/java/com/juick/server/api/Service.java b/src/main/java/com/juick/server/api/Service.java
index 4474e4f0..12a9167f 100644
--- a/src/main/java/com/juick/server/api/Service.java
+++ b/src/main/java/com/juick/server/api/Service.java
@@ -177,6 +177,23 @@ public class Service {
throw new HttpForbiddenException();
}
}
+ @ApiIgnore
+ @PostMapping("/api/mail/unsubscribe")
+ @ResponseStatus(value = HttpStatus.OK)
+ public void processMailUnsubscribe(@Visitor User current, InputStream data) throws Exception {
+ if (current.getName().equals(serviceUser)) {
+ MimeMessage msg = new MimeMessage(session, data);
+ String from = msg.getFrom() == null || msg.getFrom().length > 1 ? ((InternetAddress) msg.getSender()).getAddress()
+ : ((InternetAddress) msg.getFrom()[0]).getAddress();
+
+ User visitor = userService.getUserByEmail(from);
+ if (!visitor.isAnonymous()) {
+
+ }
+ } else {
+ throw new HttpForbiddenException();
+ }
+ }
private void endSession(SseEmitter emitter) {
serverManager.getSessions().stream()
.filter(s -> s.getEmitter().equals(emitter))