Reset password error management

34 views
Skip to first unread message

fmdev

unread,
Nov 13, 2020, 6:34:26 AM11/13/20
to CAS Community
Hi all,

I am using CAS 5.3 and I manually add to my solution the PR 4205  to return the service parameter in the reset password link and it works.

In SendPasswordResetInstructionsAction.java I have: 

final String to = passwordManagementService.findEmail(username);
  if (StringUtils.isBlank(to)) {
    LOGGER.warn("No recipient is provided");
    return error(); 
  }

error() shows the stack trace attached, in that case because final String to is blank due to an inexistent username.

My question is how can I show a custom -more user friendly- error instead of showing the stackTrace error?

Thanks
Regards



Schermata 2020-11-13 alle 12.25.14.png

Ray Bon

unread,
Nov 13, 2020, 11:12:41 AM11/13/20
to cas-...@apereo.org
You could just replace 'error()' with the text you want.
How does 'error()' know what the problem is? 

Ray

On Fri, 2020-11-13 at 03:34 -0800, fmdev wrote:
Notice: This message was sent from outside the University of Victoria email system. Please be cautious with links and sensitive information.
-- 
Ray Bon
Programmer Analyst
Development Services, University Systems

I respectfully acknowledge that my place of work is located within the ancestral, traditional and unceded territory of the Songhees, Esquimalt and WSÁNEĆ Nations.

fmdev

unread,
Nov 13, 2020, 12:03:50 PM11/13/20
to CAS Community, Ray Bon
Thanks for the quick response and sorry for not expressing myself well.

The desired behavior would be to raise an exception when there's no email for the given username and based on this exception render an error page.

Does such an implementation already exist? 

Thanks again.

Ray Bon

unread,
Nov 13, 2020, 12:28:52 PM11/13/20
to cas-...@apereo.org
If you created this code, you could create your own exception that only includes an appropriate message, and no stack trace (unless of course that is what 'error' does).
I have on occasion seen the error page, but do not remeber how to trigger it. Check out the source, https://github.com/apereo/cas and look into custom web flow, https://apereo.github.io/cas/6.2.x/webflow/Webflow-Customization.html, if you are not using the built in password reset, https://apereo.github.io/cas/6.2.x/password_management/Password-Management.html.

Ray
Reply all
Reply to author
Forward
0 new messages