[kune-commits] r1667 - in trunk/src/main/java/cc/kune: core/client core/client/rpcservices core/client/sitebar core/client/sitebar/auth core/client/state/impl core/server/manager core/server/manager/impl core/server/rpc gspace/client gspace/client/options gspace/client/options/general gspace/client/options/license

Vicente J. Ruiz Jurado vjrj_ at ourproject.org
Wed Jan 18 16:27:17 CET 2012


Author: vjrj_
Date: 2012-01-18 16:27:17 +0100 (Wed, 18 Jan 2012)
New Revision: 1667

Modified:
   trunk/src/main/java/cc/kune/core/client/CoreParts.java
   trunk/src/main/java/cc/kune/core/client/rpcservices/UserService.java
   trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java
   trunk/src/main/java/cc/kune/core/client/sitebar/auth/PasswordResetPanel.java
   trunk/src/main/java/cc/kune/core/client/sitebar/auth/VerifyEmailClientManager.java
   trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/manager/UserManager.java
   trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
   trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
   trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
   trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsCollection.java
   trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsCollection.java
   trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralPanel.java
   trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralView.java
   trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneral.java
   trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPresenter.java
   trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptDefLicensePresenter.java
Log:
Password recovery small fixes

Modified: trunk/src/main/java/cc/kune/core/client/CoreParts.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreParts.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/core/client/CoreParts.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -46,6 +46,8 @@
 import cc.kune.gspace.client.options.GroupOptions;
 import cc.kune.gspace.client.options.UserOptions;
 
+import com.google.gwt.core.client.Scheduler;
+import com.google.gwt.core.client.Scheduler.ScheduledCommand;
 import com.google.gwt.event.shared.EventBus;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
@@ -80,7 +82,12 @@
     tokenListener.put(SiteTokens.SIGN_IN, new HistoryTokenAuthNotNeededCallback() {
       @Override
       public void onHistoryToken(final String token) {
-        signIn.get().showSignInDialog();
+        Scheduler.get().scheduleFinally(new ScheduledCommand() {
+          @Override
+          public void execute() {
+            signIn.get().showSignInDialog();
+          }
+        });
       }
     });
     tokenListener.put(SiteTokens.ABOUT_KUNE, new HistoryTokenAuthNotNeededCallback() {
@@ -99,7 +106,12 @@
     tokenListener.put(SiteTokens.NEW_GROUP, new HistoryTokenMustBeAuthCallback() {
       @Override
       public void onHistoryToken(final String token) {
-        newGroup.get().doNewGroup();
+        Scheduler.get().scheduleFinally(new ScheduledCommand() {
+          @Override
+          public void execute() {
+            newGroup.get().doNewGroup();
+          }
+        });
       }
     });
     tokenListener.put(SiteTokens.SUBTITLES, new HistoryTokenAuthNotNeededCallback() {
@@ -123,30 +135,51 @@
     tokenListener.put(SiteTokens.PREFS, new HistoryTokenMustBeAuthCallback() {
       @Override
       public void onHistoryToken(final String token) {
-        SpaceSelectEvent.fire(eventBus, Space.groupSpace);
-        userOptionsDialog.get().show();
+        Scheduler.get().scheduleFinally(new ScheduledCommand() {
+          @Override
+          public void execute() {
+            SpaceSelectEvent.fire(eventBus, Space.groupSpace);
+            userOptionsDialog.get().show();
+          }
+        });
       }
     });
     tokenListener.put(SiteTokens.GROUP_PREFS, new HistoryTokenMustBeAuthCallback() {
       @Override
       public void onHistoryToken(final String token) {
-        groupOptionsDialog.get().show(token);
+        Scheduler.get().scheduleFinally(new ScheduledCommand() {
+          @Override
+          public void execute() {
+            groupOptionsDialog.get().show(token);
+          }
+        });
       }
     });
     tokenListener.put(SiteTokens.RESET_PASSWD, new HistoryTokenAuthNotNeededCallback() {
       @Override
       public void onHistoryToken(final String token) {
-        if (!session.isLogged()) {
-          askForPass.get().show();
-        }
+        Scheduler.get().scheduleFinally(new ScheduledCommand() {
+          @Override
+          public void execute() {
+            if (!session.isLogged()) {
+              askForPass.get().show();
+            }
+          }
+        });
       }
     });
     tokenListener.put(SiteTokens.ASK_RESET_PASSWD, new HistoryTokenAuthNotNeededCallback() {
       @Override
       public void onHistoryToken(final String token) {
-        if (!session.isLogged()) {
-          askForPass.get().show();
-        }
+        Scheduler.get().scheduleFinally(new ScheduledCommand() {
+          @Override
+          public void execute() {
+            if (!session.isLogged()) {
+              askForPass.get().show();
+            }
+          }
+        });
+
       }
     });
     tokenListener.put(SiteTokens.RESET_PASSWD, new HistoryTokenAuthNotNeededCallback() {
@@ -159,6 +192,5 @@
       }
     });
     verifyManager.get();
-
   }
 }

Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/UserService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/UserService.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/UserService.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -20,6 +20,7 @@
 package cc.kune.core.client.rpcservices;
 
 import cc.kune.core.client.errors.DefaultException;
+import cc.kune.core.client.errors.EmailHashExpiredException;
 import cc.kune.core.client.errors.EmailHashInvalidException;
 import cc.kune.core.client.errors.EmailNotFoundException;
 import cc.kune.core.shared.domain.UserSNetVisibility;
@@ -36,7 +37,8 @@
 @RemoteServiceRelativePath("UserService")
 public interface UserService extends RemoteService {
 
-  void askForEmailConfirmation(String userHash);
+  void askForEmailConfirmation(String userHash) throws EmailHashInvalidException,
+      EmailHashExpiredException;
 
   void askForPasswordReset(String email) throws EmailNotFoundException;
 
@@ -62,6 +64,7 @@
 
   StateAbstractDTO updateUser(String userHash, UserDTO user, I18nLanguageSimpleDTO lang);
 
-  void verifyPasswordHash(String userHash, String emailReceivedHash);
+  void verifyPasswordHash(String userHash, String emailReceivedHash) throws EmailHashInvalidException,
+      EmailHashExpiredException;
 
 }

Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -24,8 +24,8 @@
 import cc.kune.common.client.actions.ActionEvent;
 import cc.kune.common.client.actions.ui.descrip.ButtonDescriptor;
 import cc.kune.core.client.events.UserSignInEvent;
+import cc.kune.core.client.events.UserSignInEvent.UserSignInHandler;
 import cc.kune.core.client.events.UserSignOutEvent;
-import cc.kune.core.client.events.UserSignInEvent.UserSignInHandler;
 import cc.kune.core.client.events.UserSignOutEvent.UserSignOutHandler;
 import cc.kune.core.client.i18n.I18nUITranslationService;
 import cc.kune.core.client.state.Session;
@@ -48,10 +48,10 @@
       super();
       this.stateManager = stateManager;
       putValue(Action.NAME, i18n.t("Sign in to collaborate"));
-      putValue(
-          Action.TOOLTIP,
-          i18n.t("Please sign in or register to get full access to [%s] tools and contents",
-              i18n.getSiteCommonName()));
+      // putValue(
+      // Action.TOOLTIP,
+      // i18n.t("Please sign in or register to get full access to [%s] tools and contents",
+      // i18n.getSiteCommonName()));
     }
 
     @Override

Modified: trunk/src/main/java/cc/kune/core/client/sitebar/auth/PasswordResetPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/auth/PasswordResetPanel.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/auth/PasswordResetPanel.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -1,5 +1,6 @@
 package cc.kune.core.client.sitebar.auth;
 
+import cc.kune.common.client.log.Log;
 import cc.kune.common.client.notify.NotifyLevel;
 import cc.kune.common.client.notify.NotifyLevelImages;
 import cc.kune.common.client.notify.NotifyUser;
@@ -14,7 +15,6 @@
 import cc.kune.core.client.state.Session;
 import cc.kune.core.client.state.SiteTokens;
 import cc.kune.core.client.state.StateManager;
-import cc.kune.core.client.state.TokenUtils;
 import cc.kune.core.client.ui.DefaultForm;
 
 import com.extjs.gxt.ui.client.widget.form.TextField;
@@ -91,8 +91,7 @@
                   public void onSuccess(final Void result) {
                     NotifyUser.info(i18n.t("Your password has been reset. Sign in"));
                     hide();
-                    stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.HOME,
-                        SiteTokens.SIGN_IN));
+                    stateManager.gotoHistoryToken(SiteTokens.SIGN_IN);
                   }
                 });
           }
@@ -111,6 +110,7 @@
   }
 
   public String getPasswordHash() {
+    Log.debug("Password hash:" + passwordHash);
     return passwordHash;
   }
 

Modified: trunk/src/main/java/cc/kune/core/client/sitebar/auth/VerifyEmailClientManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/auth/VerifyEmailClientManager.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/auth/VerifyEmailClientManager.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -2,7 +2,8 @@
 
 import cc.kune.common.client.notify.NotifyUser;
 import cc.kune.common.shared.i18n.I18nTranslationService;
-import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
+import cc.kune.core.client.errors.EmailHashExpiredException;
+import cc.kune.core.client.errors.EmailHashInvalidException;
 import cc.kune.core.client.rpcservices.UserServiceAsync;
 import cc.kune.core.client.state.HistoryTokenMustBeAuthCallback;
 import cc.kune.core.client.state.Session;
@@ -10,6 +11,7 @@
 import cc.kune.core.client.state.SiteTokens;
 import cc.kune.gspace.client.options.general.UserOptGeneral;
 
+import com.google.gwt.user.client.rpc.AsyncCallback;
 import com.google.inject.Inject;
 import com.google.inject.Provider;
 import com.google.inject.Singleton;
@@ -24,15 +26,28 @@
     tokens.put(SiteTokens.VERIFY_EMAIL, new HistoryTokenMustBeAuthCallback() {
       @Override
       public void onHistoryToken(final String token) {
-        userService.get().verifyPasswordHash(session.getUserHash(), token,
-            new AsyncCallbackSimple<Void>() {
-              @Override
-              public void onSuccess(final Void result) {
-                NotifyUser.info("Great. Your email is now verified");
-                session.getCurrentUser().setEmailVerified(true);
-                optGeneral.get().update();
-              }
-            });
+        userService.get().verifyPasswordHash(session.getUserHash(), token, new AsyncCallback<Void>() {
+          @Override
+          public void onFailure(final Throwable caught) {
+            if (caught instanceof EmailHashExpiredException) {
+              NotifyUser.error(i18n.t("Email confirmation code expired"), true);
+            } else if (caught instanceof EmailHashInvalidException) {
+              NotifyUser.error(i18n.t("Invalid confirmation code"), true);
+            } else {
+              NotifyUser.error(i18n.t("Other error trying to verify your password"), true);
+            }
+          }
+
+          @Override
+          public void onSuccess(final Void result) {
+            NotifyUser.info("Great. Your email is now verified");
+            session.getCurrentUser().setEmailVerified(true);
+            // This get NPE
+            // if (optGeneral.get().isVisible()) {
+            // optGeneral.get().update();
+            // }
+          }
+        });
       }
     });
 

Modified: trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -151,20 +151,21 @@
   }
 
   private void doActionOrSignInIfNeeded(final HistoryTokenCallback tokenListener,
-      final String newHistoryToken) {
+      final String currentToken, final String secondPart) {
     if (tokenListener.authMandatory() && session.isNotLogged()) {
-      Log.debug("login mandatory for " + newHistoryToken);
+      Log.debug("login mandatory for " + currentToken);
       // Ok, we have to redirect because this token (for instance
       // #translate) needs the user authenticated
-      redirectButSignInBefore(newHistoryToken);
+      redirectButSignInBefore(currentToken);
     } else {
       // The auth is not mandatory, go ahead with the token action
-      Log.debug("Executing action related with historytoken " + newHistoryToken);
-      tokenListener.onHistoryToken(newHistoryToken);
+      Log.debug("Executing action related with historytoken " + secondPart);
+      tokenListener.onHistoryToken(secondPart);
     }
   }
 
   private void getContent(final StateToken newState) {
+    Log.debug("Get Content: " + newState);
     getContent(newState, false);
   }
 
@@ -204,6 +205,7 @@
 
   @Override
   public void gotoDefaultHomepage() {
+    Log.debug("Goto def page called");
     getContent(new StateToken(SiteTokens.GROUP_HOME), true);
   }
 
@@ -297,12 +299,13 @@
         if (startingUp()) {
           // Starting with some token like "signin": load defContent
           // also
+          Log.debug("Starting up with some token like #signin: load defContent also");
           getContent(new StateToken(SiteTokens.GROUP_HOME), false);
           // processHistoryToken(SiteTokens.GROUP_HOME);
           // SpaceSelectEvent.fire(eventBus, Space.groupSpace);
         }
         // Fire the listener of this #hash token
