|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Need help writing an interceptor to force a user to change their passwordHi all,
I'm trying to implement functionality which will force a user to a change-password page if a certain bit is set on their user account. That is, no matter what action they are attempting to take, I'd like to intercept the request and show them a change-password page. I've written a few struts2 interceptors before, but this one has me stumped. I can easily get the user principal object and see whether or not I need to insert the change-password page, but I'm not sure what to do next. I was thinking about trying to change the action object to one which would simply return a string pointing to the change-password jsp, but I don't know how to replace the action object on the invocation object (and that doesn't seem like a good idea). I'd prefer not to solve this with a redirect because I'd like to use some of the context of current request in the rendering of the change-password page. Any ideas? Thanks, Russ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Need help writing an interceptor to force a user to change their passwordYou should be able to just create a global result with the jsp you want.
Ala: <global-results> <result name="passwordChange">/passwordChange.jsp</result> </global-results> Then have the interceptor return that string when needed. Any time it's true, the result will get hit and the user will get fowarded. Unless I'm missing something. -Tim Russell Neufeld wrote: > Hi all, > I'm trying to implement functionality which will force a user to a > change-password page if a certain bit is set on their user account. > That is, no matter what action they are attempting to take, I'd like to > intercept the request and show them a change-password page. I've > written a few struts2 interceptors before, but this one has me stumped. > I can easily get the user principal object and see whether or not I need > to insert the change-password page, but I'm not sure what to do next. I > was thinking about trying to change the action object to one which would > simply return a string pointing to the change-password jsp, but I don't > know how to replace the action object on the invocation object (and that > doesn't seem like a good idea). I'd prefer not to solve this with a > redirect because I'd like to use some of the context of current request > in the rendering of the change-password page. > > Any ideas? Thanks, > > Russ > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
RE: Need help writing an interceptor to force a user to change their passwordHi Russ,
You may want to try creating a global result in your struts.xml: <global-results> <result name="change-password">/pages/user/login/force_change_password.jsp</result> </global-results> Then in your interceptor return the result name "change-password" That is how we accomplished something similar to your pblem. Hope this helps. -Nate ________________________________ From: Russell Neufeld [mailto:russ.neufeld@...] Sent: Mon 6/29/2009 5:19 PM To: Struts Users Mailing List Subject: Need help writing an interceptor to force a user to change their password Hi all, I'm trying to implement functionality which will force a user to a change-password page if a certain bit is set on their user account. That is, no matter what action they are attempting to take, I'd like to intercept the request and show them a change-password page. I've written a few struts2 interceptors before, but this one has me stumped. I can easily get the user principal object and see whether or not I need to insert the change-password page, but I'm not sure what to do next. I was thinking about trying to change the action object to one which would simply return a string pointing to the change-password jsp, but I don't know how to replace the action object on the invocation object (and that doesn't seem like a good idea). I'd prefer not to solve this with a redirect because I'd like to use some of the context of current request in the rendering of the change-password page. Any ideas? Thanks, Russ --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
|
|
Re: Need help writing an interceptor to force a user to change their passwordThanks Nate and Tim. Worked like a charm.
Russ Sarr, Nathan wrote: > Hi Russ, > > You may want to try creating a global result in your struts.xml: > > <global-results> > > <result name="change-password">/pages/user/login/force_change_password.jsp</result> > > </global-results> > > Then in your interceptor return the result name "change-password" > > That is how we accomplished something similar to your pblem. > > Hope this helps. > -Nate > > ________________________________ > > From: Russell Neufeld [mailto:russ.neufeld@...] > Sent: Mon 6/29/2009 5:19 PM > To: Struts Users Mailing List > Subject: Need help writing an interceptor to force a user to change their password > > > > Hi all, > > I'm trying to implement functionality which will force a user to a change-password page if a certain bit is set on their user account. That is, no matter what action they are attempting to take, I'd like to intercept the request and show them a change-password page. I've written a few struts2 interceptors before, but this one has me stumped. I can easily get the user principal object and see whether or not I need to insert the change-password page, but I'm not sure what to do next. I was thinking about trying to change the action object to one which would simply return a string pointing to the change-password jsp, but I don't know how to replace the action object on the invocation object (and that doesn't seem like a good idea). I'd prefer not to solve this with a redirect because I'd like to use some of the context of current request in the rendering of the change-password page. > > Any ideas? Thanks, > > Russ > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@... > For additional commands, e-mail: user-help@... > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@... For additional commands, e-mail: user-help@... |
| Free embeddable forum powered by Nabble | Forum Help |