aboutsummaryrefslogtreecommitdiff
path: root/juick-www/src/main/java/com/juick/www/controllers/SignUp.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2017-12-27 16:23:28 +0300
committerGravatar Vitaly Takmazov2018-01-12 09:12:09 +0300
commitbf5f2142d73a5745124d03f6b6f06c59873e47de (patch)
tree969d43a3bf6d39197313e16080b8b8472975cbe2 /juick-www/src/main/java/com/juick/www/controllers/SignUp.java
parent0c78bc5c08632718eb94c0021cf3ee47fb8ddb82 (diff)
Messenger bot
Diffstat (limited to 'juick-www/src/main/java/com/juick/www/controllers/SignUp.java')
-rw-r--r--juick-www/src/main/java/com/juick/www/controllers/SignUp.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/juick-www/src/main/java/com/juick/www/controllers/SignUp.java b/juick-www/src/main/java/com/juick/www/controllers/SignUp.java
index c8c64ef5..a5851215 100644
--- a/juick-www/src/main/java/com/juick/www/controllers/SignUp.java
+++ b/juick-www/src/main/java/com/juick/www/controllers/SignUp.java
@@ -20,6 +20,7 @@ import com.juick.server.util.HttpBadRequestException;
import com.juick.server.util.HttpForbiddenException;
import com.juick.server.util.UserUtils;
import com.juick.service.CrosspostService;
+import com.juick.service.MessengerService;
import com.juick.service.UserService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
@@ -42,6 +43,8 @@ public class SignUp {
private UserService userService;
@Inject
private CrosspostService crosspostService;
+ @Inject
+ private MessengerService messengerService;
@GetMapping("/signup")
@@ -67,6 +70,9 @@ public class SignUp {
case "durov":
account = crosspostService.getTelegramNameByHash(hash);
break;
+ case "messenger":
+ account = messengerService.getDisplayName(hash);
+ break;
}
if (account == null) {
throw new HttpBadRequestException();
@@ -113,7 +119,8 @@ public class SignUp {
if (!(type.charAt(0) == 'f' && crosspostService.setFacebookUser(hash, uid))
&& !(type.charAt(0) == 'v' && crosspostService.setVKUser(hash, uid))
&& !(type.charAt(0) == 'd' && crosspostService.setTelegramUser(hash, uid))
- && !(type.charAt(0) == 'x' && crosspostService.setJIDUser(hash, uid))) {
+ && !(type.charAt(0) == 'x' && crosspostService.setJIDUser(hash, uid))
+ && !(type.charAt(0) == 'm' && messengerService.linkMessengerUser(hash, uid))) {
throw new HttpBadRequestException();
}
@@ -132,7 +139,8 @@ public class SignUp {
if (!(type.charAt(0) == 'f' && crosspostService.setFacebookUser(hash, uid))
&& !(type.charAt(0) == 'v' && crosspostService.setVKUser(hash, uid))
&& !(type.charAt(0) == 'd' && crosspostService.setTelegramUser(hash, uid))
- && !(type.charAt(0) == 'x' && crosspostService.setJIDUser(hash, uid))) {
+ && !(type.charAt(0) == 'x' && crosspostService.setJIDUser(hash, uid))
+ && !(type.charAt(0) == 'm' && messengerService.linkMessengerUser(hash, uid))) {
throw new HttpBadRequestException();
}
}