jspwiki-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mets...@apache.org
Subject svn commit: r1614954 - in /jspwiki/trunk: ./ jspwiki-it-tests/jspwiki-selenium-tests/src/main/config/ jspwiki-war/src/main/config/db/ jspwiki-war/src/main/java/org/apache/wiki/ jspwiki-war/src/main/java/org/apache/wiki/auth/ jspwiki-war/src/main/java/o...
Date Thu, 31 Jul 2014 18:46:53 GMT
Author: metskem
Date: Thu Jul 31 18:46:53 2014
New Revision: 1614954

URL: http://svn.apache.org/r1614954
Log:
2014-07-31  Harry Metske (metskem@apache.org)

       * 2.10.2-svn-5

       * Fixed JSPWIKI-195 - do not allow more than one account with the same email address.
          ==> a new key (security.error.email.taken) was added to CoreResources.properties

Modified:
    jspwiki/trunk/ChangeLog
    jspwiki/trunk/jspwiki-it-tests/jspwiki-selenium-tests/src/main/config/hsql-userdb-setup.sql
    jspwiki/trunk/jspwiki-war/src/main/config/db/hsql.ddl
    jspwiki/trunk/jspwiki-war/src/main/config/db/postgresql.ddl
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/user/DefaultUserProfile.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/user/XMLUserDatabase.java
    jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/ui/InputValidator.java
    jspwiki/trunk/jspwiki-war/src/main/resources/CoreResources.properties
    jspwiki/trunk/jspwiki-war/src/main/resources/CoreResources_nl.properties
    jspwiki/trunk/jspwiki-war/src/test/config/hsql-userdb-setup.ddl

Modified: jspwiki/trunk/ChangeLog
URL: http://svn.apache.org/viewvc/jspwiki/trunk/ChangeLog?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/ChangeLog (original)
+++ jspwiki/trunk/ChangeLog Thu Jul 31 18:46:53 2014
@@ -1,3 +1,12 @@
+2014-07-31  Harry Metske (metskem@apache.org)
+
+       * 2.10.2-svn-5
+
+       * Fixed JSPWIKI-195 - do not allow more than one account with the same email address.
+          ==> a new key (security.error.email.taken) was added to CoreResources.properties
+
+       * minor encoding correction for the CoreResources_nl.properties
+
 2014-07-07  Juan Pablo Santos (juanpablo AT apache DOT org)
 
        * 2.10.2-svn-4

