Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
V
VIPSLogic
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
VIPS
VIPSLogic
Commits
ced35bcb
Commit
ced35bcb
authored
2 years ago
by
Tor-Einar Skog
Browse files
Options
Downloads
Patches
Plain Diff
fix:Handle non-authorized request
parent
a93d5d24
No related branches found
No related tags found
1 merge request
!33
Feat/add user subscription link vipsutv 342
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/no/nibio/vips/logic/controller/servlet/NotificationSubscriptionController.java
+15
-1
15 additions, 1 deletion
...ontroller/servlet/NotificationSubscriptionController.java
with
15 additions
and
1 deletion
src/main/java/no/nibio/vips/logic/controller/servlet/NotificationSubscriptionController.java
+
15
−
1
View file @
ced35bcb
...
@@ -20,6 +20,8 @@ package no.nibio.vips.logic.controller.servlet;
...
@@ -20,6 +20,8 @@ package no.nibio.vips.logic.controller.servlet;
import
freemarker.core.ParseException
;
import
freemarker.core.ParseException
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.UnsupportedEncodingException
;
import
java.net.URLEncoder
;
import
java.util.List
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.ejb.EJB
;
import
javax.persistence.EntityManager
;
import
javax.persistence.EntityManager
;
...
@@ -80,7 +82,12 @@ public class NotificationSubscriptionController extends HttpServlet {
...
@@ -80,7 +82,12 @@ public class NotificationSubscriptionController extends HttpServlet {
String
action
=
request
.
getParameter
(
"action"
);
String
action
=
request
.
getParameter
(
"action"
);
VipsLogicUser
user
=
(
VipsLogicUser
)
request
.
getSession
().
getAttribute
(
"user"
);
VipsLogicUser
user
=
(
VipsLogicUser
)
request
.
getSession
().
getAttribute
(
"user"
);
if
(
user
==
null
)
{
this
.
redirectToLogin
(
request
,
response
);
return
;
}
try
try
{
{
// Default: View list of user subscriptions
// Default: View list of user subscriptions
...
@@ -173,6 +180,13 @@ public class NotificationSubscriptionController extends HttpServlet {
...
@@ -173,6 +180,13 @@ public class NotificationSubscriptionController extends HttpServlet {
}
}
}
}
private
void
redirectToLogin
(
HttpServletRequest
request
,
HttpServletResponse
response
)
throws
UnsupportedEncodingException
,
IOException
{
String
nextPage
=
ServletUtil
.
getFullRequestURI
(
request
);
String
nextPageDirective
=
"?nextPage="
+
URLEncoder
.
encode
(
nextPage
,
"UTF-8"
);
response
.
sendRedirect
(
Globals
.
PROTOCOL
+
"://"
+
ServletUtil
.
getServerName
(
request
)
+
"/login"
+
nextPageDirective
);
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
/**
* Handles the HTTP <code>GET</code> method.
* Handles the HTTP <code>GET</code> method.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment