use of org.activityinfo.server.util.logging.LogException in project activityinfo by bedatadriven.
the class HostController method getHostPage.
@GET
@Produces(MediaType.TEXT_HTML)
@LogException(emailAlert = true)
public Response getHostPage(@Context UriInfo uri, @Context HttpServletRequest req, @QueryParam("redirect") boolean redirect) throws Exception {
if (!authProvider.isAuthenticated()) {
// Otherwise, go to the default ActivityInfo root page
return Response.ok(new RootPageModel().asViewable()).type(MediaType.TEXT_HTML).cacheControl(CacheControl.valueOf("no-cache")).build();
}
if (redirect) {
return Response.seeOther(uri.getAbsolutePathBuilder().replacePath(ENDPOINT).build()).build();
}
String appUri = uri.getAbsolutePathBuilder().replaceQuery("").build().toString();
HostPageModel model = new HostPageModel(appUri);
model.setAppCacheEnabled(checkAppCacheEnabled(req));
return Response.ok(model.asViewable()).type(MediaType.TEXT_HTML).cacheControl(CacheControl.valueOf("no-cache")).build();
}
use of org.activityinfo.server.util.logging.LogException in project activityinfo by bedatadriven.
the class SignUpConfirmationController method confirm.
@POST
@LogException(emailAlert = true)
public Response confirm(@Context UriInfo uri, @FormParam("key") String key, @FormParam("password") String password, @FormParam("newsletter") boolean newsletter) {
try {
// check params
checkParam(key, true);
checkParam(password, true);
// confirm user
User user = userDAO.get().findUserByChangePasswordKey(key);
user.changePassword(password);
user.clearChangePasswordKey();
user.setEmailNotification(true);
// add user to default database
addUserToDefaultDatabase(user);
if (newsletter) {
mailingList.subscribe(user);
}
// go to the home page
return Response.seeOther(uri.getAbsolutePathBuilder().replacePath("/").build()).cookie(authTokenProvider.createNewAuthCookies(user)).build();
} catch (Exception e) {
LOGGER.log(Level.SEVERE, "Exception during signup process", e);
return Response.ok(SignUpConfirmationPageModel.genericErrorModel(key).asViewable()).type(MediaType.TEXT_HTML).build();
}
}
Aggregations