Author: solomax
Date: Fri Apr 26 05:23:01 2013
New Revision: 1476041

URL: http://svn.apache.org/r1476041
Log:
[OPENMEETINGS-615] confirm password is added to User profile panel

Added:
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/UserForm.html
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/UserForm.java
Modified:
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/ProfilePanel.html
    
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/ProfilePanel.java

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/ProfilePanel.html
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/ProfilePanel.html?rev=1476041&r1=1476040&r2=1476041&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/ProfilePanel.html
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/ProfilePanel.html
 Fri Apr 26 05:23:01 2013
@@ -29,9 +29,7 @@
                                                <legend>
                                                        <wicket:ommessage 
key="143" />
                                                </legend>
-                                               <form wicket:id="general">
-                                                       Confirm password
-                                               </form>
+                                               <form 
wicket:id="general"></form>
                                        </fieldset>
                                </td>
                                <td>

Modified: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/ProfilePanel.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/ProfilePanel.java?rev=1476041&r1=1476040&r2=1476041&view=diff
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/ProfilePanel.java
 (original)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/ProfilePanel.java
 Fri Apr 26 05:23:01 2013
@@ -25,12 +25,13 @@ import org.apache.openmeetings.data.user
 import org.apache.openmeetings.persistence.beans.user.User;
 import org.apache.openmeetings.web.components.ComunityUserForm;
 import org.apache.openmeetings.web.components.FormSaveRefreshPanel;
-import org.apache.openmeetings.web.components.GeneralUserForm;
 import org.apache.openmeetings.web.components.UploadableProfileImagePanel;
 import org.apache.openmeetings.web.components.UserPanel;
 import org.apache.wicket.ajax.AjaxRequestTarget;
+import org.apache.wicket.ajax.form.AjaxFormValidatingBehavior;
 import org.apache.wicket.markup.html.form.Form;
 import org.apache.wicket.model.CompoundPropertyModel;
+import org.apache.wicket.util.time.Duration;
 
 public class ProfilePanel extends UserPanel {
        private static final long serialVersionUID = -5837090230776586182L;
@@ -69,9 +70,13 @@ public class ProfilePanel extends UserPa
                                                
                                        }
                                });
-                               add(new GeneralUserForm("general", getModel()));
+                               add(new UserForm("general", getModel()));
                                add(new UploadableProfileImagePanel("img", 
getUserId()));
                                add(new ComunityUserForm("comunity", 
getModel()));
+                               
+                               // attach an ajax validation behavior to all 
form component's keydown
+                               // event and throttle it down to once per second
+                               
AjaxFormValidatingBehavior.addToAllFormComponents(this, "keydown", 
Duration.ONE_SECOND);
                        }
                };
                add(form);

Added: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/UserForm.html
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/UserForm.html?rev=1476041&view=auto
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/UserForm.html
 (added)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/UserForm.html
 Fri Apr 26 05:23:01 2013
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  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
+  regarding copyright ownership.  The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License.  You may obtain a copy of the License at
+  
+      http://www.apache.org/licenses/LICENSE-2.0
+         
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "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.
+  
+-->
+<html xmlns:wicket="http://wicket.apache.org";>
+<wicket:extend>
+       <div class="formelement">
+               <label><wicket:ommessage key="134" /></label><input 
type="password" wicket:id="confirmPassword" />
+       </div>
+</wicket:extend>
+</html>

Added: 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/UserForm.java
URL: 
http://svn.apache.org/viewvc/openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/UserForm.java?rev=1476041&view=auto
==============================================================================
--- 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/UserForm.java
 (added)
+++ 
openmeetings/trunk/singlewebapp/src/org/apache/openmeetings/web/components/user/profile/UserForm.java
 Fri Apr 26 05:23:01 2013
@@ -0,0 +1,46 @@
+/*
+ * 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
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License") +  you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "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.
+ */
+package org.apache.openmeetings.web.components.user.profile;
+
+import org.apache.openmeetings.persistence.beans.user.User;
+import org.apache.openmeetings.web.app.WebSession;
+import org.apache.openmeetings.web.components.GeneralUserForm;
+import org.apache.wicket.markup.html.form.PasswordTextField;
+import org.apache.wicket.model.IModel;
+import org.apache.wicket.model.Model;
+
+public class UserForm extends GeneralUserForm {
+       private static final long serialVersionUID = 1305752513494262480L;
+       private final PasswordTextField confirmPassword;
+       
+       public UserForm(String id, IModel<User> model) {
+               super(id, model);
+               add(confirmPassword = new PasswordTextField("confirmPassword", 
new Model<String>()));
+               confirmPassword.setRequired(false);
+       }
+       
+       @Override
+       protected void onValidate() {
+               String pass = getPasswordField().getConvertedInput();
+               if (pass != null && !pass.isEmpty() && 
!pass.equals(confirmPassword.getConvertedInput())) {
+                       error(WebSession.getString(232));
+               }
+               super.onValidate();
+       }
+}


Reply via email to