* @return a new, populated user profile
*/
public UserProfile parseProfile( WikiContext context )
{
// Retrieve the user's profile (may have been previously cached)
UserProfile profile = getUserProfile( context.getWikiSession() );
HttpServletRequest request = context.getHttpRequest();
// Extract values from request stream (cleanse whitespace as needed)
String loginName = request.getParameter( PARAM_LOGINNAME );
String password = request.getParameter( PARAM_PASSWORD );
String fullname = request.getParameter( PARAM_FULLNAME );
String email = request.getParameter( PARAM_EMAIL );
loginName = InputValidator.isBlank( loginName ) ? null : loginName;
password = InputValidator.isBlank( password ) ? null : password;
fullname = InputValidator.isBlank( fullname ) ? null : fullname;
email = InputValidator.isBlank( email ) ? null : email;
// A special case if we have container authentication
// If authenticated, login name is always taken from container
if ( m_engine.getAuthenticationManager().isContainerAuthenticated() &&
context.getWikiSession().isAuthenticated() )
{
loginName = context.getWikiSession().getLoginPrincipal().getName();
}
// Set the profile fields!
profile.setLoginName( loginName );
profile.setEmail( email );
profile.setFullname( fullname );
profile.setPassword( password );
return profile;
}