Search in sources :

Example 6 with NoSuchUserException

use of com.networknt.portal.usermanagement.model.common.exception.NoSuchUserException in project light-portal by networknt.

the class UserTokenIdGetHandler method handleRequest.

@Override
public void handleRequest(HttpServerExchange exchange) throws Exception {
    String id = exchange.getQueryParameters().get("id").getFirst();
    String result = null;
    try {
        User user = service.confirmEmail(id);
        if (user == null) {
            result = "no user active by the token";
        } else {
            result = "user active: " + user.getScreenName();
        }
    } catch (NoSuchUserException e) {
        result = "no Such User";
    }
    exchange.getResponseHeaders().add(new HttpString("Content-Type"), "application/json");
    exchange.getResponseSender().send(Config.getInstance().getMapper().writeValueAsString(result));
// exchange.endExchange();
}
Also used : User(com.networknt.portal.usermanagement.model.common.model.user.User) NoSuchUserException(com.networknt.portal.usermanagement.model.common.exception.NoSuchUserException) HttpString(io.undertow.util.HttpString) HttpString(io.undertow.util.HttpString)

Aggregations

NoSuchUserException (com.networknt.portal.usermanagement.model.common.exception.NoSuchUserException)6 User (com.networknt.portal.usermanagement.model.common.model.user.User)6 HttpString (io.undertow.util.HttpString)4 Map (java.util.Map)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 InvalidTokenException (com.networknt.portal.usermanagement.model.common.exception.InvalidTokenException)3 UserDto (com.networknt.portal.usermanagement.model.common.domain.UserDto)2 HashMap (java.util.HashMap)2 EventHandlerMethod (com.networknt.eventuate.common.EventHandlerMethod)1 LoginForm (com.networknt.portal.usermanagement.model.LoginForm)1 InvalidEmailException (com.networknt.portal.usermanagement.model.common.exception.InvalidEmailException)1 LoginForm (com.networknt.portal.usermanagement.restquery.model.LoginForm)1