Modified: jspwiki/trunk/jspwiki-it-tests/jspwiki-selenium-tests/src/main/config/hsql-userdb-setup.sql
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-it-tests/jspwiki-selenium-tests/src/main/config/hsql-userdb-setup.sql?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-it-tests/jspwiki-selenium-tests/src/main/config/hsql-userdb-setup.sql
(original)
+++ jspwiki/trunk/jspwiki-it-tests/jspwiki-selenium-tests/src/main/config/hsql-userdb-setup.sql
Thu Jul 31 18:46:53 2014
@@ -14,7 +14,7 @@
 
 create table users (
   uid varchar(100),
-  email varchar(100),
+  email varchar_ignorecase(100),
   full_name varchar(100),
   login_name varchar(100) not null,
   password varchar(100),

Modified: jspwiki/trunk/jspwiki-war/src/main/config/db/hsql.ddl
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/config/db/hsql.ddl?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/config/db/hsql.ddl (original)
+++ jspwiki/trunk/jspwiki-war/src/main/config/db/hsql.ddl Thu Jul 31 18:46:53 2014
@@ -20,7 +20,7 @@ drop user jspwiki;
 
 create table users (
   uid varchar(100),
-  email varchar(100),
+  email varchar_ignorecase(100),
   full_name varchar(100),
   login_name varchar(100) not null,
   password varchar(100),

Modified: jspwiki/trunk/jspwiki-war/src/main/config/db/postgresql.ddl
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/config/db/postgresql.ddl?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/config/db/postgresql.ddl (original)
+++ jspwiki/trunk/jspwiki-war/src/main/config/db/postgresql.ddl Thu Jul 31 18:46:53 2014
@@ -20,7 +20,7 @@ drop user jspwiki;
 
 create table users (
   uid varchar(100),
-  email varchar(100),
+  email varchar_ignorecase(100),
   full_name varchar(100),
   login_name varchar(100) not null primary key,
   password varchar(100),

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/Release.java Thu Jul 31 18:46:53
2014
@@ -72,7 +72,7 @@ public final class Release {
      *  <p>
      *  If the build identifier is empty, it is not added.
      */
-    public static final String     BUILD         = "4";
+    public static final String     BUILD         = "5";
     
     /**
      *  This is the generic version string you should use when printing out the version.
 It is of 

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/UserManager.java Thu Jul
31 18:46:53 2014
@@ -32,6 +32,7 @@ import javax.mail.MessagingException;
 import javax.mail.internet.AddressException;
 import javax.servlet.http.HttpServletRequest;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.log4j.Logger;
 import org.apache.wiki.WikiContext;
 import org.apache.wiki.WikiEngine;
@@ -538,6 +539,7 @@ public class UserManager {
         UserProfile otherProfile;
         String fullName = profile.getFullname();
         String loginName = profile.getLoginName();
+        String email = profile.getEmail();
 
         // It's illegal to use as a full name someone else's login name
         try
@@ -561,7 +563,20 @@ public class UserManager {
             {
                 Object[] args = { loginName };
                 session.addMessage( SESSION_MESSAGES, MessageFormat.format( rb.getString("security.error.illegalloginname"),
-                                                                            args ) );
+                        args ) );
+            }
+        }
+        catch ( NoSuchPrincipalException e)
+        { /* It's clean */ }
+
+        // It's illegal to use multiple accounts with the same email
+        try
+        {
+            otherProfile = getUserDatabase().findByEmail( email );
+            if ( otherProfile != null && !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 ) );
             }
         }
         catch ( NoSuchPrincipalException e)

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/user/DefaultUserProfile.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/user/DefaultUserProfile.java?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/user/DefaultUserProfile.java
(original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/user/DefaultUserProfile.java
Thu Jul 31 18:46:53 2014
@@ -18,6 +18,8 @@
  */
 package org.apache.wiki.auth.user;
 
+import org.apache.commons.lang.StringUtils;
+
 import java.io.Serializable;
 import java.util.Date;
 import java.util.HashMap;
@@ -85,7 +87,7 @@ public final class DefaultUserProfile im
         {
             DefaultUserProfile u = (DefaultUserProfile) o;
             return  same( m_fullname, u.m_fullname ) && same( m_password, u.m_password
)
-                    && same( m_loginName, u.m_loginName ) && same( m_email,
u.m_email ) && same( m_wikiname,
+                    && same( m_loginName, u.m_loginName ) && same(StringUtils.lowerCase(
m_email ), StringUtils.lowerCase( u.m_email ) ) && same( m_wikiname,
                     u.m_wikiname );
         }
 
@@ -98,7 +100,7 @@ public final class DefaultUserProfile im
                (m_password  != null ? m_password.hashCode()  : 0) ^
                (m_loginName != null ? m_loginName.hashCode() : 0) ^
                (m_wikiname  != null ? m_wikiname.hashCode()  : 0) ^
-               (m_email     != null ? m_email.hashCode()     : 0);
+               (m_email     != null ? StringUtils.lowerCase( m_email ).hashCode()     : 0);
     }
 
     /**

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/user/XMLUserDatabase.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/user/XMLUserDatabase.java?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/user/XMLUserDatabase.java
(original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/auth/user/XMLUserDatabase.java
Thu Jul 31 18:46:53 2014
@@ -38,6 +38,7 @@ import java.util.TreeSet;
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.wiki.WikiEngine;
 import org.apache.wiki.api.exceptions.NoRequiredPropertyException;
 import org.apache.wiki.auth.NoSuchPrincipalException;
@@ -623,11 +624,24 @@ public class XMLUserDatabase extends Abs
         NodeList users = c_dom.getElementsByTagName( USER_TAG );
         
         if( users == null ) return null;
-        
+
+        // check if we have to do a case insensitive compare
+        boolean caseSensitiveCompare = true;
+        if (matchAttribute.equals(EMAIL))
+        {
+            caseSensitiveCompare = false;
+        }
+
         for( int i = 0; i < users.getLength(); i++ )
         {
             Element user = (Element) users.item( i );
-            if ( user.getAttribute( matchAttribute ).equals( index ) )
+            String userAttribute = user.getAttribute( matchAttribute );
+            if (!caseSensitiveCompare)
+            {
+                userAttribute = StringUtils.lowerCase(userAttribute);
+                index = StringUtils.lowerCase(index);
+            }
+            if ( userAttribute.equals( index ) )
             {
                 UserProfile profile = newProfile();
                 

Modified: jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/ui/InputValidator.java
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/ui/InputValidator.java?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/ui/InputValidator.java (original)
+++ jspwiki/trunk/jspwiki-war/src/main/java/org/apache/wiki/ui/InputValidator.java Thu Jul
31 18:46:53 2014
@@ -144,8 +144,7 @@ public final class InputValidator
             if ( !valid )
             {
                 Object[] args = { label, "&quot;&#39;&lt;&gt;;&amp;[]#\\@{}%$"
};
-                m_session.addMessage( m_form, MessageFormat.format( rb.getString("validate.unsafechars"),
-                                                                    args ) );
+                m_session.addMessage( m_form, MessageFormat.format( rb.getString("validate.unsafechars"),
args ) );
             }
             return valid;
         case EMAIL:
@@ -154,8 +153,7 @@ public final class InputValidator
             if ( !valid )
             {
                 Object[] args = { label };
-                m_session.addMessage( m_form, MessageFormat.format( rb.getString("validate.invalidemail"),
-                                                                    args ) );
+                m_session.addMessage( m_form, MessageFormat.format( rb.getString("validate.invalidemail"),
args ) );
             }
             return valid;
         case ID:
@@ -164,8 +162,7 @@ public final class InputValidator
             if ( !valid )
             {
                 Object[] args = { label, "&quot;&#39;&lt;&gt;;&amp;{}"
};
-                m_session.addMessage( m_form, MessageFormat.format( rb.getString("validate.unsafechars"),
-                                                                    args ) );
+                m_session.addMessage( m_form, MessageFormat.format( rb.getString("validate.unsafechars"),
args ) );
             }
             return valid;
          default:

Modified: jspwiki/trunk/jspwiki-war/src/main/resources/CoreResources.properties
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/resources/CoreResources.properties?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/resources/CoreResources.properties (original)
+++ jspwiki/trunk/jspwiki-war/src/main/resources/CoreResources.properties Thu Jul 31 18:46:53
2014
@@ -62,6 +62,7 @@ security.error.illegalloginname=Login na
 security.error.cannot.rename=Cannot rename: the login name ''{0}'' is already taken.
 security.error.fullname.taken=Someone with the name of ''{0}'' has already registered.
 security.error.login.taken=The login name ''{0}'' is already taken.
+security.error.email.taken=The email ''{0}'' is already taken, you can use an email for only
one profile.
 
 # These should roughly match whatever is used in default.properties for UserProfile.jsp
 security.user.loginname=Login name

Modified: jspwiki/trunk/jspwiki-war/src/main/resources/CoreResources_nl.properties
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/main/resources/CoreResources_nl.properties?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/main/resources/CoreResources_nl.properties (original)
+++ jspwiki/trunk/jspwiki-war/src/main/resources/CoreResources_nl.properties Thu Jul 31 18:46:53
2014
@@ -59,7 +59,8 @@ security.error.illegalloginname=Ongeldig
 
 security.error.cannot.rename=Kan niet hernoemen: de Login naam ''{0}'' is al in gebruik.
 security.error.fullname.taken=De volledige naam ''{0}'' is al in gebruik.
-security.error.login.taken=De Login naam ''{0}'' is al in gebruik. 
+security.error.login.taken=De Login naam ''{0}'' is al in gebruik.
+security.error.email.taken=Het email adres ''{0}'' is al in gebruik, je kunt een email adres
maar voor één profile gebruiken.
 
 # These should roughly match whatever is used in default.properties for UserProfile.jsp
 security.user.loginname=Login naam
@@ -76,12 +77,12 @@ rename.identical=De pagina namen zijn id
 rename.exists=De pagina "{0}" bestaat reeds. Kies een andere naam of verwijder de pagina
"{0}".
 rename.unknownerror=Er is een onbekende fout opgetreden ({0})
 
-# Login.jsp  
+# Login.jsp
 login.error.password=Geen geldige login.
 login.error.noaccess=U heeft geen toegang tot deze informatie.Sorry.
 
 # Lostpassword.jsp
-  
+
 # 0 = login name, 1 = password, 2 = URL, 3 = Application name (as signature)
 # This is text, not HTML.
 lostpwd.newpassword.email=Zoals aangevraagd, uw nieuwe wachtwoord voor de login "{0}" is
"{1}" \
@@ -119,12 +120,12 @@ userprofile.noroles=(geen)
 # NewGroup.jsp
 newgroup.exists=Groep {0} bestaat reeds. Probeer een andere naam.
 
-# JSPWikiMarkupParser 
+# JSPWikiMarkupParser
 
 markupparser.error.invalidset = Foutief SET commando gevonden: {0}
 markupparser.error.nointerwikiref = Er is geen InterWiki definitie in jspwiki.properties
voor "{0}"!
 markupparser.error.parserfailure = Fout in de Parser: {0}
-markupparser.error.javascriptattempt = Fout in javascript generatie! 
+markupparser.error.javascriptattempt = Fout in javascript generatie!
 markupparser.link.create = Create "{0}"
 
 # Captcha.jsp
@@ -148,9 +149,9 @@ install.jsp.intro.p3=Dit setup systeem i
                      Als je JSPWiki wilt integreren in een bestaande omgeving, dan raad ik
toch aan om de file \
                       <code>jspwiki-custom.properties</code> zelf met het handje
te wijzigen en ergens op het classpath te zetten. Je vindt een voorbeeld op \
                      <a href="https://jspwiki-wiki.apache.org/Wiki.jsp?page=Documentation">
onze wiki </a>.
-install.jsp.install.info=Goed nieuws: 
-install.jsp.install.warning=Waarschuwing: 
-install.jsp.install.error=Kon de configuratie niet opslaan: 
+install.jsp.install.info=Goed nieuws:
+install.jsp.install.warning=Waarschuwing:
+install.jsp.install.error=Kon de configuratie niet opslaan:
 install.jsp.install.msg.rnd.pwd=Omdat er nog geen administrator account bestaat, heeft JSPWiki
er een voor je gemaakt, met een \
                                 random wachtwoord. Je kan dit natuurlijk later zelf wijzigen.
Het account is \
                                 {0} en het  wachtwoord is {1}. \
@@ -159,7 +160,7 @@ install.jsp.install.msg.rnd.pwd=Omdat er
 install.jsp.install.msg.admin.notexists=Is dit de eerste keer dat je de Installer draait
? Zoja, dan moet je weten dat \
                                         nadat JSPWiki je configuratie voor de eerste keer
heeft gevalideerd en opgeslagen, je administratieve rechten \
                                         nodig hebt om deze pagina te benaderen. Dit doen
we om te voorkomen \
-                                        dat willekeurige onverlaten iets engs met je wiki
doen.   
+                                        dat willekeurige onverlaten iets engs met je wiki
doen.
 
 install.jsp.basics.title=Basics
 install.jsp.basics.appname.label=Applicatie naam
@@ -194,7 +195,7 @@ install.jsp.adv.settings.logfile.desc=JS
 install.jsp.adv.settings.workdir.label=Work directory
 install.jsp.adv.settings.workdir.desc=Dit is de plek waar alle caches en andere runtime spullen
worden opgeslagen.
 install.jsp.instr.desc=Als je op <em>Configure!</em> klikt, zal de Installer
je instelling opslaan in <code>{0}</code>. \
-                       Hij zal ook een Administrator account met een random wachtwoord en
een Admin group aanmaken. 
+                       Hij zal ook een Administrator account met een random wachtwoord en
een Admin group aanmaken.
 install.jsp.instr.submit=Configureer!
 install.jsp.validated.new.props=Hier is je hagelnieuwe jspwiki-custom.properties
 

Modified: jspwiki/trunk/jspwiki-war/src/test/config/hsql-userdb-setup.ddl
URL: http://svn.apache.org/viewvc/jspwiki/trunk/jspwiki-war/src/test/config/hsql-userdb-setup.ddl?rev=1614954&r1=1614953&r2=1614954&view=diff
==============================================================================
--- jspwiki/trunk/jspwiki-war/src/test/config/hsql-userdb-setup.ddl (original)
+++ jspwiki/trunk/jspwiki-war/src/test/config/hsql-userdb-setup.ddl Thu Jul 31 18:46:53 2014
@@ -20,7 +20,7 @@ drop table group_members if exists;
 
 create table users (
   uid varchar(100),
-  email varchar(100),
+  email varchar_ignorecase(100),
   full_name varchar(100),
   login_name varchar(100) not null,
   password varchar(100),



Mime
View raw message