Inspired by the debugging in #1341144: CAS try to create the user more than one time, I think we should add a link in the error message "The CAS username is already in use on this site." The link should point at the user view or user edit page for the relevant other user.

For example, we could make the word "already in use" into the link:

The CAS username is already in use on this site.

Comments

metzlerd’s picture

I like this.... but perhaps it should be in the watchdog logs instead of in the user message? Do you recall whether we log this message? It would seem that the audience for this is the admin, and not the user trying to log in.

bfroehle’s picture

Yes, of course it should only be in admin related settings. For example, reynierpm (in #1341144: CAS try to create the user more than one time) was trying to edit a user to add the CAS username and was getting the error. It would have then been easy to ask him if the link pointed to a valid user or not (indicating corruption in the {cas_user} table.

The relevant validation functions would be

/**
 * Form element 'cas_name' validator on user_profile_form().
 */
function _cas_user_profile_cas_name_element_validate($element, &$form_state) {

and

/**
 * Form element 'cas_name' validator on user_register_form().
 */
function _cas_user_register_cas_name_element_validate($element, &$form_state) {
bfroehle’s picture

Version: 7.x-1.x-dev » 6.x-3.x-dev
Status: Active » Needs review
StatusFileSize
new5.88 KB

Code for 6.x-3.x attached. In addition to providing a better error message I also unify three existing disparate cas_name #element_validate handlers.

Status: Needs review » Needs work

The last submitted patch, 1341708-Add-link-to-user-in-error.patch, failed testing.

bfroehle’s picture

Status: Needs work » Needs review
StatusFileSize
new6.4 KB

Fixed one little error -- missed a rename (_cas_user_register_cas_name_element_validate -> _cas_name_element_validate) in cas.user.inc. Yay for automated testing!

This should be ready to go.

Status: Needs review » Needs work

The last submitted patch, 1341708-Add-link-to-user-in-error-fixed.patch, failed testing.

bfroehle’s picture

Status: Needs work » Needs review
bfroehle’s picture

Version: 6.x-3.x-dev » 7.x-1.x-dev
StatusFileSize
new6.18 KB

And a 7.x-1.x version... (not manually tested yet).

bfroehle’s picture

Status: Needs review » Fixed

Committed to 6.x-3.x and 7.x-1.x.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

  • Commit 713dfbd on 7.x-1.x, 8.x-1.x by bfroehle:
    Issue #1341708 by bfroehle: Add link to user in error message 'The CAS...