Redirect to login page if logged out and submitting forms in acct mngmt
This commit is contained in:
parent
b27776b3c6
commit
7bea4af6c9
1 changed files with 24 additions and 0 deletions
|
@ -278,6 +278,10 @@ public class AccountService {
|
||||||
@POST
|
@POST
|
||||||
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
||||||
public Response processAccountUpdate(final MultivaluedMap<String, String> formData) {
|
public Response processAccountUpdate(final MultivaluedMap<String, String> formData) {
|
||||||
|
if (auth == null) {
|
||||||
|
return login(null);
|
||||||
|
}
|
||||||
|
|
||||||
require(AccountRoles.MANAGE_ACCOUNT);
|
require(AccountRoles.MANAGE_ACCOUNT);
|
||||||
|
|
||||||
UserModel user = auth.getUser();
|
UserModel user = auth.getUser();
|
||||||
|
@ -309,6 +313,10 @@ public class AccountService {
|
||||||
@Path("totp-remove")
|
@Path("totp-remove")
|
||||||
@GET
|
@GET
|
||||||
public Response processTotpRemove() {
|
public Response processTotpRemove() {
|
||||||
|
if (auth == null) {
|
||||||
|
return login("totp");
|
||||||
|
}
|
||||||
|
|
||||||
require(AccountRoles.MANAGE_ACCOUNT);
|
require(AccountRoles.MANAGE_ACCOUNT);
|
||||||
|
|
||||||
UserModel user = auth.getUser();
|
UserModel user = auth.getUser();
|
||||||
|
@ -323,6 +331,10 @@ public class AccountService {
|
||||||
@Path("sessions-logout")
|
@Path("sessions-logout")
|
||||||
@GET
|
@GET
|
||||||
public Response processSessionsLogout() {
|
public Response processSessionsLogout() {
|
||||||
|
if (auth == null) {
|
||||||
|
return login("sessions");
|
||||||
|
}
|
||||||
|
|
||||||
require(AccountRoles.MANAGE_ACCOUNT);
|
require(AccountRoles.MANAGE_ACCOUNT);
|
||||||
|
|
||||||
UserModel user = auth.getUser();
|
UserModel user = auth.getUser();
|
||||||
|
@ -335,6 +347,10 @@ public class AccountService {
|
||||||
@POST
|
@POST
|
||||||
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
||||||
public Response processTotpUpdate(final MultivaluedMap<String, String> formData) {
|
public Response processTotpUpdate(final MultivaluedMap<String, String> formData) {
|
||||||
|
if (auth == null) {
|
||||||
|
return login("totp");
|
||||||
|
}
|
||||||
|
|
||||||
require(AccountRoles.MANAGE_ACCOUNT);
|
require(AccountRoles.MANAGE_ACCOUNT);
|
||||||
|
|
||||||
UserModel user = auth.getUser();
|
UserModel user = auth.getUser();
|
||||||
|
@ -364,6 +380,10 @@ public class AccountService {
|
||||||
@POST
|
@POST
|
||||||
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
@Consumes(MediaType.APPLICATION_FORM_URLENCODED)
|
||||||
public Response processPasswordUpdate(final MultivaluedMap<String, String> formData) {
|
public Response processPasswordUpdate(final MultivaluedMap<String, String> formData) {
|
||||||
|
if (auth == null) {
|
||||||
|
return login("password");
|
||||||
|
}
|
||||||
|
|
||||||
require(AccountRoles.MANAGE_ACCOUNT);
|
require(AccountRoles.MANAGE_ACCOUNT);
|
||||||
|
|
||||||
UserModel user = auth.getUser();
|
UserModel user = auth.getUser();
|
||||||
|
@ -403,6 +423,10 @@ public class AccountService {
|
||||||
@GET
|
@GET
|
||||||
public Response processSocialUpdate(@QueryParam("action") String action,
|
public Response processSocialUpdate(@QueryParam("action") String action,
|
||||||
@QueryParam("provider_id") String providerId) {
|
@QueryParam("provider_id") String providerId) {
|
||||||
|
if (auth == null) {
|
||||||
|
return login("social");
|
||||||
|
}
|
||||||
|
|
||||||
require(AccountRoles.MANAGE_ACCOUNT);
|
require(AccountRoles.MANAGE_ACCOUNT);
|
||||||
UserModel user = auth.getUser();
|
UserModel user = auth.getUser();
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue