Merge pull request #786 from jay-hodgson/release-27

SWC-1146: missed a case where userprofile.email was referenced
SWC-1159: set username if temp in sso login