Hi
How do I do to trigger a dialog the first time a user login?
I would like to be able to ask a few questions and save the answers.
Regards,
Michael D
You would need to develop a plugin which would include a servlet-filter module
Can you explain some more what to do and give some example?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Servlet filters intercept calls to resource and can redirect calls to another resource. That is exactly what you need. You can read about servlet filters here:
http://www.oracle.com/technetwork/java/filters-137243.html
https://developer.atlassian.com/server/jira/platform/servlet-filter/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for pointing me in the right direction.
I have been able to create a servlet filter.
However I would appreciate if you can me me some more hints regarding how to only trigger this filter when a user is logging in for the first time and how to redirect to a page where I can ask the questions.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In the servlet filter you should check how many times the user has logged in. You can use LoginInfo class for it. You can find more info here:
https://community.atlassian.com/t5/Jira-questions/Script-Runner-Last-Login-Date/qaq-p/311789
below you can find out how you redirect to another page
https://stackoverflow.com/questions/5308801/how-to-redirect-in-a-servlet-filter
The redirect page must be your own servlet or webwork.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks
I have now been able to trigger the filter when I'm about to access a specific servlet, <url-pattern>/plugins/servlet/myservlet</url-pattern>, and I can redirect to another servlet.
However I want to trigger the redirection only when the user login and its the first login for that user. After the information collection the user shall be redirected to the place where he was going in the first place.
The problem is not to get information from LoginInfo. It is to get the filter to trigger only when a user login and after collection of data redirect to the original url.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
when you define the servlet-filter tag, you provide the class, which is called. In this class you define if it is the first time to login or not.
<servlet-filter name="Hello World Servlet" key="helloWorld" class="com.example.myplugins.helloworld.HelloWorldFilter" location="before-dispatch" weight="200"> <description>Says Hello World, Australia or your name.</description> <url-pattern>/helloworld</url-pattern> <init-param> <param-name>defaultName</param-name> <param-value>Australia</param-value> </init-param> <dispatcher>REQUEST</dispatcher> <dispatcher>FORWARD</dispatcher> </servlet-filter>
in this example the class would be com.example.myplugins.helloworld.HelloWorldFilter
in the url-pattern you need to provide a pattern for the url, which is called after you push the login button.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also if you have Jira source code , you can have a look at the source code of the jira-onboarding-assets-plugin. A different approach is used there.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To trigger the Hello World Servlet you need to enter an url like plugins/servlet/helloworld
What I would like is to find something to put as url-pattern and that will trigger when the user login. Then I can check if it is the first login.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Go to the login page. Open developer tools in your browser. Enter username, password and push the Log In button. In the developer tools you will see the url.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have looked into the jira code but I can't understand it.
If I put /login.jsp as url-pattern I can catch it.
However I would like to catch it after login so I know the the user has logged in and if the user login from the dashboard I can't catch it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You should catch the response from the page, not the request. You can read more here:
https://www.leveluplunch.com/java/tutorials/034-modify-html-response-using-filter/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for all your help. I have not managed to get what I want but I will try again.
I still haven't been able to figure out how to trigger the filter after the user has logged in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.