Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ask users who self-assert their email to provide their name if we have none #1725

Open
ahelsing opened this issue Jul 28, 2016 · 3 comments
Open

Comments

@ahelsing
Copy link
Member

When a user self-asserts their email, often they are tutorial users - for whom we do not have a real name. Other times, we get no name from Shibboleth.

When this happens, ask these users to modify their profile on the portal after they log in, to provide their name.

@ahelsing
Copy link
Member Author

kmsendemail.php can check if they are a tutorial user or if we have no name. If so, add a little text in the email we send asking them to confirm their email, with a link to the page to modify their profile.

Use a new function isTutorialUser(). Put that in lib/php. For now, it can just check for the [email protected] affiliation.
Add a 2nd new function shibProvidesName() that uses the Shibboleth provided attributes. Returns true if there is a displayName OR (first and last).

Then in kmsendemail: if (isTutorialUser() || ! shibProvidesName()), we add to the email:
To set your name and other user information, please visit <modify.php link>.

@ahelsing
Copy link
Member Author

ahelsing commented Jul 29, 2016

Sample code for those 2 utilities:

// Return True iff the user is a tutorial user
function isTutorialUser() {
  if (key_exists('affiliation', $_SERVER)) {
    if (strpos($_SERVER['affiliation'], "[email protected]") != false) {
      return True;
    }
  }
  return False;
}

// Return True iff shibboleth provides a full name for the user
// - displayName or givenName (first name) and sn (last name)
function shibProvidesName() {
  if (key_exists('displayName', $_SERVER) && $_SERVER['displayName'] && trim($_SERVER['displayName'])) {
    return True;
  }
  if (key_exists('givenName', $_SERVER) && $_SERVER['givenName'] && trim($_SERVER['givenName'])) {
    if (key_exists('sn', $_SERVER) && $_SERVER['sn'] && trim($_SERVER['sn'])) {
      return True;
    }
  }
  return False;
}

@ahelsing
Copy link
Member Author

Code to add to the function get_user_conf_email_body, just before the line about "Questions?":

  if (isTutorialUser() || !shibProvidesName()) {
    $body .= "To set your name and other user information, please visit " . relative_url('modify.php') . ".\n\n";
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant