- Improved user edit support
authorzapata <zapata>
Wed, 5 Mar 2003 04:33:29 +0000 (04:33 +0000)
committerzapata <zapata>
Wed, 5 Mar 2003 04:33:29 +0000 (04:33 +0000)
- Support for optional encrypted password storage

bundles/admin_en.properties
source/mir/module/AbstractModule.java
source/mir/servlet/ServletModule.java
source/mircoders/localizer/MirAdminInterfaceLocalizer.java
source/mircoders/localizer/basic/MirBasicAdminInterfaceLocalizer.java
source/mircoders/module/ModuleUsers.java
source/mircoders/servlet/ServletModuleUsers.java
templates/admin/user.template

index 61dc5a1..aae640d 100755 (executable)
@@ -1,6 +1,6 @@
 ########## admin ##########
 # language: english
-# $Id: admin_en.properties,v 1.36 2003/03/04 22:00:51 zapata Exp $
+# $Id: admin_en.properties,v 1.37 2003/03/05 04:33:29 zapata Exp $
 
 languagename=English
 
@@ -309,6 +309,7 @@ topiclist.htmltitle=topiclist
 user.htmltitle=User
 user.login=Login
 user.password=Password
+user.password2=Password (confirmation)
 user.admin=Admin
 
 userlist.htmltitle=Users
index 2324e19..0a70fca 100755 (executable)
@@ -169,7 +169,8 @@ public class AbstractModule {
       theEntity.setStorage(theStorage);
       theEntity.setValues(theValues);
       return theEntity.insert();
-    } catch (Exception e) {
+    }
+    catch (Exception e) {
       throw new ModuleException(e.toString());
     }
   }