-        doActionOrSignInIfNeeded(tokenListener, newHistoryToken);
+        doActionOrSignInIfNeeded(tokenListener, newHistoryToken, newHistoryToken);
       } else {
         Log.debug("Is not a special hash like #newgroup, etc, or maybe has a #hash(redirection)");
         // token is not one of #newgroup #signin #translate ...
@@ -320,7 +323,7 @@
             final HistoryTokenCallback tokenWithRedirect = siteTokens.get(firstToken);
             if (tokenWithRedirect != null) {
               Log.info("Is some #subtitle(foo) or #verifyemail(hash) etc");
-              doActionOrSignInIfNeeded(tokenWithRedirect,
+              doActionOrSignInIfNeeded(tokenWithRedirect, newHistoryToken,
                   tokenMatcher.getRedirect(newHistoryToken).getRight());
             } else if (firstToken.equals(SiteTokens.NEW_GROUP)) {
               siteTokens.get(SiteTokens.NEW_GROUP).onHistoryToken(newHistoryToken);
@@ -363,7 +366,9 @@
           SpaceSelectEvent.fire(eventBus, Space.groupSpace);
           getContent(new StateToken(newHistoryToken));
         } else {
-          gotoDefaultHomepage();
+          if (!startingUp()) {
+            // gotoDefaultHomepage();
+          }
         }
       }
     } else {

Modified: trunk/src/main/java/cc/kune/core/server/manager/UserManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/UserManager.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/core/server/manager/UserManager.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -22,6 +22,8 @@
 import org.waveprotocol.box.server.authentication.PasswordDigest;
 
 import cc.kune.core.client.errors.DefaultException;
+import cc.kune.core.client.errors.EmailHashExpiredException;
+import cc.kune.core.client.errors.EmailHashInvalidException;
 import cc.kune.core.client.errors.I18nNotFoundException;
 import cc.kune.core.server.manager.impl.EmailConfirmationType;
 import cc.kune.core.shared.domain.UserSNetVisibility;
@@ -30,7 +32,12 @@
 import cc.kune.domain.User;
 import cc.kune.domain.UserBuddiesData;
 
+// TODO: Auto-generated Javadoc
+/**
+ * The Interface UserManager.
+ */
 public interface UserManager {
+
   /**
    * Ask for email confirmation.
    * 
@@ -38,6 +45,8 @@
    *          the user
    * @param type
    *          the type
+   * @throws DefaultException
+   *           the default exception
    */
   void askForEmailConfirmation(User user, EmailConfirmationType type) throws DefaultException;
 
@@ -58,53 +67,133 @@
   User changePasswd(Long userId, String oldPassword, String newPassword, boolean checkOldPasswd);
 
   /**
-   * CreateUser new method with language country and timezone params
+   * Clear password hash (after been used)
    * 
+   * @param user
+   *          the user
+   */
+  void clearPasswordHash(User user);
+
+  /**
+   * CreateUser new method with language country and timezone params.
+   * 
    * @param shortName
+   *          the short name
    * @param longName
+   *          the long name
    * @param email
+   *          the email
    * @param passwd
-   * @param timezone
+   *          the passwd
+   * @param language
+   *          the language
    * @param country
-   * @param language
+   *          the country
    * @param timezone
+   *          the timezone
    * @param wantPersonalHomepage
+   *          the want personal homepage
    * @return User
    * @throws I18nNotFoundException
+   *           the i18n not found exception
    */
   User createUser(String shortName, String longName, String email, String passwd, String language,
       String country, String timezone, boolean wantPersonalHomepage) throws I18nNotFoundException;
 
+  /**
+   * Creates the wave account.
+   * 
+   * @param shortName
+   *          the short name
+   * @param passwdDigest
+   *          the passwd digest
+   */
   void createWaveAccount(String shortName, PasswordDigest passwdDigest);
 
   /**
    * IMPORTANT: if userId == null, it returns User.UNKNOWN_USER
    * 
    * @param userId
-   * @return
+   *          the user id
+   * @return the user
    */
   User find(Long userId);
 
+  /**
+   * Find by shortname.
+   * 
+   * @param shortName
+   *          the short name
+   * @return the user
+   */
   User findByShortname(String shortName);
 
+  /**
+   * Gets the user buddies.
+   * 
+   * @param shortName
+   *          the short name
+   * @return the user buddies
+   */
   UserBuddiesData getUserBuddies(String shortName);
 
+  /**
+   * Login.
+   * 
+   * @param nickOrEmail
+   *          the nick or email
+   * @param passwd
+   *          the passwd
+   * @return the user
+   */
   User login(String nickOrEmail, String passwd);
 
+  /**
+   * Re index.
+   */
   void reIndex();
 
+  /**
+   * Search.
+   * 
+   * @param search
+   *          the search
+   * @return the search result
+   */
   SearchResult<User> search(String search);
 
+  /**
+   * Search.
+   * 
+   * @param search
+   *          the search
+   * @param firstResult
+   *          the first result
+   * @param maxResults
+   *          the max results
+   * @return the search result
+   */
   SearchResult<User> search(String search, Integer firstResult, Integer maxResults);
 
+  /**
+   * Sets the s net visibility.
+   * 
+   * @param user
+   *          the user
+   * @param visibility
+   *          the visibility
+   */
   void setSNetVisibility(User user, UserSNetVisibility visibility);
 
   /**
+   * Update.
+   * 
    * @param userId
    *          the userId to change
    * @param user
    *          the userDTO with values to change
    * @param lang
+   *          the lang
    * @return the User after updated
    */
   User update(Long userId, UserDTO user, I18nLanguageSimpleDTO lang);
@@ -118,7 +207,12 @@
    *          the email received hash
    * @param period
    *          the period (1h or more if is a new account);
+   * @throws EmailHashInvalidException
+   *           the email hash invalid exception
+   * @throws EmailHashExpiredException
+   *           the email hash expired exception
    */
-  void verifyPasswordHash(Long userId, String emailReceivedHash, long period) throws DefaultException;
+  void verifyPasswordHash(Long userId, String emailReceivedHash, long period)
+      throws EmailHashInvalidException, EmailHashExpiredException;
 
 }

Modified: trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -158,8 +158,8 @@
       notifyService.sendEmailToWithLink(
           user,
           "Verify password reset",
-          "You are receiving this email because a request has been made to change the password associated with this email address in %s.<br>"
-              + "If this was a mistake, just ignore this email and nothing will happen.<br>"
+          "You are receiving this email because a request has been made to change the password associated with this email address in %s.<br><br>"
+              + "If this was a mistake, just ignore this email and nothing will happen.<br><br>"
               + "If you would like to reset the password for this account simply click on the link below or paste it into the url field on your favorite browser:",
           TokenUtils.addRedirect(SiteTokens.RESET_PASSWD, hash));
     default:
@@ -228,6 +228,13 @@
   }
 
   @Override
