portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r1716300 - /portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
Date Wed, 25 Nov 2015 04:39:09 GMT
Author: taylor
Date: Wed Nov 25 04:39:09 2015
New Revision: 1716300

URL: http://svn.apache.org/viewvc?rev=1716300&view=rev
Log:
JS2-1346: Improve User Manager Portlet (wicket) to show and persist email address

Modified:
    portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java

Modified: portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java?rev=1716300&r1=1716299&r2=1716300&view=diff
==============================================================================
--- portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
(original)
+++ portals/jetspeed-2/applications/j2-admin/trunk/src/main/java/org/apache/jetspeed/portlets/security/JetspeedPrincipalManagementPortlet.java
Wed Nov 25 04:39:09 2015
@@ -86,6 +86,7 @@ import org.apache.wicket.model.PropertyM
 import org.apache.wicket.model.ResourceModel;
 import org.apache.wicket.validation.IValidatable;
 import org.apache.wicket.validation.validator.AbstractValidator;
+import org.apache.wicket.validation.validator.EmailAddressValidator;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -594,6 +595,8 @@ public class JetspeedPrincipalManagement
 
         String userName;
 
+        String email;
+
         String password;
 
         boolean checkpass;
@@ -634,6 +637,14 @@ public class JetspeedPrincipalManagement
             this.userName = userName;
         }
 
+        public String getEmail() {
+            return email;
+        }
+
+        public void setEmail(String email) {
+            this.email = email;
+        }
+
         /**
          * @return the password
          */
@@ -689,6 +700,9 @@ public class JetspeedPrincipalManagement
                     new PropertyModel(this, "userName"));
             userName.add(new PrincipalNameValidator());
             userForm.add(userName);
+            TextField email = new TextField("email", new PropertyModel(this, "email"));
+            email.add(new PrincipalEmailValidator());
+            userForm.add(email);
             TextField password = new PasswordTextField("password",
                     new PropertyModel(this, "password"));
             userForm.add(password);
@@ -754,7 +768,11 @@ public class JetspeedPrincipalManagement
                                 }
                             }
                         }
-                        
+
+                        if (!StringUtils.isEmpty(getEmail())) {
+                            user.getSecurityAttributes().getAttribute("user.business-info.online.email",
true).setStringValue(getEmail());
+                        }
+
                         String subSite;
                         if (!StringUtils.isEmpty(defaultSubsite))
                         {
@@ -890,6 +908,19 @@ public class JetspeedPrincipalManagement
         }
     }
 
+    private class PrincipalEmailValidator extends EmailAddressValidator
+    {
+
+        public PrincipalEmailValidator()
+        {
+        }
+        @Override
+        protected void onValidate(IValidatable validatable)
+        {
+            super.onValidate(validatable);
+        }
+    }
+
     protected class PrincipalStatusPanel extends Panel
     {
 



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message