diff --git a/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java b/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java index 81d8759..fe60caf 100644 --- a/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java +++ b/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java @@ -1,4 +1,4 @@ -/* +/* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information @@ -14,7 +14,7 @@ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations - under the License. + under the License. */ package org.apache.wiki.auth; @@ -509,7 +509,7 @@ break; } } - + // If container-managed auth and user not logged in, throw an error if ( m_engine.getAuthenticationManager().isContainerAuthenticated() && !context.getWikiSession().isAuthenticated() ) @@ -580,7 +580,9 @@ try { otherProfile = getUserDatabase().findByEmail( email ); - if ( otherProfile != null && !profile.equals( otherProfile ) && StringUtils.lowerCase( email ).equals( StringUtils.lowerCase(otherProfile.getEmail() ) ) ) + if ( otherProfile != null + && !profile.getUid().equals(otherProfile.getUid()) // Issue JSPWIKI-1042 + && !profile.equals( otherProfile ) && StringUtils.lowerCase( email ).equals( StringUtils.lowerCase(otherProfile.getEmail() ) ) ) { Object[] args = { email }; session.addMessage( SESSION_MESSAGES, MessageFormat.format( rb.getString("security.error.email.taken"), args ) ); @@ -592,7 +594,7 @@ /** * A helper method for returning all of the known WikiNames in this system. - * + * * @return An Array of Principals * @throws WikiSecurityException If for reason the names cannot be fetched */ @@ -746,7 +748,7 @@ /** * Constructs a new Task for saving a user profile. * @param engine the wiki engine - * @deprecated will be removed in 2.10 scope. Consider using + * @deprecated will be removed in 2.10 scope. Consider using * {@link #SaveUserProfileTask(WikiEngine, Locale)} instead */ @Deprecated @@ -757,7 +759,7 @@ m_db = engine.getUserManager().getUserDatabase(); m_loc = null; } - + public SaveUserProfileTask( WikiEngine engine, Locale loc ) { super( SAVE_TASK_MESSAGE_KEY ); @@ -788,12 +790,12 @@ InternationalizationManager i18n = m_engine.getInternationalizationManager(); String app = m_engine.getApplicationName(); String to = profile.getEmail(); - String subject = i18n.get( InternationalizationManager.DEF_TEMPLATE, m_loc, + String subject = i18n.get( InternationalizationManager.DEF_TEMPLATE, m_loc, "notification.createUserProfile.accept.subject", app ); - - String content = i18n.get( InternationalizationManager.DEF_TEMPLATE, m_loc, - "notification.createUserProfile.accept.content", app, - profile.getLoginName(), + + String content = i18n.get( InternationalizationManager.DEF_TEMPLATE, m_loc, + "notification.createUserProfile.accept.content", app, + profile.getLoginName(), profile.getFullname(), profile.getEmail(), m_engine.getURL( WikiContext.LOGIN, null, null, true ) ); @@ -850,7 +852,7 @@ WikiEventManager.fireEvent(this,new WikiSecurityEvent(session,type,profile)); } } - + /** * Implements the JSON API for usermanager. *

@@ -861,7 +863,7 @@ public static final class JSONUserModule implements WikiAjaxServlet { private volatile UserManager m_manager; - + /** * Create a new JSONUserModule. * @param mgr Manager @@ -870,12 +872,12 @@ { m_manager = mgr; } - + @Override public String getServletMapping() { return JSON_USERS; } - + public void service(HttpServletRequest req, HttpServletResponse resp, String actionName, List params) throws ServletException, IOException { try { String uid = null; @@ -892,7 +894,7 @@ throw new ServletException(e); } } - + /** * Directly returns the UserProfile object attached to an uid. * @@ -909,7 +911,7 @@ return prof; } - + throw new IllegalStateException("The manager is offline."); } } diff --git a/jspwiki-war/src/main/webapp/META-INF/context.xml b/jspwiki-war/src/main/webapp/META-INF/context.xml new file mode 100644 index 0000000..41909b2 --- /dev/null +++ b/jspwiki-war/src/main/webapp/META-INF/context.xml @@ -0,0 +1,2 @@ + +