+  public void clearPasswordHash(final User user) {
+    user.setEmailVerified(true);
+    user.setEmailCheckDate(0l);
+    user.setEmailConfirmHash("");
+  }
+
+  @Override
   public User createUser(final String shortName, final String longName, final String email,
       final String passwd, final String langCode, final String countryCode, final String timezone,
       final boolean wantPersonalHomepage) throws I18nNotFoundException {
@@ -457,7 +464,7 @@
 
   @Override
   public void verifyPasswordHash(final Long userId, final String emailReceivedHash, final long period)
-      throws DefaultException {
+      throws EmailHashInvalidException, EmailHashExpiredException {
     final User user = find(userId);
     final Date on = new Date(user.getEmailCheckDate() + period);
 
@@ -468,8 +475,7 @@
     final String emailConfirmHash = user.getEmailConfirmHash();
     if (emailReceivedHash != null && emailConfirmHash != null
         && emailReceivedHash.equals(emailConfirmHash)) {
-      user.setEmailVerified(true);
-      user.setEmailConfirmHash("");
+      clearPasswordHash(user);
       persist(user);
     } else {
       throw new EmailHashInvalidException();

Modified: trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -29,6 +29,7 @@
 
 import cc.kune.core.client.errors.AccessViolationException;
 import cc.kune.core.client.errors.DefaultException;
+import cc.kune.core.client.errors.EmailHashExpiredException;
 import cc.kune.core.client.errors.EmailHashInvalidException;
 import cc.kune.core.client.errors.EmailNotFoundException;
 import cc.kune.core.client.errors.UserAuthException;
@@ -215,6 +216,7 @@
     try {
       final User user = userFinder.findByHash(passwdHash);
       userManager.changePasswd(user.getId(), null, newpasswd, false);
+      userManager.clearPasswordHash(user);
     } catch (final NoResultException e) {
       throw new EmailHashInvalidException();
     }
@@ -250,7 +252,8 @@
   @Authenticated
   @Override
   @Transactional
-  public void verifyPasswordHash(final String userHash, final String emailReceivedHash) {
+  public void verifyPasswordHash(final String userHash, final String emailReceivedHash)
+      throws EmailHashInvalidException, EmailHashExpiredException {
     final User user = userSessionManager.getUser();
     userManager.verifyPasswordHash(user.getId(), emailReceivedHash, SessionConstants._AN_HOUR);
   }

Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -33,20 +33,7 @@
 import cc.kune.gspace.client.i18n.I18nTranslatorTabsCollection;
 import cc.kune.gspace.client.i18n.SiteOptionsI18nTranslatorAction;
 import cc.kune.gspace.client.options.GroupOptions;
-import cc.kune.gspace.client.options.GroupOptionsCollection;
 import cc.kune.gspace.client.options.UserOptions;
-import cc.kune.gspace.client.options.UserOptionsCollection;
-import cc.kune.gspace.client.options.general.GroupOptGeneral;
-import cc.kune.gspace.client.options.general.UserOptGeneral;
-import cc.kune.gspace.client.options.general.UserOptPass;
-import cc.kune.gspace.client.options.license.GroupOptDefLicense;
-import cc.kune.gspace.client.options.license.UserOptDefLicense;
-import cc.kune.gspace.client.options.logo.GroupOptLogo;
-import cc.kune.gspace.client.options.logo.UserOptLogo;
-import cc.kune.gspace.client.options.style.GroupOptStyle;
-import cc.kune.gspace.client.options.style.UserOptStyle;
-import cc.kune.gspace.client.options.tools.GroupOptTools;
-import cc.kune.gspace.client.options.tools.UserOptTools;
 import cc.kune.gspace.client.tags.TagsSummaryPresenter;
 import cc.kune.gspace.client.themes.GSpaceThemeManager;
 import cc.kune.gspace.client.tool.selector.ToolSelector;
@@ -61,18 +48,20 @@
 public class GSpaceParts {
 
   @Inject
-  public GSpaceParts(final Session session, final GSpaceThemeManager themeManager,
+  public GSpaceParts(
+      final Session session,
+      final GSpaceThemeManager themeManager,
       final Provider<EntityLicensePresenter> licenseFooter,
-      final Provider<TagsSummaryPresenter> tagsPresenter, final Provider<ToolSelector> toolSelector,
-      final Provider<NoHomePageViewer> noHome, final Provider<ContentViewerPresenter> docsViewer,
-      final Provider<FolderViewerPresenter> folderViewer, final Provider<GroupOptions> go,
-      final Provider<UserOptions> uo, final Provider<GroupOptionsCollection> gocProv,
-      final Provider<UserOptionsCollection> uocProv, final Provider<GroupOptGeneral> gg,
-      final Provider<GroupOptDefLicense> gdl, final Provider<GroupOptStyle> gps,
-      final Provider<GroupOptLogo> gl, final Provider<GroupOptTools> gtc,
-      final Provider<UserOptGeneral> ug, final Provider<UserOptPass> up,
-      final Provider<UserOptDefLicense> udl, final Provider<UserOptStyle> ups,
-      final Provider<UserOptLogo> ul, final Provider<UserOptTools> utc,
+      final Provider<TagsSummaryPresenter> tagsPresenter,
+      final Provider<ToolSelector> toolSelector,
+      final Provider<NoHomePageViewer> noHome,
+      final Provider<ContentViewerPresenter> docsViewer,
+      final Provider<FolderViewerPresenter> folderViewer,
+      final Provider<GroupOptions> go,
+      final Provider<UserOptions> uo, // final Provider<GroupOptionsCollection>
+                                      // gocProv,
+      // final Provider<UserOptionsCollection> uocProv,
+
       final Provider<SitebarSearchPresenter> siteSearch,
       final Provider<SiteOptionsI18nTranslatorAction> transAction,
       final Provider<GiveUsFeedbackBtn> giveUsFeedback,
@@ -91,20 +80,9 @@
         siteSearch.get();
         noHome.get();
 
-        // Add User & Groups Options
-        final GroupOptionsCollection goc = gocProv.get();
-        final UserOptionsCollection uoc = uocProv.get();
-        goc.add(gg);
-        goc.add(gtc);
-        goc.add(gl);
-        goc.add(gps);
-        goc.add(gdl);
-        uoc.add(ug);
-        uoc.add(up);
-        uoc.add(utc);
-        uoc.add(ul);
-        uoc.add(ups);
-        uoc.add(udl);
+        // // Add User & Groups Options
+        // final GroupOptionsCollection goc = gocProv.get();
+        // final UserOptionsCollection uoc = uocProv.get();
 
         // Init
         go.get();

Modified: trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsCollection.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsCollection.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsCollection.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -20,7 +20,27 @@
 package cc.kune.gspace.client.options;
 
 import cc.kune.common.client.ProvidersCollection;
+import cc.kune.gspace.client.options.general.GroupOptGeneral;
+import cc.kune.gspace.client.options.license.GroupOptDefLicense;
+import cc.kune.gspace.client.options.logo.GroupOptLogo;
+import cc.kune.gspace.client.options.style.GroupOptStyle;
+import cc.kune.gspace.client.options.tools.GroupOptTools;
 
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
 @SuppressWarnings("serial")
+ at Singleton
 public class GroupOptionsCollection extends ProvidersCollection {
+  @Inject
+  public GroupOptionsCollection(final Provider<GroupOptGeneral> gg, final Provider<GroupOptTools> gtc,
+      final Provider<GroupOptLogo> gl, final Provider<GroupOptStyle> gps,
+      final Provider<GroupOptDefLicense> gdl) {
+    add(gg);
+    add(gtc);
+    add(gl);
+    add(gps);
+    add(gdl);
+  }
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsCollection.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsCollection.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsCollection.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -20,7 +20,30 @@
 package cc.kune.gspace.client.options;
 
 import cc.kune.common.client.ProvidersCollection;
+import cc.kune.gspace.client.options.general.UserOptGeneral;
+import cc.kune.gspace.client.options.general.UserOptPass;
+import cc.kune.gspace.client.options.license.UserOptDefLicense;
+import cc.kune.gspace.client.options.logo.UserOptLogo;
+import cc.kune.gspace.client.options.style.UserOptStyle;
+import cc.kune.gspace.client.options.tools.UserOptTools;
 
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
 @SuppressWarnings("serial")
+ at Singleton
 public class UserOptionsCollection extends ProvidersCollection {
+
+  @Inject
+  public UserOptionsCollection(final Provider<UserOptGeneral> ug, final Provider<UserOptPass> up,
+      final Provider<UserOptTools> utc, final Provider<UserOptLogo> ul,
+      final Provider<UserOptStyle> ups, final Provider<UserOptDefLicense> udl) {
+    add(ug);
+    add(up);
+    add(utc);
+    add(ul);
+    add(ups);
+    add(udl);
+  }
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralPanel.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralPanel.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -78,6 +78,11 @@
   }
 
   @Override
+  public boolean isRendered() {
+    return super.getFormPanel().isRendered();
+  }
+
+  @Override
   public void mask() {
     maskWidget.mask(this);
   }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralView.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralView.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/EntityOptGeneralView.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -27,6 +27,8 @@
 
   void clear();
 
+  boolean isRendered();
+
   boolean isValid();
 
   void mask();

Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneral.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneral.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneral.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -21,6 +21,8 @@
 
 public interface UserOptGeneral extends EntityOptGeneral {
 
+  boolean isVisible();
+
   void update();
 
 }

Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPresenter.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPresenter.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -89,6 +89,11 @@
   }
 
   @Override
+  public boolean isVisible() {
+    return view.isRendered();
+  }
+
+  @Override
   protected void setState() {
     final UserSimpleDTO currentUser = session.getCurrentUser();
     userView.setLongName(currentUser.getName());

Modified: trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptDefLicensePresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptDefLicensePresenter.java	2012-01-17 12:35:15 UTC (rev 1666)
+++ trunk/src/main/java/cc/kune/gspace/client/options/license/EntityOptDefLicensePresenter.java	2012-01-18 15:27:17 UTC (rev 1667)
@@ -107,6 +107,7 @@
 
   protected void setState() {
     if (applicable()) {
+      // Is a user and app is not starting up
       setLicense(getCurrentDefLicense());
     }
   }




More information about the kune-commits mailing list