@@ -184,7 +185,7 @@ public class AbstractModule {
     try {
       Entity theEntity = theStorage.selectById((String)theValues.get("id"));
       if (theEntity == null)
-        throw new ModuleException("Kein Objekt mit id in Datenbank id: " + theValues.get("id"));
+        throw new ModuleException("No object found with id " + theValues.get("id"));
       theEntity.setValues(theValues);
       theEntity.update();
       return theEntity.getId();
index 3d67860..265fb97 100755 (executable)
@@ -193,7 +193,7 @@ public abstract class ServletModule {
    * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
    */\r
   public void add(HttpServletRequest req, HttpServletResponse res)\r
-      throws ServletModuleException {\r
+      throws ServletModuleException, ServletModuleUserException {\r
 \r
     try {\r
       SimpleHash mergeData = new SimpleHash();\r
@@ -233,7 +233,7 @@ public abstract class ServletModule {
    *\r
    */\r
 \r
-  public void delete(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException {\r
+  public void delete(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException, ServletModuleUserException {\r
     try {\r
       String idParam = req.getParameter("id");\r
 \r
@@ -288,10 +288,22 @@ public abstract class ServletModule {
    * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
    */\r
   public void edit(HttpServletRequest req, HttpServletResponse res)\r
-      throws ServletModuleException {\r
+      throws ServletModuleException, ServletModuleUserException {\r
+    edit(req, res, req.getParameter("id"));\r
+  }\r
+\r
+  /**\r
+   *  edit(req,res) - generische Editmethode. Wennn die Funktionalitaet\r
+   *  nicht reicht, muss sie in der abgeleiteten ServletModule-Klasse\r
+   *  ueberschreiben werden.\r
+   *\r
+   * @param req Http-Request, das vom Dispatcher durchgereicht wird\r
+   * @param res Http-Response, die vom Dispatcher durchgereicht wird\r
+   */\r
+  public void edit(HttpServletRequest aRequest, HttpServletResponse aResponse, String anIdentifier)\r
+      throws ServletModuleException, ServletModuleUserException {\r
     try {\r
-      String idParam = req.getParameter("id");\r
-      deliver(req, res, mainModule.getById(idParam), templateObjektString);\r
+      deliver(aRequest, aResponse, mainModule.getById(anIdentifier), templateObjektString);\r
     }\r
     catch (ModuleException e) {\r
       throw new ServletModuleException(e.getMessage());\r
@@ -308,7 +320,7 @@ public abstract class ServletModule {
    */\r
 \r
   public void update(HttpServletRequest req, HttpServletResponse res)\r
-      throws ServletModuleException {\r
+      throws ServletModuleException, ServletModuleUserException {\r
     try {\r
       String idParam = req.getParameter("id");\r
       Map withValues = getIntersectingValues(req, mainModule.getStorageObject());\r
index 3cff995..8afb19f 100755 (executable)
@@ -54,9 +54,31 @@ public interface MirAdminInterfaceLocalizer {
    */
   public void initializeArticle(Map anArticle);
 
+  /**
+   * Allows passwords to be stored encrypted in the database. Just implement this
+   * function and return a digest of the supplied password. This function should always
+   * return the same digest for the same password.
+   *
+   * @param aPassword The password to be digested
+   * @return The digested password
+   */
+  public String makePasswordDigest(String aPassword);
+
+
+  /**
+   *
+   * @return
+   */
   public List simpleCommentOperations();
+
+  /**
+   *
+   * @param aName
+   * @return
+   */
   public MirSimpleEntityOperation simpleCommentOperationForName(String aName);
 
+
   public List simpleArticleOperations();
   public MirSimpleEntityOperation simpleArticleOperationForName(String aName);
 
index 06c3200..1d87158 100755 (executable)
@@ -72,6 +72,10 @@ public class MirBasicAdminInterfaceLocalizer implements MirAdminInterfaceLocaliz
     addSimpleCommentOperation(new ModifyCommentFieldOperation("hide", "is_published", "0"));\r
   }\r
 \r
+  public String makePasswordDigest(String aPassword) {\r
+    return aPassword;\r
+  }\r
+\r
   public void initializeArticle(Map anArticle) {\r
     anArticle.put("is_published", "0");\r
     anArticle.put("date", StringUtil.date2webdbDate(new GregorianCalendar()));\r
index 07bf5b2..4310dc9 100755 (executable)
-/*
- * Copyright (C) 2001, 2002  The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two.  You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries.  If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so.  If you do
- * not wish to do so, delete this exception statement from your version.
- */
-
-package mircoders.module;
-
-import mir.entity.EntityList;
-import mir.log.LoggerWrapper;
-import mir.module.AbstractModule;
-import mir.module.ModuleException;
-import mir.storage.StorageObject;
-import mir.storage.StorageObjectFailure;
-import mircoders.entity.EntityUsers;
-import mircoders.storage.DatabaseUsers;
-import freemarker.template.SimpleList;
-
-
-/*
- *  Users Module -
- *
- *
- * @author RK
- */
-
-public class ModuleUsers extends AbstractModule
-{
-  static LoggerWrapper logger = new LoggerWrapper("Module.Users");
-
-  public ModuleUsers(StorageObject theStorage)
-  {
-    if (theStorage == null)
-      logger.warn("StorageObject was null!");
-
-    this.theStorage = theStorage;
-  }
-
-  /**
-   * login method
-   */
-
-  public EntityUsers getUserForLogin(String user, String password) throws ModuleException
-  {
-    String whereString = "login='" +user + "' and password='"+ password + "' and is_admin='1'";
-    EntityList userList = getByWhereClause(whereString, -1);
-    if (userList != null && userList.getCount()==1)
-      return (EntityUsers)userList.elementAt(0);
-    else
-      return null;
-  }
-
-  public EntityList getUsers(String whereClause, int offset, int limit) throws ModuleException
-  {
-    try {
-      return theStorage.selectByWhereClause(whereClause, null, offset, limit);
-    }
-    catch (StorageObjectFailure e){
-      throw new ModuleException(e.toString());
-    }
-  }
-
-  public SimpleList getUsersAsSimpleList() throws ModuleException {
-    try {
-      return ((DatabaseUsers)theStorage).getPopupData();
-    }
-    catch(StorageObjectFailure e) {
-      throw new ModuleException(e.toString());
-    }
-  }
+/*\r
+ * Copyright (C) 2001, 2002  The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with the com.oreilly.servlet library, any library\r
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
+ * the above that use the same license as the above), and distribute linked\r
+ * combinations including the two.  You must obey the GNU General Public\r
+ * License in all respects for all of the code used other than the above\r
+ * mentioned libraries.  If you modify this file, you may extend this exception\r
+ * to your version of the file, but you are not obligated to do so.  If you do\r
+ * not wish to do so, delete this exception statement from your version.\r
+ */\r
+\r
+package mircoders.module;\r
+\r
+import java.util.Map;\r
+import java.util.HashMap;\r
+\r
+import mir.entity.EntityList;\r
+import mir.log.LoggerWrapper;\r
+import mir.module.AbstractModule;\r
+import mir.module.ModuleException;\r
+import mir.storage.StorageObject;\r
+import mir.storage.StorageObjectFailure;\r
+import mir.util.JDBCStringRoutines;\r
+\r
+import mircoders.entity.EntityUsers;\r
+import mircoders.storage.DatabaseUsers;\r
+import mircoders.global.MirGlobal;\r
+import mircoders.localizer.MirAdminInterfaceLocalizer;\r
+import mircoders.localizer.MirLocalizer;\r
+\r
+\r
+/*\r
+ *  Users Module -\r
+ *\r
+ *\r
+ * @author RK\r
+ */\r
+\r
+public class ModuleUsers extends AbstractModule\r
+{\r
+  static LoggerWrapper logger = new LoggerWrapper("Module.Users");\r
+\r
+  public ModuleUsers(StorageObject theStorage)\r
+  {\r
+    if (theStorage == null)\r
+      logger.warn("ModuleUsers(): StorageObject was null!");\r
+\r
+    this.theStorage = theStorage;\r
+  }\r
+\r
+  /**\r
+   * Authenticate and lookup a user\r
+   *\r
+   * @param user              The user to lookup\r
+   * @param password          The password\r
+   * @return                  The authenticated user, or <code>null</code> if the user\r
+   *                          doesn't exist, or the supplied password is invalid.\r
+   * @throws ModuleException\r
+   */\r
+\r
+  public EntityUsers getUserForLogin(String user, String password) throws ModuleException\r
+  {\r
+    try {\r
+      String whereString =\r
+          "login='" + JDBCStringRoutines.escapeStringLiteral(user) + "' " +\r
+          "and password='" + JDBCStringRoutines.escapeStringLiteral(\r
+          MirGlobal.localizer().adminInterface().makePasswordDigest(password)) +\r
+          "' " +\r
+          "and is_admin='1'";\r
+\r
+      EntityList userList = getByWhereClause(whereString, -1);\r
+\r
+      if (userList != null && userList.getCount() == 1)\r
+        return (EntityUsers) userList.elementAt(0);\r
+      else\r
+        return null;\r
+    }\r
+    catch (Throwable t) {\r
+      throw new ModuleException(t.getMessage());\r
+    }\r
+  }\r
+\r
+  private Map digestPassword(Map aValues) throws ModuleException {\r
+    Map result = aValues;\r
+\r
+    try {\r
+      if (aValues.containsKey("password")) {\r
+        result = new HashMap();\r
+        result.putAll(aValues);\r
+        result.put("password",\r
+            MirGlobal.localizer().adminInterface().\r
+            makePasswordDigest( (String) aValues.get("password")));\r
+      }\r
+    }\r
+    catch (Throwable t) {\r
+      throw new ModuleException("ModuleUsers.add: " + t.getMessage());\r
+    }\r
+\r
+    return result;\r
+  }\r
+\r
+  public String add (Map theValues) throws ModuleException {\r
+    return super.add(digestPassword(theValues));\r
+  }\r
+\r
+  /**\r
+   * Standardfunktion, um einen Datensatz via StorageObject zu aktualisieren\r
+   * @param theValues Hash mit Spalte/Wert-Paaren\r
+   * @return Id des eingef?gten Objekts\r
+   * @exception ModuleException\r
+   */\r
+  public String set (Map theValues) throws ModuleException {\r
+    return super.set(digestPassword(theValues));\r
+  }\r
+\r
 }
\ No newline at end of file
index 15b455f..b7506df 100755 (executable)
-/*
- * Copyright (C) 2001, 2002  The Mir-coders group
- *
- * This file is part of Mir.
- *
- * Mir is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * Mir is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Mir; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- *
- * In addition, as a special exception, The Mir-coders gives permission to link
- * the code of this program with the com.oreilly.servlet library, any library
- * licensed under the Apache Software License, The Sun (tm) Java Advanced
- * Imaging library (JAI), The Sun JIMI library (or with modified versions of
- * the above that use the same license as the above), and distribute linked
- * combinations including the two.  You must obey the GNU General Public
- * License in all respects for all of the code used other than the above
- * mentioned libraries.  If you modify this file, you may extend this exception
- * to your version of the file, but you are not obligated to do so.  If you do
- * not wish to do so, delete this exception statement from your version.
- */
-
-package mircoders.servlet;
-
-import java.util.Map;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import mir.log.LoggerWrapper;
-import mir.module.ModuleException;
-import mir.servlet.ServletModule;
-import mir.servlet.ServletModuleException;
-import mir.storage.StorageObjectFailure;
-import mircoders.module.ModuleUsers;
-import mircoders.storage.DatabaseUsers;
-import freemarker.template.SimpleHash;
-
-/*
- *  ServletModuleUsers -
- *  liefert HTML fuer Users
- *
- *
- * @author RK
- */
-
-public class ServletModuleUsers extends mir.servlet.ServletModule
-{
-  private static ServletModuleUsers instance = new ServletModuleUsers();
-  public static ServletModule getInstance() { return instance; }
-
-  private ServletModuleUsers() {
-    super();
-    logger = new LoggerWrapper("ServletModule.Users");
-
-    templateListString = configuration.getString("ServletModule.Users.ListTemplate");
-    templateObjektString = configuration.getString("ServletModule.Users.ObjektTemplate");
-    templateConfirmString = configuration.getString("ServletModule.Users.ConfirmTemplate");
-
-    try {
-      mainModule = new ModuleUsers(DatabaseUsers.getInstance());
-    }
-    catch (StorageObjectFailure e) {
-      logger.debug("initialization of ServletModuleUsers failed!: " + e.getMessage());
-    }
-  }
-
-  public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException
-  {
-    String idParam = req.getParameter("id");
-
-    if (idParam == null)
-      throw new ServletModuleException("ServletModuleUser.edit: invalid call: (id) not specified");
-
-    try {
-      deliver(req, res, mainModule.getById(idParam), templateObjektString);
-    }
-    catch (ModuleException e) {
-      throw new ServletModuleException(e.toString());
-    }
-  }
-
-  public void add(HttpServletRequest req, HttpServletResponse res)
-      throws ServletModuleException
-  {
-    try {
-      SimpleHash mergeData = new SimpleHash();
-      mergeData.put("new", "1");
-      deliver(req, res, mergeData, templateObjektString);
-    }
-    catch (Exception e) { throw new ServletModuleException(e.toString());}
-  }
-
-  public void insert(HttpServletRequest req, HttpServletResponse res)
-      throws ServletModuleException
-  {
-    try {
-      Map withValues = getIntersectingValues(req, mainModule.getStorageObject());
-      String id = mainModule.add(withValues);
-      deliver(req, res, mainModule.getById(id), templateObjektString);
-    }
-    catch (Exception e) { throw new ServletModuleException(e.toString());}
-  }
-}
+/*\r
+ * Copyright (C) 2001, 2002  The Mir-coders group\r
+ *\r
+ * This file is part of Mir.\r
+ *\r
+ * Mir is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * Mir is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License\r
+ * along with Mir; if not, write to the Free Software\r
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA\r
+ *\r
+ * In addition, as a special exception, The Mir-coders gives permission to link\r
+ * the code of this program with the com.oreilly.servlet library, any library\r
+ * licensed under the Apache Software License, The Sun (tm) Java Advanced\r
+ * Imaging library (JAI), The Sun JIMI library (or with modified versions of\r
+ * the above that use the same license as the above), and distribute linked\r
+ * combinations including the two.  You must obey the GNU General Public\r
+ * License in all respects for all of the code used other than the above\r
+ * mentioned libraries.  If you modify this file, you may extend this exception\r
+ * to your version of the file, but you are not obligated to do so.  If you do\r
+ * not wish to do so, delete this exception statement from your version.\r
+ */\r
+\r
+package mircoders.servlet;\r
+\r
+import java.util.Map;\r
+\r
+import javax.servlet.http.HttpServletRequest;\r
+import javax.servlet.http.HttpServletResponse;\r
+\r
+import freemarker.template.SimpleHash;\r
+\r
+import mir.log.LoggerWrapper;\r
+import mir.module.ModuleException;\r
+import mir.servlet.ServletModule;\r
+import mir.servlet.ServletModuleException;\r
+import mir.servlet.ServletModuleUserException;\r
+import mir.storage.StorageObjectFailure;\r
+import mir.util.HTTPRequestParser;\r
+\r
+import mircoders.module.ModuleUsers;\r
+import mircoders.storage.DatabaseUsers;\r
+\r
+/*\r
+ *  ServletModuleUsers -\r
+ *  liefert HTML fuer Users\r
+ *\r
+ *\r
+ * @author RK\r
+ */\r
+\r
+public class ServletModuleUsers extends ServletModule\r
+{\r
+  private static ServletModuleUsers instance = new ServletModuleUsers();\r
+  public static ServletModule getInstance() { return instance; }\r
+\r
+  private ServletModuleUsers() {\r
+    super();\r
+    logger = new LoggerWrapper("ServletModule.Users");\r
+\r
+    templateListString = configuration.getString("ServletModule.Users.ListTemplate");\r
+    templateObjektString = configuration.getString("ServletModule.Users.ObjektTemplate");\r
+    templateConfirmString = configuration.getString("ServletModule.Users.ConfirmTemplate");\r
+\r
+    try {\r
+      mainModule = new ModuleUsers(DatabaseUsers.getInstance());\r
+    }\r
+    catch (StorageObjectFailure e) {\r
+      logger.debug("initialization of ServletModuleUsers failed!: " + e.getMessage());\r
+    }\r
+  }\r
+\r
+  public void edit(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException\r
+  {\r
+    String idParam = req.getParameter("id");\r
+\r
+    if (idParam == null)\r
+      throw new ServletModuleException("ServletModuleUser.edit: invalid call: (id) not specified");\r
+\r
+    try {\r
+      deliver(req, res, mainModule.getById(idParam), templateObjektString);\r
+    }\r
+    catch (ModuleException e) {\r
+      throw new ServletModuleException(e.toString());\r
+    }\r
+  }\r
+\r
+  public void add(HttpServletRequest req, HttpServletResponse res)\r
+      throws ServletModuleException\r
+  {\r
+    try {\r
+      SimpleHash mergeData = new SimpleHash();\r
+      mergeData.put("new", "1");\r
+      deliver(req, res, mergeData, templateObjektString);\r
+    }\r
+    catch (Exception e) { throw new ServletModuleException(e.toString());}\r
+  }\r
+\r
+  public String checkPassword(HTTPRequestParser aRequestParser) throws ServletModuleException, ServletModuleUserException\r
+  {\r
+    if ( (aRequestParser.getParameter("newpassword") != null &&\r
+          aRequestParser.getParameter("newpassword").length() > 0) ||\r
+        (aRequestParser.getParameter("newpassword2") != null &&\r
+         aRequestParser.getParameter("newpassword2").length() > 0)\r
+        ) {\r
+      String newPassword = aRequestParser.getParameterWithDefault("newpassword", "");\r
+      String newPassword2 = aRequestParser.getParameterWithDefault("newpassword2", "");\r
+\r
+      if (newPassword.length() == 0 || newPassword2.length() == 0) {\r
+        throw new ServletModuleUserException(\r
+            "The new password must be entered twice!");\r
+      }\r
+\r
+      if (!newPassword.equals(newPassword2)) {\r
+        throw new ServletModuleUserException(\r
+            "New password differes from confirmation");\r
+      }\r
+\r
+      return newPassword;\r
+    }\r
+    else\r
+      return null;\r
+  }\r
+\r
+  public void insert(HttpServletRequest aRequest, HttpServletResponse aResponse)\r
+      throws ServletModuleException\r
+  {\r
+    try {\r
+      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
+      Map withValues = getIntersectingValues(aRequest, mainModule.getStorageObject());\r
+\r
+      String newPassword=checkPassword(requestParser);\r
+      if (newPassword!=null)\r
+        withValues.put("password", newPassword);\r
+      else\r
+        throw new ServletModuleUserException("Password is empty");\r
+\r
+      String id = mainModule.add(withValues);\r
+      if (requestParser.hasParameter("returnurl"))\r
+        redirect(aResponse, requestParser.getParameter("returnurl"));\r
+      else\r
+        list(aRequest, aResponse);\r
+    }\r
+    catch (Exception e) {\r
+      throw new ServletModuleException(e.toString());\r
+    }\r
+  }\r
+\r
+  public void update(HttpServletRequest aRequest, HttpServletResponse aResponse) throws ServletModuleException, ServletModuleUserException\r
+  {\r
+    try {\r
+      HTTPRequestParser requestParser = new HTTPRequestParser(aRequest);\r
+\r
+      Map withValues = getIntersectingValues(aRequest, mainModule.getStorageObject());\r
+\r
+      String newPassword=checkPassword(requestParser);\r
+      if (newPassword!=null)\r
+        withValues.put("password", newPassword);\r
+\r
+      mainModule.set(withValues);\r
+\r
+      if (requestParser.hasParameter("returnurl"))\r
+        redirect(aResponse, requestParser.getParameter("returnurl"));\r
+      else\r
+        list(aRequest, aResponse);\r
+    }\r
+    catch (Throwable t) {\r
+      throw new ServletModuleException("ServletModuleUsers: " + t.getMessage());\r
+    }\r
+\r
+  }\r
+\r
+\r
+}\r
index 078413e..1ddfaf3 100755 (executable)
@@ -1,59 +1,78 @@
 <html>
-<head>
-  <title>${config["Mir.Name"]} | ${lang("user.htmltitle")}</title>
-  <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
-<head>
+  <head>
+    <title>${config["Mir.Name"]} | ${lang("user.htmltitle")}</title>
+    <link rel="stylesheet" type="text/css" href="${config.docRoot}/style/admin.css">
+  <head>
 
-<body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
+  <body marginwidth="0" marginheight="0" topmargin="0" leftmargin="0">
 
-<include "templates/admin/head.template">
-<form action="${config.actionRoot}" method="post">
-       <input type="hidden" name="module" value="Users">
-       <input type="hidden" name="id" value="${data.id}">
-       <if data.new>
-         <input type="hidden" name="do" value="insert">
-       <else>
-         <input type="hidden" name="do" value="update">
-       </if>
+  <include "templates/admin/head.template">
 
-  <table border="0">
-    <tr> 
-      <td align="right" class="darkgrey"><span class="witesmall">
-       <B>${lang("user.login")}:</B></span></td>
-      <td>
-        <input type="text" size="40" name="login" value="${data.login}">
-      </td>
-    </tr>
-    <tr>
-      <td align="right" class="darkgrey"><span class="witesmall">
-       <B>${lang("user.password")}:</B></span></td>
-      <td>
-        <input type="password" size="20" name="password" value="${data.password}">
-      </td>
-    </tr>
-    <tr>
-      <td align="right" class="darkgrey">
-        <span class="witesmall">
-             <b>${lang("user.admin")}:</b>
-           </span>
-         </td>
-      <td>
-           <input type="checkbox" name="is_admin" value="1"<if data.is_admin=="1"> checked</if>>
-      </td>
-    </tr>
-    <tr>
-      <td colspan="2" align="right"> 
-        <span class="witetext">
-          <if data.new>
-            <input type="submit" name="save" value="${lang("insert")}">
-          <else>
-            <input type="submit" name="save" value="${lang("save")}">
-          </if> 
-        </span>
-      </td>
-    </tr>
-  </table>
-</form>
-<include "templates/admin/foot.template">
-</body>
+    <form action="${config.actionRoot}" method="post">
+      <input type="hidden" name="module" value="Users">
+      <input type="hidden" name="id" value="${data.id}">
+      <if data.new>
+        <input type="hidden" name="do" value="insert">
+      <else>
+        <input type="hidden" name="do" value="update">
+      </if>
+    
+      <table border="0">
+        <tr> 
+          <td align="right" class="darkgrey">
+            <span class="witesmall">
+              <b>${lang("user.login")}:</b>
+            </span>
+          </td>
+          <td>
+            <input type="text" size="40" name="login" value="${data.login}">
+          </td>
+        </tr>
+        <tr>
+          <td align="right" class="darkgrey">
+            <span class="witesmall">
+              <b>${lang("user.password")}:</b>
+            </span>
+          </td>
+          <td>
+            <input type="password" size="20" name="newpassword" value="">
+          </td>
+        </tr>
+        <tr>
+          <td align="right" class="darkgrey">
+            <span class="witesmall">
+              <b>${lang("user.password2")}:</b>
+            </span>
+          </td>
+          <td>
+            <input type="password" size="20" name="newpassword2" value="">
+          </td>
+        </tr>
+        <tr>
+          <td align="right" class="darkgrey">
+            <span class="witesmall">
+              <b>${lang("user.admin")}:</b>
+            </span>
+          </td>
+          <td>
+            <input type="checkbox" name="is_admin" value="1"<if data.is_admin=="1"> checked</if>>
+          </td>
+        </tr>
+        <tr>
+          <td colspan="2" align="right"> 
+            <span class="witetext">
+              <if data.new>
+                <input type="submit" name="save" value="${lang("insert")}">
+              <else>
+                <input type="submit" name="save" value="${lang("save")}">
+              </if> 
+            </span>
+          </td>
+        </tr>
+      </table>
+    </form>
+    
+    <include "templates/admin/foot.template">
+  
+  </body>
 </html>