[kune-commits] r1663 - in trunk/src: main/java/cc/kune/barters/client main/java/cc/kune/blogs/client main/java/cc/kune/chat/client/actions main/java/cc/kune/core main/java/cc/kune/core/client main/java/cc/kune/core/client/auth main/java/cc/kune/core/client/cookies main/java/cc/kune/core/client/errors main/java/cc/kune/core/client/rpcservices main/java/cc/kune/core/client/sitebar main/java/cc/kune/core/client/sitebar/auth main/java/cc/kune/core/client/sitebar/search main/java/cc/kune/core/client/sitebar/spaces main/java/cc/kune/core/client/sn/actions main/java/cc/kune/core/client/sn/actions/registry main/java/cc/kune/core/client/state main/java/cc/kune/core/client/state/impl main/java/cc/kune/core/public main/java/cc/kune/core/server/mail main/java/cc/kune/core/server/manager main/java/cc/kune/core/server/manager/impl main/java/cc/kune/core/server/notifier main/java/cc/kune/core/server/rpc main/java/cc/kune/core/server/utils main/java/cc/kune/core/shared main/java/cc/kune/core/shared/dto main/java/cc/kune/core/shared/utils main/java/cc/kune/docs/client main/java/cc/kune/domain main/java/cc/kune/events/client main/java/cc/kune/gspace/client main/java/cc/kune/gspace/client/actions main/java/cc/kune/gspace/client/options main/java/cc/kune/gspace/client/options/general main/java/cc/kune/gspace/client/tags main/java/cc/kune/hspace/client main/java/cc/kune/lists/client main/java/cc/kune/lists/client/actions main/java/cc/kune/tasks/client main/java/cc/kune/wave/client main/java/cc/kune/wave/server/kspecific main/java/cc/kune/wiki/client main/resources test/java/cc/kune/core test/java/cc/kune/core/client/state/impl test/java/cc/kune/core/server/mail test/java/cc/kune/core/shared test/java/cc/kune/core/shared/utils test/java/cc/kune/gspace/client/tags test/java/cc/kune/selenium/login
Vicente J. Ruiz Jurado
vjrj_ at ourproject.org
Mon Jan 16 21:53:46 CET 2012
Author: vjrj_
Date: 2012-01-16 21:53:44 +0100 (Mon, 16 Jan 2012)
New Revision: 1663
Added:
trunk/src/main/java/cc/kune/core/client/errors/EmailHashExpiredException.java
trunk/src/main/java/cc/kune/core/client/errors/EmailHashInvalidException.java
trunk/src/main/java/cc/kune/core/client/errors/EmailNotFoundException.java
trunk/src/main/java/cc/kune/core/client/sitebar/auth/
trunk/src/main/java/cc/kune/core/client/sitebar/auth/VerifyEmailClientManager.java
trunk/src/main/java/cc/kune/core/client/state/HistoryTokenAuthNotNeededCallback.java
trunk/src/main/java/cc/kune/core/client/state/HistoryTokenMustBeAuthCallback.java
trunk/src/main/java/cc/kune/core/server/manager/impl/EmailConfirmationType.java
trunk/src/main/java/cc/kune/core/shared/SessionConstants.java
trunk/src/test/java/cc/kune/core/shared/
trunk/src/test/java/cc/kune/core/shared/utils/
trunk/src/test/java/cc/kune/core/shared/utils/SharedFileDownloadUtilsTest.java
Modified:
trunk/src/main/java/cc/kune/barters/client/BartersParts.java
trunk/src/main/java/cc/kune/blogs/client/BlogsParts.java
trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java
trunk/src/main/java/cc/kune/chat/client/actions/OpenChatAction.java
trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml
trunk/src/main/java/cc/kune/core/client/CoreParts.java
trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java
trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java
trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java
trunk/src/main/java/cc/kune/core/client/cookies/CookiesManagerImpl.java
trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
trunk/src/main/java/cc/kune/core/client/rpcservices/UserService.java
trunk/src/main/java/cc/kune/core/client/rpcservices/UserServiceAsync.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java
trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java
trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java
trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java
trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java
trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNAdminsMenuItemsRegistry.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNCollabsMenuItemsRegistry.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNPendingsMenuItemsRegistry.java
trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java
trunk/src/main/java/cc/kune/core/client/state/HistoryTokenCallback.java
trunk/src/main/java/cc/kune/core/client/state/Session.java
trunk/src/main/java/cc/kune/core/client/state/SiteTokens.java
trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java
trunk/src/main/java/cc/kune/core/public/ws.css
trunk/src/main/java/cc/kune/core/server/mail/MailServiceDefault.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/notifier/NotificationHtmlHelper.java
trunk/src/main/java/cc/kune/core/server/notifier/NotificationSenderDefault.java
trunk/src/main/java/cc/kune/core/server/notifier/NotificationService.java
trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java
trunk/src/main/java/cc/kune/core/server/utils/AbsoluteFileDownloadUtils.java
trunk/src/main/java/cc/kune/core/shared/dto/UserSimpleDTO.java
trunk/src/main/java/cc/kune/core/shared/utils/SharedFileDownloadUtils.java
trunk/src/main/java/cc/kune/docs/client/DocsParts.java
trunk/src/main/java/cc/kune/domain/User.java
trunk/src/main/java/cc/kune/events/client/EventsParts.java
trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
trunk/src/main/java/cc/kune/gspace/client/actions/AbstractFoldableToolActions.java
trunk/src/main/java/cc/kune/gspace/client/actions/DelContainerMenuItem.java
trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackAction.java
trunk/src/main/java/cc/kune/gspace/client/options/GroupOptions.java
trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPresenter.java
trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java
trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneral.java
trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java
trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPresenter.java
trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralView.java
trunk/src/main/java/cc/kune/gspace/client/tags/TagsSummaryPresenter.java
trunk/src/main/java/cc/kune/hspace/client/HSpacePanel.java
trunk/src/main/java/cc/kune/lists/client/ListsParts.java
trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java
trunk/src/main/java/cc/kune/lists/client/actions/SubscriteToListAction.java
trunk/src/main/java/cc/kune/tasks/client/TasksParts.java
trunk/src/main/java/cc/kune/wave/client/WebClient.java
trunk/src/main/java/cc/kune/wave/server/kspecific/WaveEmailNotifier.java
trunk/src/main/java/cc/kune/wiki/client/WikiParts.java
trunk/src/main/resources/kune.properties
trunk/src/test/java/cc/kune/core/client/state/impl/StateManagerDefaultTest.java
trunk/src/test/java/cc/kune/core/server/mail/MailServiceDefaultTest.java
trunk/src/test/java/cc/kune/gspace/client/tags/TagsSummaryPresenterTest.java
trunk/src/test/java/cc/kune/selenium/login/ScreenCastsViaSeleniumTests.java
Log:
NEW - # 94: Registration: emails not timely going out
http://kune.ourproject.org/issues/ticket/94
Modified: trunk/src/main/java/cc/kune/barters/client/BartersParts.java
===================================================================
--- trunk/src/main/java/cc/kune/barters/client/BartersParts.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/barters/client/BartersParts.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -21,7 +21,7 @@
import cc.kune.barters.client.actions.BartersClientActions;
import cc.kune.barters.shared.BartersConstants;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.gspace.client.tool.ContentViewerSelector;
import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import cc.kune.gspace.client.viewers.FolderViewerPresenter;
@@ -32,7 +32,7 @@
public class BartersParts {
@Inject
- public BartersParts(final Session session, final Provider<BartersClientTool> clientTool,
+ public BartersParts(final SessionConstants session, final Provider<BartersClientTool> clientTool,
final ContentViewerSelector viewerSelector, final BartersClientActions bartersActions,
final ContentViewerPresenter contentViewer, final FolderViewerPresenter folderViewer) {
clientTool.get();
Modified: trunk/src/main/java/cc/kune/blogs/client/BlogsParts.java
===================================================================
--- trunk/src/main/java/cc/kune/blogs/client/BlogsParts.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/blogs/client/BlogsParts.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -21,7 +21,7 @@
import cc.kune.blogs.client.actions.BlogsClientActions;
import cc.kune.blogs.shared.BlogsConstants;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.gspace.client.tool.ContentViewerSelector;
import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import cc.kune.gspace.client.viewers.FolderViewerPresenter;
@@ -32,7 +32,7 @@
public class BlogsParts {
@Inject
- public BlogsParts(final Session session, final Provider<BlogsClientTool> clientTool,
+ public BlogsParts(final SessionConstants session, final Provider<BlogsClientTool> clientTool,
final ContentViewerSelector viewerSelector, final BlogsClientActions blogsActions,
final ContentViewerPresenter contentViewer, final FolderViewerPresenter folderViewer) {
clientTool.get();
Modified: trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/chat/client/actions/ChatSitebarActions.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -37,7 +37,7 @@
import cc.kune.core.client.events.WindowFocusEvent;
import cc.kune.core.client.sitebar.SiteUserOptions;
import cc.kune.core.client.sitebar.SiteUserOptionsPresenter;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import com.calclab.emite.core.client.events.StateChangedEvent;
import com.calclab.emite.core.client.events.StateChangedHandler;
@@ -124,7 +124,7 @@
private final XmppSession xmppSession;
@Inject
- public ChatSitebarActions(final Session session, final ChatClient chatClient,
+ public ChatSitebarActions(final SessionConstants session, final ChatClient chatClient,
final SiteUserOptions userOptions, final I18nTranslationService i18n, final ChatResources res,
final ChatInstances chatInstances, final EventBus eventBus) {
this.chatClient = chatClient;
Modified: trunk/src/main/java/cc/kune/chat/client/actions/OpenChatAction.java
===================================================================
--- trunk/src/main/java/cc/kune/chat/client/actions/OpenChatAction.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/chat/client/actions/OpenChatAction.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -67,7 +67,7 @@
} else {
signIn.get().setErrorMessage(i18n.t("Sign in or create an account to access to this room"),
NotifyLevel.info);
- stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGNIN,
+ stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGN_IN,
session.getCurrentStateToken().toString()));
}
}
Modified: trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml
===================================================================
--- trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/KuneCore.gwt.xml 2012-01-16 20:53:44 UTC (rev 1663)
@@ -6,7 +6,7 @@
see http://code.google.com/p/google-web-toolkit/issues/detail?id=4454 -->
<source path='client'
excludes="**/*Test.java,**/*Tests.java,**/*MockProvider.java"/>
- <source path="shared"/>
+ <source path="shared" excludes="**/*Test.java,**/*Tests.java,**/*MockProvider.java"/>
<public path="public"/>
<!-- Dependencies ============================================= -->
<inherits name="com.google.gwt.user.User"/>
Modified: trunk/src/main/java/cc/kune/core/client/CoreParts.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/CoreParts.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/CoreParts.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -27,6 +27,7 @@
import cc.kune.core.client.groups.newgroup.NewGroup;
import cc.kune.core.client.sitebar.AboutKuneDialog;
import cc.kune.core.client.sitebar.SiteUserOptionsPresenter;
+import cc.kune.core.client.sitebar.auth.VerifyEmailClientManager;
import cc.kune.core.client.sitebar.spaces.Space;
import cc.kune.core.client.sitebar.spaces.SpaceSelectEvent;
import cc.kune.core.client.sitebar.spaces.SpaceSelectorPresenter;
@@ -34,11 +35,14 @@
import cc.kune.core.client.sn.UserSNPresenter;
import cc.kune.core.client.sn.actions.registry.GroupSNConfActions;
import cc.kune.core.client.sn.actions.registry.UserSNConfActions;
-import cc.kune.core.client.state.HistoryTokenCallback;
+import cc.kune.core.client.state.HistoryTokenAuthNotNeededCallback;
+import cc.kune.core.client.state.HistoryTokenMustBeAuthCallback;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.SiteTokenListeners;
import cc.kune.core.client.state.SiteTokens;
import cc.kune.core.client.sub.SubtitlesManager;
+import cc.kune.gspace.client.options.GroupOptions;
+import cc.kune.gspace.client.options.UserOptions;
import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;
@@ -55,7 +59,9 @@
final Provider<SpaceSelectorPresenter> spaceSelector, final SiteTokenListeners tokenListener,
final Provider<SignIn> signIn, final Provider<Register> register,
final Provider<AboutKuneDialog> aboutKuneDialog, final Provider<NewGroup> newGroup,
- final Provider<SubtitlesManager> subProvider, final EventBus eventBus) {
+ final Provider<SubtitlesManager> subProvider, final EventBus eventBus,
+ final Provider<VerifyEmailClientManager> verifyManager,
+ final Provider<UserOptions> userOptionsDialog, final Provider<GroupOptions> groupOptionsDialog) {
session.onAppStart(true, new AppStartHandler() {
@Override
public void onAppStart(final AppStartEvent event) {
@@ -68,48 +74,63 @@
spaceSelector.get();
}
});
- tokenListener.put(SiteTokens.SIGNIN, new HistoryTokenCallback() {
+ tokenListener.put(SiteTokens.SIGN_IN, new HistoryTokenAuthNotNeededCallback() {
@Override
public void onHistoryToken(final String token) {
signIn.get().showSignInDialog();
}
});
- tokenListener.put(SiteTokens.ABOUTKUNE, new HistoryTokenCallback() {
+ tokenListener.put(SiteTokens.ABOUT_KUNE, new HistoryTokenAuthNotNeededCallback() {
@Override
public void onHistoryToken(final String token) {
// FIXME, something to come back
aboutKuneDialog.get().showCentered();
}
});
- tokenListener.put(SiteTokens.REGISTER, new HistoryTokenCallback() {
+ tokenListener.put(SiteTokens.REGISTER, new HistoryTokenAuthNotNeededCallback() {
@Override
public void onHistoryToken(final String token) {
register.get().doRegister();
}
});
- tokenListener.put(SiteTokens.NEWGROUP, new HistoryTokenCallback() {
+ tokenListener.put(SiteTokens.NEW_GROUP, new HistoryTokenMustBeAuthCallback() {
@Override
public void onHistoryToken(final String token) {
newGroup.get().doNewGroup();
}
});
- tokenListener.put(SiteTokens.SUBTITLES, new HistoryTokenCallback() {
+ tokenListener.put(SiteTokens.SUBTITLES, new HistoryTokenAuthNotNeededCallback() {
@Override
public void onHistoryToken(final String token) {
subProvider.get().show(token);
}
});
- tokenListener.put(SiteTokens.HOME, new HistoryTokenCallback() {
+ tokenListener.put(SiteTokens.HOME, new HistoryTokenAuthNotNeededCallback() {
@Override
public void onHistoryToken(final String token) {
SpaceSelectEvent.fire(eventBus, Space.homeSpace);
}
});
- tokenListener.put(SiteTokens.WAVEINBOX, new HistoryTokenCallback() {
+ tokenListener.put(SiteTokens.WAVE_INBOX, new HistoryTokenMustBeAuthCallback() {
@Override
public void onHistoryToken(final String token) {
SpaceSelectEvent.fire(eventBus, Space.userSpace);
}
});
+ tokenListener.put(SiteTokens.PREFS, new HistoryTokenMustBeAuthCallback() {
+ @Override
+ public void onHistoryToken(final String token) {
+ 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);
+ }
+ });
+
+ verifyManager.get();
}
}
Modified: trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/auth/AnonUsersManager.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -52,7 +52,7 @@
cookiesManager.setAnonCookie(false);
final String register = TextUtils.generateHtmlLink("#" + SiteTokens.REGISTER,
i18n.tWithNT("register", "register, in lowercase"), false);
- final String signin = TextUtils.generateHtmlLink("#" + SiteTokens.SIGNIN,
+ final String signin = TextUtils.generateHtmlLink("#" + SiteTokens.SIGN_IN,
i18n.tWithNT("sign in", "register, in lowercase"), false);
final String siteCommonName = i18n.getSiteCommonName();
notifyMsg = UserNotifyEvent.fire(
Modified: trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/auth/RegisterForm.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -20,8 +20,8 @@
package cc.kune.core.client.auth;
import cc.kune.common.shared.i18n.I18nTranslationService;
-import cc.kune.core.client.state.Session;
import cc.kune.core.client.ui.DefaultForm;
+import cc.kune.core.shared.SessionConstants;
import com.extjs.gxt.ui.client.widget.form.Field;
import com.extjs.gxt.ui.client.widget.form.TextField;
@@ -46,7 +46,7 @@
private final TextField<String> shortNameRegField;
- public RegisterForm(final I18nTranslationService i18n, final Session session,
+ public RegisterForm(final I18nTranslationService i18n, final SessionConstants session,
final UserFieldFactory userFieldFactory) {
super.addStyleName("kune-Margin-Large-l");
Modified: trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/auth/RegisterPanel.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -25,8 +25,8 @@
import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.core.client.auth.RegisterPresenter.RegisterView;
import cc.kune.core.client.resources.CoreMessages;
-import cc.kune.core.client.state.Session;
import cc.kune.core.client.ui.KuneUiUtils;
+import cc.kune.core.shared.SessionConstants;
import com.google.gwt.core.client.Scheduler;
import com.google.gwt.core.client.Scheduler.ScheduledCommand;
@@ -46,7 +46,7 @@
private final RegisterForm registerForm;
@Inject
- public RegisterPanel(final I18nTranslationService i18n, final Session session,
+ public RegisterPanel(final I18nTranslationService i18n, final SessionConstants session,
final MaskWidgetView mask, final NotifyLevelImages images, final UserFieldFactory userFieldFactory) {
super(REGISTER_DIALOG, mask, i18n, i18n.t(CoreMessages.REGISTER_TITLE), true, true, true, "",
i18n.t(CoreMessages.REGISTER_TITLE), REGISTER_BUTTON_ID,
Modified: trunk/src/main/java/cc/kune/core/client/cookies/CookiesManagerImpl.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/cookies/CookiesManagerImpl.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/cookies/CookiesManagerImpl.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -22,7 +22,7 @@
import java.util.Date;
import cc.kune.common.client.log.Log;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import com.google.gwt.user.client.Cookies;
@@ -40,7 +40,7 @@
@Override
public String getAuthCookie() {
- return Cookies.getCookie(Session.USERHASH);
+ return Cookies.getCookie(SessionConstants.USERHASH);
}
@Override
@@ -55,23 +55,23 @@
// issue:
// http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/ded86778ee56690/515dc513c7d085eb?lnk=st&q=remove+cookie#515dc513c7d085eb
// http://code.google.com/p/google-web-toolkit/issues/detail?id=1735&q=removeCookie
- Cookies.removeCookie(Session.USERHASH);
+ Cookies.removeCookie(SessionConstants.USERHASH);
// Workaround:
- Cookies.setCookie(Session.USERHASH, null, new Date(0), null, "/", false);
+ Cookies.setCookie(SessionConstants.USERHASH, null, new Date(0), null, "/", false);
}
@Override
public void setAnonCookie(final Boolean userRegister) {
final Date expires = new Date(System.currentTimeMillis()
- + (userRegister ? Session.ANON_SESSION_DURATION_AFTER_REG : Session.ANON_SESSION_DURATION));
+ + (userRegister ? SessionConstants.ANON_SESSION_DURATION_AFTER_REG : SessionConstants.ANON_SESSION_DURATION));
Cookies.setCookie(ANON, userRegister.toString(), expires, null, "/", false);
}
@Override
public void setAuthCookie(final String userHash) {
// http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ
- final Date expires = new Date(System.currentTimeMillis() + Session.SESSION_DURATION);
- Cookies.setCookie(Session.USERHASH, userHash, expires, null, "/", false);
+ final Date expires = new Date(System.currentTimeMillis() + SessionConstants.SESSION_DURATION);
+ Cookies.setCookie(SessionConstants.USERHASH, userHash, expires, null, "/", false);
Log.info("Received hash: " + userHash, null);
}
}
Added: trunk/src/main/java/cc/kune/core/client/errors/EmailHashExpiredException.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/EmailHashExpiredException.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/errors/EmailHashExpiredException.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -0,0 +1,24 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.client.errors;
+
+public class EmailHashExpiredException extends DefaultException {
+ private static final long serialVersionUID = 576604826176441925L;
+}
Added: trunk/src/main/java/cc/kune/core/client/errors/EmailHashInvalidException.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/EmailHashInvalidException.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/errors/EmailHashInvalidException.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -0,0 +1,26 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.client.errors;
+
+public class EmailHashInvalidException extends DefaultException {
+
+ private static final long serialVersionUID = 7285974904505390494L;
+
+}
Added: trunk/src/main/java/cc/kune/core/client/errors/EmailNotFoundException.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/EmailNotFoundException.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/errors/EmailNotFoundException.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -0,0 +1,24 @@
+/*
+ *
+ * Copyright (C) 2007-2011 The kune development team (see CREDITS for details)
+ * This file is part of kune.
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program 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 Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+package cc.kune.core.client.errors;
+
+public class EmailNotFoundException extends DefaultException {
+ private static final long serialVersionUID = 576604826176441925L;
+}
Modified: trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/errors/ErrorHandler.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -118,6 +118,15 @@
logException(caught);
eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
i18n.t("This user is already a group member")));
+ } else if (caught instanceof EmailHashInvalidException) {
+ logException(caught);
+ eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.error,
+ i18n.t("This confirmation email is invalid")));
+ } else if (caught instanceof EmailHashExpiredException) {
+ logException(caught);
+ eventBus.fireEvent(new UserNotifyEvent(
+ NotifyLevel.error,
+ i18n.t("This email verification is expired. In your preferences, resend you the confirmation email")));
} else if (caught instanceof MoveOnSameContainerException) {
logException(caught);
eventBus.fireEvent(new UserNotifyEvent(NotifyLevel.info,
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-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/UserService.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -34,8 +34,12 @@
@RemoteServiceRelativePath("UserService")
public interface UserService extends RemoteService {
- void changePasswd(String userHash, String oldPassword, String newPassword) throws DefaultException;;
+ void askForEmailConfirmation(String userHash);;
+ void askForEmailForgot(String email);
+
+ void changePasswd(String userHash, String oldPassword, String newPassword) throws DefaultException;
+
void createUser(UserDTO user, boolean wantPersonalHomepage) throws DefaultException;
String getUserAvatarBaser64(String userHash, StateToken userToken) throws DefaultException;
@@ -54,4 +58,6 @@
StateAbstractDTO updateUser(String userHash, UserDTO user, I18nLanguageSimpleDTO lang);
+ void verifyPasswordHash(String userHash, String emailReceivedHash);
+
}
Modified: trunk/src/main/java/cc/kune/core/client/rpcservices/UserServiceAsync.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/rpcservices/UserServiceAsync.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/rpcservices/UserServiceAsync.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -31,6 +31,10 @@
public interface UserServiceAsync {
+ void askForEmailConfirmation(String userHash, AsyncCallback<Void> callback);
+
+ void askForEmailForgot(String email, AsyncCallback<Void> callback);
+
void changePasswd(String userHash, String oldPassword, String newPassword, AsyncCallback<Void> callback);
void createUser(UserDTO user, boolean wantPersonalHomepage, AsyncCallback<Void> asyncCallback);
@@ -53,4 +57,6 @@
void updateUser(String userHash, UserDTO user, I18nLanguageSimpleDTO lang,
AsyncCallback<StateAbstractDTO> callback);
+
+ void verifyPasswordHash(String userHash, String emailReceivedHash, AsyncCallback<Void> asyncCallback);
}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarNewGroupLink.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -46,7 +46,7 @@
@Override
public void actionPerformed(final ActionEvent event) {
- stateManager.gotoHistoryToken(SiteTokens.NEWGROUP);
+ stateManager.gotoHistoryToken(SiteTokens.NEW_GROUP);
}
}
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-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/SitebarSignInLink.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -31,6 +31,7 @@
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.shared.SessionConstants;
import com.google.gwt.event.shared.EventBus;
import com.google.inject.Inject;
@@ -43,7 +44,7 @@
@Inject
public SitebarSignInAction(final StateManager stateManager, final I18nUITranslationService i18n,
- final Session session) {
+ final SessionConstants session) {
super();
this.stateManager = stateManager;
putValue(Action.NAME, i18n.t("Sign in to collaborate"));
@@ -55,7 +56,7 @@
@Override
public void actionPerformed(final ActionEvent event) {
- stateManager.gotoHistoryTokenButRedirectToCurrent(SiteTokens.SIGNIN);
+ stateManager.gotoHistoryTokenButRedirectToCurrent(SiteTokens.SIGN_IN);
}
}
Added: trunk/src/main/java/cc/kune/core/client/sitebar/auth/VerifyEmailClientManager.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/auth/VerifyEmailClientManager.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/auth/VerifyEmailClientManager.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -0,0 +1,40 @@
+package cc.kune.core.client.sitebar.auth;
+
+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.rpcservices.UserServiceAsync;
+import cc.kune.core.client.state.HistoryTokenMustBeAuthCallback;
+import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.SiteTokenListeners;
+import cc.kune.core.client.state.SiteTokens;
+import cc.kune.gspace.client.options.general.UserOptGeneral;
+
+import com.google.inject.Inject;
+import com.google.inject.Provider;
+import com.google.inject.Singleton;
+
+ at Singleton
+public class VerifyEmailClientManager {
+
+ @Inject
+ VerifyEmailClientManager(final Session session, final SiteTokenListeners tokens,
+ final Provider<UserOptGeneral> optGeneral, final I18nTranslationService i18n,
+ final Provider<UserServiceAsync> userService) {
+ 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();
+ }
+ });
+ }
+ });
+
+ }
+}
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/search/SitebarSearchPanel.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -22,8 +22,8 @@
import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.client.sitebar.search.SitebarSearchPresenter.SitebarSearchView;
-import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.gspace.client.armor.GSpaceArmor;
import com.google.gwt.event.dom.client.HasAllFocusHandlers;
@@ -49,7 +49,7 @@
private final SuggestBox suggestBox;
@Inject
- public SitebarSearchPanel(final GSpaceArmor gs, final CoreResources img, final Session session,
+ public SitebarSearchPanel(final GSpaceArmor gs, final CoreResources img, final SessionConstants session,
final StateManager stateManager, final I18nUITranslationService i18n) {
searchButton = new PushButton(new Image(img.kuneSearchIco()), new Image(img.kuneSearchIcoPush()));
searchButton.ensureDebugId(SITE_SEARCH_BUTTON);
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPanel.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -23,7 +23,7 @@
import cc.kune.common.client.ui.BlinkAnimation;
import cc.kune.core.client.i18n.I18nUITranslationService;
import cc.kune.core.client.sitebar.spaces.SpaceSelectorPresenter.SpaceSelectorView;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.gspace.client.armor.GSpaceArmor;
import cc.kune.gspace.client.armor.resources.GSpaceArmorResources;
@@ -60,7 +60,7 @@
@Inject
public SpaceSelectorPanel(final GSpaceArmor armor, final I18nUITranslationService i18n,
- final GSpaceArmorResources res, final Session session) {
+ final GSpaceArmorResources res, final SessionConstants session) {
armor.getSitebar().insert(uiBinder.createAndBindUi(this), 0);
// homeButton.setVisible(false);
final String siteCommonName = i18n.getSiteCommonName();
Modified: trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sitebar/spaces/SpaceSelectorPresenter.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -124,7 +124,7 @@
this.i18n = i18n;
currentSpace = null;
homeToken = SiteTokens.HOME;
- inboxToken = SiteTokens.WAVEINBOX;
+ inboxToken = SiteTokens.WAVE_INBOX;
groupToken = SiteTokens.GROUP_HOME;
publicToken = TokenUtils.preview(SiteTokens.GROUP_HOME);
view.getHomeBtn().addClickHandler(new ClickHandler() {
@@ -254,7 +254,7 @@
if (currentSpace == Space.userSpace) {
restoreToken(homeToken);
}
- inboxToken = SiteTokens.WAVEINBOX;
+ inboxToken = SiteTokens.WAVE_INBOX;
}
private void onUserSpaceSelect(final boolean shouldRestoreToken) {
@@ -268,7 +268,7 @@
} else {
signIn.get().setErrorMessage(i18n.t("Sign in or create an account to access to your inbox"),
NotifyLevel.info);
- stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGNIN, inboxToken));
+ stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGN_IN, inboxToken));
getView().setUserBtnDown(false);
}
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/JoinGroupAction.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -98,7 +98,7 @@
} else {
signIn.get().setErrorMessage(i18n.t("Sign in or create an account to participate in this group"),
NotifyLevel.info);
- stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGNIN,
+ stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGN_IN,
session.getCurrentStateToken().toString()));
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/SessionAction.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -28,33 +28,33 @@
import com.google.inject.Inject;
public abstract class SessionAction extends AbstractExtendedAction {
- protected final Session session;
+ protected final Session session;
- @Inject
- public SessionAction(final Session session, final boolean authNeed) {
- this.session = session;
- session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
- @Override
- public void onUserSignInOrSignOut(final UserSignInOrSignOutEvent event) {
- refreshStatus(authNeed, event.isLogged());
- }
- });
- }
+ @Inject
+ public SessionAction(final Session session, final boolean authNeed) {
+ this.session = session;
+ session.onUserSignInOrSignOut(true, new UserSignInOrSignOutHandler() {
+ @Override
+ public void onUserSignInOrSignOut(final UserSignInOrSignOutEvent event) {
+ refreshStatus(authNeed, event.isLogged());
+ }
+ });
+ }
- public void refreshStatus(final boolean authNeed, final boolean isLogged) {
- boolean visible = false;
- final boolean noLogged = !isLogged;
- if (authNeed && noLogged) {
- visible = false;
- } else {
- // Auth ok
- visible = true;
- }
- setVisible(visible);
+ public void refreshStatus(final boolean authNeed, final boolean isLogged) {
+ boolean visible = false;
+ final boolean noLogged = !isLogged;
+ if (authNeed && noLogged) {
+ visible = false;
+ } else {
+ // Auth ok
+ visible = true;
}
+ setVisible(visible);
+ }
- public void setVisible(final boolean visible) {
- setEnabled(visible);
- putValue(GuiActionDescrip.VISIBLE, visible);
- }
+ public void setVisible(final boolean visible) {
+ setEnabled(visible);
+ putValue(GuiActionDescrip.VISIBLE, visible);
+ }
}
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNAdminsMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNAdminsMenuItemsRegistry.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNAdminsMenuItemsRegistry.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -37,7 +37,7 @@
import cc.kune.core.client.sn.actions.conditions.IsMeCondition;
import cc.kune.core.client.sn.actions.conditions.IsNotMeCondition;
import cc.kune.core.client.sn.actions.conditions.IsPersonCondition;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -45,7 +45,7 @@
public class GroupSNAdminsMenuItemsRegistry extends AbstractSNMembersActionsRegistry {
@Inject
- public GroupSNAdminsMenuItemsRegistry(final Session session, final I18nTranslationService i18n,
+ public GroupSNAdminsMenuItemsRegistry(final SessionConstants session, final I18nTranslationService i18n,
final IsLoggedCondition isLogged, final IsCurrentStateAdministrableCondition isAdministrable,
final IsPersonCondition isPerson, final IsGroupCondition isGroup,
final IsBuddieCondition isBuddie, final IsMeCondition isMe, final IsNotMeCondition isNotMe,
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNCollabsMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNCollabsMenuItemsRegistry.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNCollabsMenuItemsRegistry.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -37,7 +37,7 @@
import cc.kune.core.client.sn.actions.conditions.IsMeCondition;
import cc.kune.core.client.sn.actions.conditions.IsNotMeCondition;
import cc.kune.core.client.sn.actions.conditions.IsPersonCondition;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -45,7 +45,7 @@
public class GroupSNCollabsMenuItemsRegistry extends AbstractSNMembersActionsRegistry {
@Inject
- public GroupSNCollabsMenuItemsRegistry(final Session session, final I18nTranslationService i18n,
+ public GroupSNCollabsMenuItemsRegistry(final SessionConstants session, final I18nTranslationService i18n,
final IsLoggedCondition isLogged,
final IsCurrentStateAdministrableCondition isAdministrableCondition,
final IsPersonCondition isPersonCondition, final IsGroupCondition isGroupCondition,
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNConfActions.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -41,8 +41,8 @@
import cc.kune.core.client.sn.actions.WriteToMembers;
import cc.kune.core.client.sn.actions.conditions.IsGroupCondition;
import cc.kune.core.client.sn.actions.conditions.IsLoggedCondition;
-import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.core.shared.domain.AdmissionType;
import cc.kune.core.shared.domain.SocialNetworkVisibility;
import cc.kune.core.shared.dto.GroupDTO;
@@ -64,7 +64,7 @@
public static final String OPTIONS_STYLES = "k-sn-options-menu, k-noborder, k-nobackcolor, k-no-backimage, k-btn-min";
@Inject
- public GroupSNConfActions(final Session session, final StateManager stateManager,
+ public GroupSNConfActions(final SessionConstants session, final StateManager stateManager,
final I18nTranslationService i18n, final Provider<MembersVisibilityMenuItem> membersVisibility,
final Provider<MembersModerationMenuItem> membersModeration, final CoreResources res,
final IsLoggedCondition isLoggedCondition, final JoinGroupAction joinGroupAction,
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNPendingsMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNPendingsMenuItemsRegistry.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/GroupSNPendingsMenuItemsRegistry.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -30,7 +30,7 @@
import cc.kune.core.client.sn.actions.conditions.IsCurrentStateAdministrableCondition;
import cc.kune.core.client.sn.actions.conditions.IsGroupCondition;
import cc.kune.core.client.sn.actions.conditions.IsPersonCondition;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -38,7 +38,7 @@
public class GroupSNPendingsMenuItemsRegistry extends AbstractSNMembersActionsRegistry {
@Inject
- public GroupSNPendingsMenuItemsRegistry(final Session session, final IsCurrentStateAdministrableCondition isAdministrableCondition,
+ public GroupSNPendingsMenuItemsRegistry(final SessionConstants session, final IsCurrentStateAdministrableCondition isAdministrableCondition,
final IsPersonCondition isPersonCondition, final IsGroupCondition isGroupCondition,
final ChangeToCollabAction changeToCollabAction, final ChangeToAdminAction changeToAdminAction,
final RemoveMemberAction removeMemberAction, final AcceptJoinGroupAction acceptJoinGroupAction,
Modified: trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/sn/actions/registry/UserSNMenuItemsRegistry.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -39,7 +39,7 @@
import cc.kune.core.client.sn.actions.conditions.IsMeCondition;
import cc.kune.core.client.sn.actions.conditions.IsNotMeCondition;
import cc.kune.core.client.sn.actions.conditions.IsPersonCondition;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -48,7 +48,7 @@
public class UserSNMenuItemsRegistry extends AbstractSNMembersActionsRegistry {
@Inject
- public UserSNMenuItemsRegistry(final Session session, final I18nTranslationService i18n,
+ public UserSNMenuItemsRegistry(final SessionConstants session, final I18nTranslationService i18n,
final IsCurrentStateAdministrableCondition isAdministrableCondition,
final IsPersonCondition isPerson, final IsGroupCondition isGroup,
final ImPartOfGroupCondition imPartOfGroup, final IsLoggedCondition isLogged,
Added: trunk/src/main/java/cc/kune/core/client/state/HistoryTokenAuthNotNeededCallback.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/HistoryTokenAuthNotNeededCallback.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/state/HistoryTokenAuthNotNeededCallback.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -0,0 +1,18 @@
+package cc.kune.core.client.state;
+
+/**
+ * The Class HistoryTokenNotLoggedCallback is used to indicate the action
+ * related to this token (like #about, etc) should not be authenticated.
+ */
+public abstract class HistoryTokenAuthNotNeededCallback implements HistoryTokenCallback {
+
+ /* (non-Javadoc)
+ * @see cc.kune.core.client.state.HistoryTokenCallback#authMandatory()
+ */
+ @Override
+ public boolean authMandatory() {
+ return false;
+
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/core/client/state/HistoryTokenCallback.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/HistoryTokenCallback.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/state/HistoryTokenCallback.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -19,8 +19,25 @@
*/
package cc.kune.core.client.state;
+/**
+ * The Interface HistoryTokenCallback is used make relations between browser
+ * hashs like #inbox #signin etc, with its actions
+ */
public interface HistoryTokenCallback {
+ /**
+ * Auth The user should be logged (mandatory).
+ *
+ * @return true, if yes
+ */
+ boolean authMandatory();
+
+ /**
+ * On history token do some action (Example #inbox, #newgroup)
+ *
+ * @param token
+ * the token
+ */
void onHistoryToken(String token);
}
Added: trunk/src/main/java/cc/kune/core/client/state/HistoryTokenMustBeAuthCallback.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/HistoryTokenMustBeAuthCallback.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/client/state/HistoryTokenMustBeAuthCallback.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -0,0 +1,19 @@
+package cc.kune.core.client.state;
+
+/**
+ * The Class HistoryTokenMustBeAuthCallback is used to indicate the action
+ * related to this token (like #inbox, etc) should be authenticated.
+ */
+public abstract class HistoryTokenMustBeAuthCallback implements HistoryTokenCallback {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see cc.kune.core.client.state.HistoryTokenCallback#authMandatory()
+ */
+ @Override
+ public boolean authMandatory() {
+ return true;
+ }
+
+}
Modified: trunk/src/main/java/cc/kune/core/client/state/Session.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/Session.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/state/Session.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -61,14 +61,6 @@
public interface Session {
- long A_DAY = 1000 * 60 * 60 * 24;
- long ANON_SESSION_DURATION = A_DAY;
- long ANON_SESSION_DURATION_AFTER_REG = A_DAY * 365;
- long SESSION_DURATION = A_DAY * 14; // two weeks login session duration
- // long SESSION_DURATION = 100; // For test
-
- String USERHASH = "k007userHash";
-
void check(AsyncCallbackSimple<Void> callback);
StateContainerDTO getContainerState();
Modified: trunk/src/main/java/cc/kune/core/client/state/SiteTokens.java
===================================================================
--- trunk/src/main/java/cc/kune/core/client/state/SiteTokens.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/state/SiteTokens.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -24,32 +24,40 @@
import com.google.inject.Inject;
/**
- * Some common history tokens like {@link #SIGNIN} and {@link #NEWGROUP}
+ * Some common history tokens like {@link #SIGN_IN} and {@link #NEW_GROUP}
*
*/
public final class SiteTokens {
- public static final String ABOUTKUNE = "about";
+ public static final String ABOUT_KUNE = "about";
public final static String GROUP_HOME = "";
+ public final static String GROUP_PREFS = "gprefs";
public final static String HOME = "";
- public final static String NEWGROUP = "newgroup";
+ public final static String NEW_GROUP = "newgroup";
+ public final static String PREFS = "prefs";
public static final String PREVIEW = "preview";
public final static String REGISTER = "register";
- public final static String SIGNIN = "signin";
+ public final static String RESET_PWD = "resetpasswd";
+ public final static String SIGN_IN = "signin";
public final static String SUBTITLES = "sub";
public final static String TRANSLATE = "translate";
- public final static String WAVEINBOX = "inbox";
+ public final static String VERIFY_EMAIL = "verifyemail";
+ public final static String WAVE_INBOX = "inbox";
@Inject
public SiteTokens(final ReservedWordsRegistryDTO reserverdWords) {
- reserverdWords.add(ABOUTKUNE);
+ reserverdWords.add(ABOUT_KUNE);
reserverdWords.add(GROUP_HOME);
reserverdWords.add(HOME);
- reserverdWords.add(NEWGROUP);
+ reserverdWords.add(NEW_GROUP);
reserverdWords.add(PREVIEW);
reserverdWords.add(REGISTER);
- reserverdWords.add(SIGNIN);
+ reserverdWords.add(SIGN_IN);
reserverdWords.add(TRANSLATE);
- reserverdWords.add(WAVEINBOX);
+ reserverdWords.add(WAVE_INBOX);
reserverdWords.add(SUBTITLES);
+ reserverdWords.add(PREFS);
+ reserverdWords.add(GROUP_PREFS);
+ reserverdWords.add(VERIFY_EMAIL);
+ reserverdWords.add(RESET_PWD);
}
}
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-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/client/state/impl/StateManagerDefault.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -31,18 +31,18 @@
import cc.kune.common.client.notify.ProgressHideEvent;
import cc.kune.common.client.utils.Pair;
import cc.kune.core.client.events.AppStartEvent;
+import cc.kune.core.client.events.AppStartEvent.AppStartHandler;
import cc.kune.core.client.events.GoHomeEvent;
import cc.kune.core.client.events.GroupChangedEvent;
+import cc.kune.core.client.events.GroupChangedEvent.GroupChangedHandler;
import cc.kune.core.client.events.SocialNetworkChangedEvent;
+import cc.kune.core.client.events.SocialNetworkChangedEvent.SocialNetworkChangedHandler;
import cc.kune.core.client.events.StateChangedEvent;
+import cc.kune.core.client.events.StateChangedEvent.StateChangedHandler;
import cc.kune.core.client.events.ToolChangedEvent;
+import cc.kune.core.client.events.ToolChangedEvent.ToolChangedHandler;
import cc.kune.core.client.events.UserSignInEvent;
import cc.kune.core.client.events.UserSignOutEvent;
-import cc.kune.core.client.events.AppStartEvent.AppStartHandler;
-import cc.kune.core.client.events.GroupChangedEvent.GroupChangedHandler;
-import cc.kune.core.client.events.SocialNetworkChangedEvent.SocialNetworkChangedHandler;
-import cc.kune.core.client.events.StateChangedEvent.StateChangedHandler;
-import cc.kune.core.client.events.ToolChangedEvent.ToolChangedHandler;
import cc.kune.core.client.rpcservices.AsyncCallbackSimple;
import cc.kune.core.client.sitebar.spaces.Space;
import cc.kune.core.client.sitebar.spaces.SpaceConfEvent;
@@ -150,6 +150,20 @@
}
}
+ private void doActionOrSignInIfNeeded(final HistoryTokenCallback tokenListener,
+ final String newHistoryToken) {
+ if (tokenListener.authMandatory() && session.isNotLogged()) {
+ Log.debug("login mandatory for " + newHistoryToken);
+ // Ok, we have to redirect because this token (for instance
+ // #translate) needs the user authenticated
+ redirectButSignInBefore(newHistoryToken);
+ } else {
+ // The auth is not mandatory, go ahead with the token action
+ Log.debug("Executing action related with historytoken " + newHistoryToken);
+ tokenListener.onHistoryToken(newHistoryToken);
+ }
+ }
+
private void getContent(final StateToken newState) {
getContent(newState, false);
}
@@ -278,8 +292,19 @@
tokenListener = siteTokens.get(nToken);
}
Log.debug("StateManager: on history changed (" + newHistoryToken + ")");
- if (tokenListener == null) {
- // Log.debug("Is not a special hash");
+ if (tokenListener != null) {
+ Log.debug("token is one of #newgroup #signin #translate without #hash(redirection) ...");
+ if (startingUp()) {
+ // Starting 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);
+ } 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 ...
final String nToken = newHistoryToken != null ? newHistoryToken.toLowerCase() : null;
if (nToken != null && tokenMatcher.hasRedirect(nToken)) {
@@ -291,23 +316,29 @@
SpaceConfEvent.fire(eventBus, Space.groupSpace, sndToken);
SpaceConfEvent.fire(eventBus, Space.publicSpace, TokenUtils.preview(sndToken));
getContent(new StateToken(sndToken));
- } else if (firstToken.equals(SiteTokens.SUBTITLES)) {
- siteTokens.get(SiteTokens.SUBTITLES).onHistoryToken(
- tokenMatcher.getRedirect(newHistoryToken).getRight());
- } else if (firstToken.equals(SiteTokens.NEWGROUP)) {
- siteTokens.get(SiteTokens.NEWGROUP).onHistoryToken(newHistoryToken);
- } else if (firstToken.equals(SiteTokens.SIGNIN)) {
- if (session.isLogged()) {
- // We are logged, then redirect:
- history.newItem(sndToken, false);
- processHistoryToken(sndToken);
- } else {
- // We have to loggin
- siteTokens.get(SiteTokens.SIGNIN).onHistoryToken(newHistoryToken);
+ } else {
+ final HistoryTokenCallback tokenWithRedirect = siteTokens.get(firstToken);
+ if (tokenWithRedirect != null) {
+ Log.info("Is some #subtitle(foo) or #verifyemail(hash) etc");
+ doActionOrSignInIfNeeded(tokenWithRedirect,
+ tokenMatcher.getRedirect(newHistoryToken).getRight());
+ } else if (firstToken.equals(SiteTokens.NEW_GROUP)) {
+ siteTokens.get(SiteTokens.NEW_GROUP).onHistoryToken(newHistoryToken);
+ } else if (firstToken.equals(SiteTokens.SIGN_IN)) {
+ if (session.isLogged()) {
+ // We are logged, then redirect:
+ history.newItem(sndToken, false);
+ processHistoryToken(sndToken);
+ } else {
+ // We have to login
+ siteTokens.get(SiteTokens.SIGN_IN).onHistoryToken(newHistoryToken);
+ }
}
}
- } else
- // No redirection
+ } else {
+ // Is not a Redirect token
+ Log.debug("Is not a redirect token");
+ }
if (tokenMatcher.isWaveToken(newHistoryToken)) {
if (session.isLogged()) {
SpaceConfEvent.fire(eventBus, Space.userSpace, newHistoryToken);
@@ -320,7 +351,7 @@
}
} else {
// Wave, but don't logged
- history.newItem(TokenUtils.addRedirect(SiteTokens.SIGNIN, newHistoryToken));
+ redirectButSignInBefore(newHistoryToken);
if (startingUp()) {
// Starting application (with Wave)
getContent(new StateToken(SiteTokens.GROUP_HOME), false);
@@ -334,30 +365,23 @@
} else {
gotoDefaultHomepage();
}
- } else {
- // token is one of #newgroup #signin #translate ...
- if (startingUp()) {
- // Starting 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
- tokenListener.onHistoryToken(newHistoryToken);
}
} else {
resumedHistoryToken = newHistoryToken;
}
}
+ private void redirectButSignInBefore(final String newHistoryToken) {
+ history.newItem(TokenUtils.addRedirect(SiteTokens.SIGN_IN, newHistoryToken));
+ }
+
@Override
public void redirectOrRestorePreviousToken() {
final String token = history.getToken();
if (tokenMatcher.hasRedirect(token)) {
// URL of the form signin(group.tool)
final String previousToken = tokenMatcher.getRedirect(token).getRight();
- if (previousToken.equals(SiteTokens.WAVEINBOX) && session.isNotLogged()) {
+ if (previousToken.equals(SiteTokens.WAVE_INBOX) && session.isNotLogged()) {
// signin(inbox) && cancel
restorePreviousToken();
} else {
Modified: trunk/src/main/java/cc/kune/core/public/ws.css
===================================================================
--- trunk/src/main/java/cc/kune/core/public/ws.css 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/public/ws.css 2012-01-16 20:53:44 UTC (rev 1663)
@@ -1,4 +1,4 @@
-GCHARSET "UTF-8 "; body {
+GCHARSET "UTF-8 "; body {
background-color: transparent;
color: black;
font-family: 'Ubuntu', Arial;
@@ -324,12 +324,9 @@
float: left;
}
-.k-space-sel-btn-blink {
-/* kfilter: alpha(opacity = */
-/* 30); */
-/* -moz-opacity: 0.30; */
-/* -khtml-opacity: 0.30; */
-/* opacity: 0.30; */
+.k-space-sel-btn-blink { /* kfilter: alpha(opacity = */
+ /* 30); */ /* -moz-opacity: 0.30; */
+ /* -khtml-opacity: 0.30; */ /* opacity: 0.30; */
visibility: hidden;
}
@@ -953,7 +950,7 @@
border-color: #CCCCCC !important;
background: inherits !important;
kfilter: alpha(opacity =
- 60) !important;
+ 60) !important;
-moz-opacity: 0.60 !important;
-khtml-opacity: 0.60 !important;
opacity: 0.60 !important;
@@ -1239,7 +1236,7 @@
-moz-border-radius-bottomleft: 5px;
border-bottom-left-radius: 5px;
kfilter: alpha(opacity =
- 90);
+ 90);
-moz-opacity: 0.90;
-khtml-opacity: 0.90;
opacity: 0.90;
@@ -1561,14 +1558,13 @@
}
/* Calendar */
-
.gwt-cal-MonthView {
- bottom: 0 !important;
- height: auto !important;
- left: 0 !important;
- overflow: auto !important;
- position: absolute !important;
- right: 0 !important;
- top: 0 !important;
- width: auto !important;
+ bottom: 0 !important;
+ height: auto !important;
+ left: 0 !important;
+ overflow: auto !important;
+ position: absolute !important;
+ right: 0 !important;
+ top: 0 !important;
+ width: auto !important;
}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/server/mail/MailServiceDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/mail/MailServiceDefault.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/server/mail/MailServiceDefault.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -77,14 +77,19 @@
for (final String to : tos) {
try {
message.setFrom(new InternetAddress(from));
+ // In case we should use utf8 also in address:
+ // http://stackoverflow.com/questions/2656478/send-javax-mail-internet-mimemessage-to-a-recipient-with-non-ascii-name
message.addRecipient(Message.RecipientType.TO, new InternetAddress(to));
+ // If additional header should be added
+ // message.addHeader(name, MimeUtility.encodeText(value, "utf-8", "B"));
final String formatedSubject = subject.getString();
- message.setSubject(formatedSubject);
+ message.setSubject(formatedSubject, "utf-8");
final String formatedBody = body.getString();
if (isHtml) {
- message.setContent(formatedBody, "text/html");
+ // message.setContent(formatedBody, "text/html");
+ message.setText(formatedBody, "UTF-8", "html");
} else {
- message.setText(formatedBody);
+ message.setText(formatedBody, "UTF-8");
}
// Send message
Transport.send(message);
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-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/server/manager/UserManager.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -21,7 +21,9 @@
import org.waveprotocol.box.server.authentication.PasswordDigest;
+import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.errors.I18nNotFoundException;
+import cc.kune.core.server.manager.impl.EmailConfirmationType;
import cc.kune.core.shared.domain.UserSNetVisibility;
import cc.kune.core.shared.dto.I18nLanguageSimpleDTO;
import cc.kune.core.shared.dto.UserDTO;
@@ -29,6 +31,16 @@
import cc.kune.domain.UserBuddiesData;
public interface UserManager {
+ /**
+ * Ask for email confirmation.
+ *
+ * @param user
+ * the user
+ * @param type
+ * the type
+ */
+ void askForEmailConfirmation(User user, EmailConfirmationType type) throws DefaultException;
+
User changePasswd(Long userId, String oldPassword, String newPassword);
/**
@@ -83,4 +95,16 @@
*/
User update(Long userId, UserDTO user, I18nLanguageSimpleDTO lang);
+ /**
+ * Verify password hash of a user.
+ *
+ * @param userId
+ * the user id
+ * @param emailReceivedHash
+ * the email received hash
+ * @param period
+ * the period (1h or more if is a new account);
+ */
+ void verifyPasswordHash(Long userId, String emailReceivedHash, long period) throws DefaultException;
+
}
Added: trunk/src/main/java/cc/kune/core/server/manager/impl/EmailConfirmationType.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/manager/impl/EmailConfirmationType.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/EmailConfirmationType.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -0,0 +1,10 @@
+package cc.kune.core.server.manager.impl;
+
+/**
+ * The Enum EmailConfirmationType is used internally to differentiate several
+ * types of email confirmation/verification
+ */
+public enum EmailConfirmationType {
+ emailVerification, fstTimeEmailVerification, passwordReset
+
+}
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-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/server/manager/impl/UserManagerDefault.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -20,11 +20,13 @@
package cc.kune.core.server.manager.impl;
import java.util.Collection;
+import java.util.Date;
import java.util.HashSet;
import java.util.List;
import java.util.TimeZone;
import java.util.Timer;
import java.util.TimerTask;
+import java.util.UUID;
import javax.persistence.EntityManager;
import javax.persistence.NoResultException;
@@ -46,11 +48,15 @@
import cc.kune.common.shared.utils.TextUtils;
import cc.kune.core.client.errors.DefaultException;
import cc.kune.core.client.errors.EmailAddressInUseException;
+import cc.kune.core.client.errors.EmailHashExpiredException;
+import cc.kune.core.client.errors.EmailHashInvalidException;
import cc.kune.core.client.errors.GroupLongNameInUseException;
import cc.kune.core.client.errors.GroupShortNameInUseException;
import cc.kune.core.client.errors.I18nNotFoundException;
import cc.kune.core.client.errors.UserRegistrationException;
import cc.kune.core.client.errors.WrongCurrentPasswordException;
+import cc.kune.core.client.state.SiteTokens;
+import cc.kune.core.client.state.TokenUtils;
import cc.kune.core.server.i18n.I18nTranslationServiceMultiLang;
import cc.kune.core.server.manager.GroupManager;
import cc.kune.core.server.manager.I18nCountryManager;
@@ -121,7 +127,36 @@
this.notifyService = notifyService;
}
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * cc.kune.core.server.manager.UserManager#askForEmailConfirmation(cc.kune
+ * .domain.User, cc.kune.core.server.manager.impl.EmailConfirmationType)
+ */
@Override
+ public void askForEmailConfirmation(final User user, final EmailConfirmationType type)
+ throws DefaultException {
+ user.setEmailCheckDate(System.currentTimeMillis());
+ final String hash = UUID.randomUUID().toString();
+ user.setEmailConfirmHash(hash);
+ persist(user);
+
+ switch (type) {
+ case emailVerification:
+ case fstTimeEmailVerification:
+ notifyService.sendEmailToWithLink(user, "Please verify your email",
+ "Please click in the following link to verify your email at %s:",
+ TokenUtils.addRedirect(SiteTokens.VERIFY_EMAIL, hash));
+ break;
+ case passwordReset:
+ // FIXME
+ default:
+ break;
+ }
+ }
+
+ @Override
public User changePasswd(final Long userId, final String oldPassword, final String newPassword) {
final User user = find(userId);
final ParticipantId participantId = participantUtils.of(user.getShortName());
@@ -211,10 +246,7 @@
// Is this necessary? try to remove (used when we were setting the def
// content
// contentManager.save(userGroup.getDefaultContent());
-
- // FIXME: notifyService.
- // mailService.sendPlain(new FormatedString("Welcome", ""), new
- // FormatedString("welcome"), email);
+ askForEmailConfirmation(user, EmailConfirmationType.emailVerification);
return user;
} catch (final RuntimeException e) {
try {
@@ -400,4 +432,24 @@
return user;
}
+ @Override
+ public void verifyPasswordHash(final Long userId, final String emailReceivedHash, final long period)
+ throws DefaultException {
+ final User user = find(userId);
+ final Date on = new Date(user.getEmailCheckDate() + period);
+
+ final Date now = new Date();
+ if (on.before(now)) {
+ throw new EmailHashExpiredException();
+ }
+ final String emailConfirmHash = user.getEmailConfirmHash();
+ if (emailReceivedHash != null && emailConfirmHash != null
+ && emailReceivedHash.equals(emailConfirmHash)) {
+ user.setEmailVerified(true);
+ user.setEmailConfirmHash("");
+ persist(user);
+ } else {
+ throw new EmailHashInvalidException();
+ }
+ }
}
Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotificationHtmlHelper.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/notifier/NotificationHtmlHelper.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/server/notifier/NotificationHtmlHelper.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -2,7 +2,6 @@
import cc.kune.core.server.mail.FormatedString;
import cc.kune.core.server.utils.AbsoluteFileDownloadUtils;
-import cc.kune.core.shared.utils.SharedFileDownloadUtils;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@@ -23,7 +22,7 @@
+ "%s"
+ "</td></tr></tbody></table>";
- private final SharedFileDownloadUtils fileDownloadUtils;
+ private final AbsoluteFileDownloadUtils fileDownloadUtils;
/**
* Instantiates a new notify html helper.
@@ -51,9 +50,25 @@
*/
public FormatedString groupNotification(final String groupName, final boolean hasLogo,
final String message) {
- final String groupUrl = fileDownloadUtils.getPrefix() + "#" + groupName;
+ final String groupUrl = fileDownloadUtils.getUrl(groupName);
return FormatedString.build(false, GROUP_TEMPLATE, groupUrl,
- fileDownloadUtils.getLogoAvatarHtml(groupName, hasLogo, false, 50, 50), groupUrl, groupName,
+ fileDownloadUtils.getLogoAvatarHtml(groupName, hasLogo, false, 50, 5), groupUrl, groupName,
message);
}
+
+ /**
+ * Format a user notification with an additional link. The first an unique %s
+ * in body is changed by the site name.
+ *
+ * @param body
+ * the body
+ * @param hash
+ * the hash
+ * @return the formated string
+ */
+ public FormatedString userNotification(final String body, final String hash) {
+ final String hashUrl = fileDownloadUtils.getUrl(hash);
+ return FormatedString.build(false, body + "<br><a href='%s'>%s</a>",
+ fileDownloadUtils.getSiteCommonName(), hashUrl, hashUrl);
+ }
}
Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotificationSenderDefault.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/notifier/NotificationSenderDefault.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/server/notifier/NotificationSenderDefault.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -92,7 +92,8 @@
String.format("<b>%s</b>%s", subject.getString(), body.getString()));
break;
case email:
- if (forceSend || (noOnline(username) && withFrequency == user.getEmailNotifFreq())) {
+ if (forceSend
+ || (user.isEmailVerified() && noOnline(username) && withFrequency == user.getEmailNotifFreq())) {
// we'll send this notification if is mandatory or this user is not
// only and has this freq configured
mailService.send(subject, FormatedString.build(emailTemplate.replace("%s", body.getString())),
Modified: trunk/src/main/java/cc/kune/core/server/notifier/NotificationService.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/notifier/NotificationService.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/server/notifier/NotificationService.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -34,6 +34,10 @@
this.userFinder = userFinder;
}
+ private FormatedString createPlainSubject(final String subject) {
+ return FormatedString.build(subject);
+ }
+
@SuppressWarnings("unchecked")
private void getAllUserMembers(final Set<User> users, final Group groupToNotify,
final boolean onlyAdmins) {
@@ -79,14 +83,34 @@
private void notifyToAll(final Group groupSender, final String subject, final String message,
final Collection<User> users) {
for (final User to : users) {
- sender.add(NotificationType.email, FormatedString.build(subject),
+ sender.add(NotificationType.email, createPlainSubject(subject),
helper.groupNotification(groupSender.getShortName(), groupSender.hasLogo(), message), true,
true, to);
}
}
public void notifyUser(final User to, final Group group, final String subject, final String message) {
- sender.add(NotificationType.email, FormatedString.build(subject),
+ sender.add(NotificationType.email, createPlainSubject(subject),
helper.groupNotification(group.getShortName(), group.hasLogo(), message), true, true, to);
}
+
+ /**
+ * Send email to an User with a link.The first an unique %s in body is changed
+ * by the site name.
+ *
+ * @param to
+ * the User to send the notification
+ * @param subject
+ * the subject of the email
+ * @param body
+ * the body of the email with a %s that will be replaced by the site
+ * name
+ * @param hash
+ * the hash an additional link that will be added at the end
+ */
+ public void sendEmailToWithLink(final User to, final String subject, final String body,
+ final String hash) {
+ sender.add(NotificationType.email, createPlainSubject(subject), helper.userNotification(body, hash),
+ true, true, to);
+ }
}
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-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/server/rpc/UserRPC.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -19,6 +19,7 @@
*/
package cc.kune.core.server.rpc;
+import javax.persistence.NoResultException;
import javax.servlet.http.HttpSession;
import org.jivesoftware.smack.util.Base64;
@@ -28,6 +29,7 @@
import cc.kune.core.client.errors.AccessViolationException;
import cc.kune.core.client.errors.DefaultException;
+import cc.kune.core.client.errors.EmailNotFoundException;
import cc.kune.core.client.errors.UserAuthException;
import cc.kune.core.client.rpcservices.UserService;
import cc.kune.core.server.UserSession;
@@ -36,10 +38,12 @@
import cc.kune.core.server.auth.Authenticated;
import cc.kune.core.server.auth.Authorizated;
import cc.kune.core.server.manager.UserManager;
+import cc.kune.core.server.manager.impl.EmailConfirmationType;
import cc.kune.core.server.mapper.Mapper;
import cc.kune.core.server.properties.ReservedWordsRegistry;
import cc.kune.core.server.users.UserInfo;
import cc.kune.core.server.users.UserInfoService;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.core.shared.domain.AccessRol;
import cc.kune.core.shared.domain.UserSNetVisibility;
import cc.kune.core.shared.domain.utils.StateToken;
@@ -50,6 +54,7 @@
import cc.kune.core.shared.dto.WaveClientParams;
import cc.kune.domain.Group;
import cc.kune.domain.User;
+import cc.kune.domain.finders.UserFinder;
import cc.kune.wave.server.CustomWaveClientServlet;
import com.google.inject.Inject;
@@ -62,6 +67,7 @@
private final ContentRPC contentRPC;
private final Mapper mapper;
private final ReservedWordsRegistry reserverdWords;
+ private final UserFinder userFinder;
private final UserInfoService userInfoService;
private final UserManager userManager;
private final UserSessionManager userSessionManager;
@@ -75,7 +81,7 @@
final UserInfoService userInfoService, final Mapper mapper,
final SessionManager waveSessionManager, final CustomWaveClientServlet waveClientServlet,
final ReservedWordsRegistry reserverdWords, final ContentRPC contentRPC,
- final UserSessionManager userSessionManager) {
+ final UserSessionManager userSessionManager, final UserFinder userFinder) {
this.userManager = userManager;
this.useSocketIO = useSocketIO;
this.userInfoService = userInfoService;
@@ -85,9 +91,29 @@
this.reserverdWords = reserverdWords;
this.contentRPC = contentRPC;
this.userSessionManager = userSessionManager;
+ this.userFinder = userFinder;
}
+ @Authenticated
@Override
+ @Transactional
+ public void askForEmailConfirmation(final String userHash) throws DefaultException {
+ final User user = userSessionManager.getUser();
+ userManager.askForEmailConfirmation(user, EmailConfirmationType.emailVerification);
+ }
+
+ @Override
+ @Transactional
+ public void askForEmailForgot(final String email) throws DefaultException {
+ try {
+ final User user = userFinder.findByEmail(email);
+ userManager.askForEmailConfirmation(user, EmailConfirmationType.passwordReset);
+ } catch (final NoResultException e) {
+ throw new EmailNotFoundException();
+ }
+ }
+
+ @Override
@Authenticated
@Transactional
public void changePasswd(final String userHash, final String oldPassword, final String newPassword)
@@ -131,7 +157,7 @@
final JSONObject sessionJson = waveClientServlet.getSessionJson(sessionFromToken);
final JSONObject clientFlags = new JSONObject(); // waveClientServlet.getClientFlags();
return new WaveClientParams(sessionJson.toString(), clientFlags.toString(), useSocketIO);
- }
+ };
private UserInfoDTO loadUserInfo(final User user) throws DefaultException {
final UserInfo userInfo = userInfoService.buildInfo(user, userSessionManager.getHash());
@@ -146,7 +172,7 @@
// sessionService.getNewSession();
final User user = userManager.login(nickOrEmail, passwd);
return loginUser(user, waveToken);
- };
+ }
private UserInfoDTO loginUser(final User user, final String waveToken) throws DefaultException {
if (user != null) {
@@ -207,4 +233,12 @@
userSessionManager.updateLoggedUser();
return contentRPC.getContent(userHash, userUpdated.getUserGroup().getStateToken());
}
+
+ @Authenticated
+ @Override
+ @Transactional
+ public void verifyPasswordHash(final String userHash, final String emailReceivedHash) {
+ final User user = userSessionManager.getUser();
+ userManager.verifyPasswordHash(user.getId(), emailReceivedHash, SessionConstants._AN_HOUR);
+ }
}
Modified: trunk/src/main/java/cc/kune/core/server/utils/AbsoluteFileDownloadUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/core/server/utils/AbsoluteFileDownloadUtils.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/server/utils/AbsoluteFileDownloadUtils.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -13,8 +13,15 @@
@Singleton
public class AbsoluteFileDownloadUtils extends SharedFileDownloadUtils {
+ private final KuneBasicProperties properties;
+
@Inject
public AbsoluteFileDownloadUtils(final KuneBasicProperties properties) {
super(properties.getSiteUrl());
+ this.properties = properties;
}
+
+ public String getSiteCommonName() {
+ return properties.getSiteCommonName();
+ }
}
Added: trunk/src/main/java/cc/kune/core/shared/SessionConstants.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/SessionConstants.java (rev 0)
+++ trunk/src/main/java/cc/kune/core/shared/SessionConstants.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -0,0 +1,17 @@
+package cc.kune.core.shared;
+
+public final class SessionConstants {
+
+ public final static int _AN_HOUR = 1000 * 60 * 60;
+ public final static long A_DAY = _AN_HOUR * 24;
+ public final static long ANON_SESSION_DURATION = A_DAY;
+ public final static long ANON_SESSION_DURATION_AFTER_REG = A_DAY * 365;
+ public final static long SESSION_DURATION = A_DAY * 14; // two weeks login
+ // session duration
+ // public final static long SESSION_DURATION = 100; // For test
+ public final static String USERHASH = "k007userHash";
+
+ public SessionConstants() {
+
+ }
+}
\ No newline at end of file
Modified: trunk/src/main/java/cc/kune/core/shared/dto/UserSimpleDTO.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/dto/UserSimpleDTO.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/shared/dto/UserSimpleDTO.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -25,146 +25,159 @@
import com.google.gwt.user.client.rpc.IsSerializable;
public class UserSimpleDTO implements IsSerializable {
- private I18nCountryDTO country;
- private boolean hasLogo;
- private Long id;
- private I18nLanguageDTO language;
- private String name;
- private String shortName;
- private StateToken stateToken;
- private TimeZoneDTO timezone;
- private EmailNotificationFrequency emailNotifFreq;
+ private I18nCountryDTO country;
+ private EmailNotificationFrequency emailNotifFreq;
+ private boolean emailVerified;
+ private boolean hasLogo;
+ private Long id;
+ private I18nLanguageDTO language;
+ private String name;
+ private String shortName;
+ private StateToken stateToken;
+ private TimeZoneDTO timezone;
- public UserSimpleDTO() {
- this(null, null, null, null, null);
- }
+ public UserSimpleDTO() {
+ this(null, null, null, null, null);
+ }
- public UserSimpleDTO(final String name, final String shortName, final I18nLanguageDTO language,
- final I18nCountryDTO country, final TimeZoneDTO timezone) {
- this.name = name;
- this.shortName = shortName;
- this.language = language;
- this.country = country;
- this.timezone = timezone;
- }
+ public UserSimpleDTO(final String name, final String shortName, final I18nLanguageDTO language,
+ final I18nCountryDTO country, final TimeZoneDTO timezone) {
+ this.name = name;
+ this.shortName = shortName;
+ this.language = language;
+ this.country = country;
+ this.timezone = timezone;
+ }
- @Override
- public boolean equals(final Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- final UserSimpleDTO other = (UserSimpleDTO) obj;
- if (id == null) {
- if (other.id != null) {
- return false;
- }
- } else if (!id.equals(other.id)) {
- return false;
- }
- if (shortName == null) {
- if (other.shortName != null) {
- return false;
- }
- } else if (!shortName.equals(other.shortName)) {
- return false;
- }
- return true;
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj) {
+ return true;
}
-
- public I18nCountryDTO getCountry() {
- return country;
+ if (obj == null) {
+ return false;
}
-
- public boolean getHasLogo() {
- return hasLogo;
+ if (getClass() != obj.getClass()) {
+ return false;
}
-
- public Long getId() {
- return id;
+ final UserSimpleDTO other = (UserSimpleDTO) obj;
+ if (id == null) {
+ if (other.id != null) {
+ return false;
+ }
+ } else if (!id.equals(other.id)) {
+ return false;
}
-
- public I18nLanguageDTO getLanguage() {
- return language;
+ if (shortName == null) {
+ if (other.shortName != null) {
+ return false;
+ }
+ } else if (!shortName.equals(other.shortName)) {
+ return false;
}
+ return true;
+ }
- public String getName() {
- return name;
- }
+ public I18nCountryDTO getCountry() {
+ return country;
+ }
- public String getShortName() {
- return shortName;
- }
+ public EmailNotificationFrequency getEmailNotifFreq() {
+ return emailNotifFreq;
+ }
- public StateToken getStateToken() {
- return stateToken;
- }
+ public boolean getEmailVerified() {
+ return isEmailVerified();
+ }
- public TimeZoneDTO getTimezone() {
- return timezone;
- }
+ public boolean getHasLogo() {
+ return hasLogo;
+ }
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((id == null) ? 0 : id.hashCode());
- result = prime * result + ((shortName == null) ? 0 : shortName.hashCode());
- return result;
- }
+ public Long getId() {
+ return id;
+ }
- public boolean hasLogo() {
- return hasLogo;
- }
+ public I18nLanguageDTO getLanguage() {
+ return language;
+ }
- public void setCountry(final I18nCountryDTO country) {
- this.country = country;
- }
+ public String getName() {
+ return name;
+ }
- public void setHasLogo(final boolean hasLogo) {
- this.hasLogo = hasLogo;
- }
+ public String getShortName() {
+ return shortName;
+ }
- public void setId(final Long id) {
- this.id = id;
- }
+ public StateToken getStateToken() {
+ return stateToken;
+ }
- public void setLanguage(final I18nLanguageDTO language) {
- this.language = language;
- }
+ public TimeZoneDTO getTimezone() {
+ return timezone;
+ }
- public void setName(final String name) {
- this.name = name;
- }
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((id == null) ? 0 : id.hashCode());
+ result = prime * result + ((shortName == null) ? 0 : shortName.hashCode());
+ return result;
+ }
- public void setShortName(final String shortName) {
- this.shortName = shortName;
- }
+ public boolean hasLogo() {
+ return hasLogo;
+ }
- public void setStateToken(final StateToken stateToken) {
- this.stateToken = stateToken;
- }
+ public boolean isEmailVerified() {
+ return emailVerified;
+ }
- public void setTimezone(final TimeZoneDTO timezone) {
- this.timezone = timezone;
- }
+ public void setCountry(final I18nCountryDTO country) {
+ this.country = country;
+ }
- @Override
- public String toString() {
- return "UserSimpleDTO(" + shortName + ")";
- }
+ public void setEmailNotifFreq(final EmailNotificationFrequency emailNotifFreq) {
+ this.emailNotifFreq = emailNotifFreq;
+ }
- public EmailNotificationFrequency getEmailNotifFreq() {
- return emailNotifFreq;
- }
+ public void setEmailVerified(final boolean emailVerified) {
+ this.emailVerified = emailVerified;
+ }
- public void setEmailNotifFreq(EmailNotificationFrequency emailNotifFreq) {
- this.emailNotifFreq = emailNotifFreq;
- }
+ public void setHasLogo(final boolean hasLogo) {
+ this.hasLogo = hasLogo;
+ }
+ public void setId(final Long id) {
+ this.id = id;
+ }
+
+ public void setLanguage(final I18nLanguageDTO language) {
+ this.language = language;
+ }
+
+ public void setName(final String name) {
+ this.name = name;
+ }
+
+ public void setShortName(final String shortName) {
+ this.shortName = shortName;
+ }
+
+ public void setStateToken(final StateToken stateToken) {
+ this.stateToken = stateToken;
+ }
+
+ public void setTimezone(final TimeZoneDTO timezone) {
+ this.timezone = timezone;
+ }
+
+ @Override
+ public String toString() {
+ return "UserSimpleDTO(" + shortName + ")";
+ }
+
}
Modified: trunk/src/main/java/cc/kune/core/shared/utils/SharedFileDownloadUtils.java
===================================================================
--- trunk/src/main/java/cc/kune/core/shared/utils/SharedFileDownloadUtils.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/core/shared/utils/SharedFileDownloadUtils.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -27,10 +27,10 @@
public String getLogoAvatarHtml(final String groupName, final boolean groupHasLogo,
final boolean isPersonal, final int size, final int hvspace) {
- final String imgUrl = groupHasLogo ? getLogoImageUrl(groupName)
- : isPersonal ? FileConstants.PERSON_NO_AVATAR_IMAGE : FileConstants.GROUP_NO_AVATAR_IMAGE;
+ final String imgUrl = groupHasLogo ? getLogoImageUrl(groupName) : isPersonal ? prefix + "/"
+ + FileConstants.PERSON_NO_AVATAR_IMAGE : prefix + "/" + FileConstants.GROUP_NO_AVATAR_IMAGE;
return "<img hspace='" + hvspace + "' vspace='" + hvspace + "' align='left' style='width: " + size
- + "px; height: " + size + "px;' src='" + prefix + imgUrl + "'>";
+ + "px; height: " + size + "px;' src='" + imgUrl + "'>";
}
public String getLogoImageUrl(final String groupName) {
@@ -42,6 +42,10 @@
return prefix;
}
+ public String getUrl(final String hash) {
+ return getPrefix() + "#" + hash;
+ }
+
public String getUserAvatar(final String username) {
return prefix
+ new Url(FileConstants.AVATARDOWNLOADSERVLET, new UrlParam(FileConstants.USERNAME, username)).toString();
Modified: trunk/src/main/java/cc/kune/docs/client/DocsParts.java
===================================================================
--- trunk/src/main/java/cc/kune/docs/client/DocsParts.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/docs/client/DocsParts.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -19,7 +19,7 @@
*/
package cc.kune.docs.client;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.docs.client.actions.DocsClientActions;
import cc.kune.docs.shared.DocsConstants;
import cc.kune.gspace.client.tool.ContentViewerSelector;
@@ -32,7 +32,7 @@
public class DocsParts {
@Inject
- public DocsParts(final Session session, final Provider<DocsClientTool> clientTool,
+ public DocsParts(final SessionConstants session, final Provider<DocsClientTool> clientTool,
final ContentViewerSelector viewerSelector, final DocsClientActions docsActions,
final ContentViewerPresenter contentViewer, final FolderViewerPresenter folderViewer) {
clientTool.get();
Modified: trunk/src/main/java/cc/kune/domain/User.java
===================================================================
--- trunk/src/main/java/cc/kune/domain/User.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/domain/User.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -83,12 +83,18 @@
@Length(min = 1)
private String email;
- @Enumerated(EnumType.STRING)
- private EmailNotificationFrequency emailNotifFreq;
+ private Long emailCheckDate;
// @OneToOne(cascade = CascadeType.REMOVE)
// private final CustomProperties customProperties;
+ private String emailConfirmHash;
+
+ @Enumerated(EnumType.STRING)
+ private EmailNotificationFrequency emailNotifFreq;
+
+ private Boolean emailVerified;
+
@Id
@DocumentId
@GeneratedValue
@@ -154,12 +160,22 @@
this.lastLogin = null;
emailNotifFreq = DEF_EMAIL_FREQ;
// this.properties = properties;
+ emailVerified = false;
}
// @OneToOne
// @OnDelete(action = OnDeleteAction.CASCADE)
// private Properties properties;
+ //
+ // public User(final String shortName, final String longName, final String
+ // email, final String passwd,
+ // final I18nLanguage language, final I18nCountry country, final TimeZone
+ // timezone) {
+ // this(shortName, longName, email, passwd, language, country, timezone,
+ // null);
+ // }
+
@Override
public boolean equals(final Object obj) {
if (this == obj) {
@@ -182,15 +198,6 @@
return true;
}
- //
- // public User(final String shortName, final String longName, final String
- // email, final String passwd,
- // final I18nLanguage language, final I18nCountry country, final TimeZone
- // timezone) {
- // this(shortName, longName, email, passwd, language, country, timezone,
- // null);
- // }
-
public I18nCountry getCountry() {
return country;
}
@@ -203,18 +210,30 @@
return diggest;
}
+ // public CustomProperties getCustomProperties() {
+ // return customProperties;
+ // }
+
public String getEmail() {
return email;
}
- // public CustomProperties getCustomProperties() {
- // return customProperties;
- // }
+ public Long getEmailCheckDate() {
+ return emailCheckDate;
+ }
+ public String getEmailConfirmHash() {
+ return emailConfirmHash;
+ }
+
public EmailNotificationFrequency getEmailNotifFreq() {
return emailNotifFreq == null ? DEF_EMAIL_FREQ : emailNotifFreq;
}
+ public boolean getEmailVerified() {
+ return isEmailVerified();
+ }
+
public boolean getHasLogo() {
return hasLogo();
}
@@ -224,6 +243,10 @@
return id;
}
+ // public Properties getProperties() {
+ // return properties;
+ // }
+
public I18nLanguage getLanguage() {
return language;
}
@@ -240,10 +263,6 @@
return password;
}
- // public Properties getProperties() {
- // return properties;
- // }
-
public byte[] getSalt() {
return salt;
}
@@ -282,6 +301,10 @@
return getUserGroup().hasLogo();
}
+ public boolean isEmailVerified() {
+ return emailVerified == null ? false : emailVerified;
+ }
+
public void setCountry(final I18nCountry country) {
this.country = country;
}
@@ -294,10 +317,22 @@
this.email = email;
}
+ public void setEmailCheckDate(final Long emailCheckDate) {
+ this.emailCheckDate = emailCheckDate;
+ }
+
+ public void setEmailConfirmHash(final String emailConfirmHash) {
+ this.emailConfirmHash = emailConfirmHash;
+ }
+
public void setEmailNotifFreq(final EmailNotificationFrequency emailNotifFreq) {
this.emailNotifFreq = emailNotifFreq;
}
+ public void setEmailVerified(final boolean emailVerified) {
+ this.emailVerified = emailVerified;
+ }
+
@Override
public void setId(final Long id) {
this.id = id;
Modified: trunk/src/main/java/cc/kune/events/client/EventsParts.java
===================================================================
--- trunk/src/main/java/cc/kune/events/client/EventsParts.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/events/client/EventsParts.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -19,7 +19,7 @@
*/
package cc.kune.events.client;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.events.client.actions.EventsClientActions;
import cc.kune.events.client.viewer.CalendarViewer;
import cc.kune.events.shared.EventsConstants;
@@ -32,7 +32,7 @@
public class EventsParts {
@Inject
- public EventsParts(final Session session, final Provider<EventsClientTool> clientTool,
+ public EventsParts(final SessionConstants session, final Provider<EventsClientTool> clientTool,
final ContentViewerSelector viewerSelector, final EventsClientActions meetsActions,
final ContentViewerPresenter contentViewer, final CalendarViewer calendarViewer) {
clientTool.get();
Modified: trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/GSpaceParts.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -23,7 +23,7 @@
import cc.kune.core.client.events.AppStartEvent.AppStartHandler;
import cc.kune.core.client.sitebar.search.SitebarSearchPresenter;
import cc.kune.core.client.sn.actions.WriteToBuddyHeaderButton;
-import cc.kune.core.client.state.HistoryTokenCallback;
+import cc.kune.core.client.state.HistoryTokenMustBeAuthCallback;
import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.SiteTokenListeners;
import cc.kune.core.client.state.SiteTokens;
@@ -125,7 +125,7 @@
writeToBuddie.get();
}
});
- tokenListener.put(SiteTokens.TRANSLATE, new HistoryTokenCallback() {
+ tokenListener.put(SiteTokens.TRANSLATE, new HistoryTokenMustBeAuthCallback() {
@Override
public void onHistoryToken(final String token) {
if (session.isLogged() && session.getInitData().isTranslatorEnabled()) {
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/AbstractFoldableToolActions.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/AbstractFoldableToolActions.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/AbstractFoldableToolActions.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -28,25 +28,25 @@
public abstract class AbstractFoldableToolActions {
- protected final ActionRegistryByType actionsRegistry;
- protected final I18nUITranslationService i18n;
- protected final Session session;
- protected final StateManager stateManager;
+ protected final ActionRegistryByType actionsRegistry;
+ protected final I18nUITranslationService i18n;
+ protected final Session session;
+ protected final StateManager stateManager;
- public AbstractFoldableToolActions(final Session session, final StateManager stateManager,
- final I18nUITranslationService i18n, final ActionRegistryByType actionsRegistry) {
- this.session = session;
- this.stateManager = stateManager;
- this.i18n = i18n;
- this.actionsRegistry = actionsRegistry;
- session.onAppStart(true, new AppStartHandler() {
- @Override
- public void onAppStart(final AppStartEvent event) {
- createPostSessionInitActions();
- }
- });
- }
+ public AbstractFoldableToolActions(final Session session, final StateManager stateManager,
+ final I18nUITranslationService i18n, final ActionRegistryByType actionsRegistry) {
+ this.session = session;
+ this.stateManager = stateManager;
+ this.i18n = i18n;
+ this.actionsRegistry = actionsRegistry;
+ session.onAppStart(true, new AppStartHandler() {
+ @Override
+ public void onAppStart(final AppStartEvent event) {
+ createPostSessionInitActions();
+ }
+ });
+ }
- protected abstract void createPostSessionInitActions();
+ protected abstract void createPostSessionInitActions();
}
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/DelContainerMenuItem.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/DelContainerMenuItem.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/DelContainerMenuItem.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -28,8 +28,8 @@
import cc.kune.core.client.actions.RolAction;
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.client.rpcservices.ContentServiceAsync;
-import cc.kune.core.client.state.Session;
import cc.kune.core.client.state.StateManager;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.core.shared.dto.AbstractContentSimpleDTO;
import cc.kune.core.shared.dto.AccessRolDTO;
@@ -47,12 +47,12 @@
private final EventBus eventBus;
private final I18nTranslationService i18n;
private final Provider<FolderViewerPresenter> presenter;
- private final Session session;
+ private final SessionConstants session;
private final StateManager stateManager;
@Inject
public DelContainerAction(final EventBus eventBus, final StateManager stateManager,
- final Session session, final Provider<ContentServiceAsync> contentService,
+ final SessionConstants session, final Provider<ContentServiceAsync> contentService,
final I18nTranslationService i18n, final Provider<FolderViewerPresenter> presenter) {
super(AccessRolDTO.Administrator, true);
this.eventBus = eventBus;
Modified: trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackAction.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackAction.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/actions/GiveUsFeedbackAction.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -82,7 +82,7 @@
} else {
signIn.get().setErrorMessage(i18n.t("Sign in or create an account to give us feedback"),
NotifyLevel.info);
- stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGNIN,
+ stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGN_IN,
session.getCurrentStateToken().toString()));
}
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/GroupOptions.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/GroupOptions.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/options/GroupOptions.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -21,5 +21,14 @@
public interface GroupOptions extends EntityOptions {
+ /**
+ * Show the group options dialog but also goes to this token (the group name
+ * usually).
+ *
+ * @param token
+ * the token
+ */
+ void show(String token);
+
void showTooltip();
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPresenter.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/options/GroupOptionsPresenter.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -26,11 +26,12 @@
import cc.kune.common.client.actions.ui.descrip.GuiActionDescrip;
import cc.kune.common.shared.i18n.I18nTranslationService;
import cc.kune.core.client.events.StateChangedEvent;
+import cc.kune.core.client.events.StateChangedEvent.StateChangedHandler;
import cc.kune.core.client.events.UserSignOutEvent;
-import cc.kune.core.client.events.StateChangedEvent.StateChangedHandler;
import cc.kune.core.client.events.UserSignOutEvent.UserSignOutHandler;
import cc.kune.core.client.resources.CoreResources;
import cc.kune.core.client.state.Session;
+import cc.kune.core.client.state.SiteTokenListeners;
import cc.kune.core.client.state.StateManager;
import cc.kune.core.client.ui.dialogs.tabbed.AbstractTabbedDialogPresenter;
import cc.kune.core.shared.dto.StateAbstractDTO;
@@ -63,7 +64,7 @@
@Inject
public GroupOptionsPresenter(final EventBus eventBus, final GroupOptionsProxy proxy,
final StateManager stateManager, final Session session, final I18nTranslationService i18n,
- final CoreResources img, final GroupOptionsView view) {
+ final CoreResources img, final GroupOptionsView view, final SiteTokenListeners tokenListener) {
super(eventBus, view, proxy);
this.stateManager = stateManager;
this.session = session;
@@ -118,9 +119,16 @@
getView().hide();
}
});
+
}
@Override
+ public void show(final String token) {
+ stateManager.gotoHistoryToken(token);
+ super.show();
+ }
+
+ @Override
public void showTooltip() {
prefsItem.toggleTooltipVisible();
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/options/UserOptionsPresenter.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -25,8 +25,8 @@
import cc.kune.common.client.actions.ui.descrip.MenuItemDescriptor;
import cc.kune.common.shared.i18n.I18nTranslationService;
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.resources.CoreResources;
import cc.kune.core.client.sitebar.SiteUserOptions;
@@ -86,9 +86,6 @@
@Override
public void actionPerformed(final ActionEvent event) {
- if (!session.isInCurrentUserSpace()) {
- stateManager.gotoStateToken(session.getCurrentUser().getStateToken());
- }
show();
}
};
@@ -104,4 +101,12 @@
prefsItem.setPosition(1);
userOptions.addAction(prefsItem);
}
+
+ @Override
+ public void show() {
+ if (!session.isInCurrentUserSpace()) {
+ stateManager.gotoStateToken(session.getCurrentUser().getStateToken());
+ }
+ super.show();
+ }
}
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-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneral.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -21,4 +21,6 @@
public interface UserOptGeneral extends EntityOptGeneral {
+ void update();
+
}
Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPanel.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -28,14 +28,20 @@
import cc.kune.core.shared.dto.I18nLanguageSimpleDTO;
import cc.kune.gspace.client.i18n.LanguageSelectorPanel;
+import com.extjs.gxt.ui.client.widget.form.AdapterField;
import com.extjs.gxt.ui.client.widget.form.FieldSet;
import com.extjs.gxt.ui.client.widget.form.FormPanel.LabelAlign;
import com.extjs.gxt.ui.client.widget.form.Radio;
import com.extjs.gxt.ui.client.widget.form.TextField;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+import com.google.gwt.user.client.ui.Button;
+import com.google.gwt.user.client.ui.Label;
import com.google.inject.Inject;
public class UserOptGeneralPanel extends EntityOptGeneralPanel implements UserOptGeneralView {
+ private static final String BIG_FIELD_SIZE = "310px";
+
public static final String DAILY_TYPE_ID = "k-ngp-type_daily";
public static final String HOURLY_TYPE_ID = "k-ngp-type_hourly";
public static final String IMMEDIATE_TYPE_ID = "k-ngp-type_immedi";
@@ -43,12 +49,17 @@
public static final String NO_TYPE_ID = "k-ngp-type_no";
public static final String TYPEOFEMAILNOTIF_FIELD = "k-ngp-type_of_email_notif";
private final Radio dailyRadio;
+ private final FieldSet emailNotifTypeFieldSet;
private final Radio hourlyRadio;
private final Radio immediateRadio;
private final LanguageSelectorPanel langSelector;
private final TextField<String> longName;
private final Radio noRadio;
+ private final AdapterField notVerifLabelAdapter;
+ private final AdapterField resendEmailVerifAdapter;
+ private final Button resendEmailVerifBtn;
+
@Inject
public UserOptGeneralPanel(final I18nUITranslationService i18n, final CoreResources res,
final MaskWidget maskWidget, final LanguageSelectorPanel langSelector,
@@ -62,11 +73,11 @@
langSelector.setLangSeparator(":");
add(langSelector);
- final FieldSet emailNotifTypeFieldSet = new FieldSet();
+ emailNotifTypeFieldSet = new FieldSet();
emailNotifTypeFieldSet.setHeading(i18n.t("How often do you want to receive email notifications?"));
emailNotifTypeFieldSet.addStyleName("k-form-fieldset");
emailNotifTypeFieldSet.setCollapsible(false);
- emailNotifTypeFieldSet.setWidth("310px");
+ emailNotifTypeFieldSet.setWidth(BIG_FIELD_SIZE);
emailNotifTypeFieldSet.setAutoHeight(true);
immediateRadio = DefaultFormUtils.createRadio(emailNotifTypeFieldSet, i18n.t("almost immediately"),
@@ -98,8 +109,25 @@
i18n.getSiteCommonName()), NO_TYPE_ID);
noRadio.setTabIndex(6);
noRadio.setValue(false);
+ add(emailNotifTypeFieldSet);
- add(emailNotifTypeFieldSet);
+ final Label notVerified = new Label(
+ i18n.t("Your email is not verified, so you will not receive email notifications"));
+ notVerified.setStyleName("oc-user-msg");
+ notVerified.addStyleName("k-3corners");
+ notVerifLabelAdapter = new AdapterField(notVerified);
+ notVerifLabelAdapter.setLabelSeparator("");
+ notVerifLabelAdapter.setWidth(BIG_FIELD_SIZE);
+ super.add(notVerifLabelAdapter);
+
+ resendEmailVerifBtn = new Button(i18n.t("Resend verification email"));
+ resendEmailVerifBtn.addStyleName("k-button");
+ resendEmailVerifAdapter = new AdapterField(resendEmailVerifBtn);
+ resendEmailVerifAdapter.setValidateOnBlur(false);
+ resendEmailVerifAdapter.setLabelSeparator("");
+ resendEmailVerifAdapter.setWidth(BIG_FIELD_SIZE);
+ // resendEmailVerifAdapter.setFieldLabel(i18n.t("Maybe you want receive again our verification email"));
+ add(resendEmailVerifAdapter);
}
@Override
@@ -128,6 +156,11 @@
}
@Override
+ public HasClickHandlers getResendEmailVerif() {
+ return resendEmailVerifBtn;
+ }
+
+ @Override
public void setEmailNotifChecked(final EmailNotificationFrequency freq) {
switch (freq) {
case no:
@@ -146,6 +179,13 @@
}
@Override
+ public void setEmailVerified(final boolean verified) {
+ resendEmailVerifAdapter.setVisible(!verified);
+ notVerifLabelAdapter.setVisible(!verified);
+ emailNotifTypeFieldSet.setVisible(verified);
+ }
+
+ @Override
public void setLanguage(final I18nLanguageSimpleDTO language) {
langSelector.setLanguage(language);
}
@@ -155,4 +195,9 @@
this.longName.setValue(longName);
}
+ @Override
+ public void setResendEmailVerifEnabled(final boolean enabled) {
+ resendEmailVerifBtn.setEnabled(enabled);
+ }
+
}
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-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralPresenter.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -34,7 +34,10 @@
import cc.kune.core.shared.dto.UserSimpleDTO;
import cc.kune.gspace.client.options.UserOptions;
+import com.google.gwt.event.dom.client.ClickEvent;
+import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.inject.Inject;
import com.google.inject.Provider;
@@ -67,6 +70,22 @@
@Override
public void init(final EntityOptGeneralView view) {
super.init(view);
+ userView.getResendEmailVerif().addClickHandler(new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ userView.setResendEmailVerifEnabled(false);
+ userService.get().askForEmailConfirmation(session.getUserHash(), new AsyncCallback<Void>() {
+ @Override
+ public void onFailure(final Throwable caught) {
+ }
+
+ @Override
+ public void onSuccess(final Void result) {
+ NotifyUser.info("Sended. Check your email for the verification link.");
+ }
+ });
+ }
+ });
}
@Override
@@ -75,9 +94,16 @@
userView.setLongName(currentUser.getName());
userView.setLanguage(I18nLanguageSimpleDTO.create(currentUser.getLanguage()));
userView.setEmailNotifChecked(currentUser.getEmailNotifFreq());
+ userView.setEmailVerified(currentUser.isEmailVerified());
+ userView.setResendEmailVerifEnabled(!currentUser.isEmailVerified());
}
@Override
+ public void update() {
+ setState();
+ }
+
+ @Override
protected void updateInServer() {
if (view.isValid()) {
NotifyUser.showProgress();
Modified: trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralView.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralView.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/options/general/UserOptGeneralView.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -22,6 +22,8 @@
import cc.kune.core.shared.domain.dto.EmailNotificationFrequency;
import cc.kune.core.shared.dto.I18nLanguageSimpleDTO;
+import com.google.gwt.event.dom.client.HasClickHandlers;
+
public interface UserOptGeneralView extends EntityOptGeneralView {
EmailNotificationFrequency getEmailNotif();
@@ -30,10 +32,16 @@
String getLongName();
+ HasClickHandlers getResendEmailVerif();
+
+ void setEmailVerified(boolean verified);
+
void setEmailNotifChecked(EmailNotificationFrequency freq);
void setLanguage(I18nLanguageSimpleDTO language);
void setLongName(String longName);
+ void setResendEmailVerifEnabled(boolean enabled);
+
}
Modified: trunk/src/main/java/cc/kune/gspace/client/tags/TagsSummaryPresenter.java
===================================================================
--- trunk/src/main/java/cc/kune/gspace/client/tags/TagsSummaryPresenter.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/gspace/client/tags/TagsSummaryPresenter.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -41,85 +41,87 @@
import com.gwtplatform.mvp.client.proxy.RevealRootContentEvent;
public class TagsSummaryPresenter extends
- Presenter<TagsSummaryPresenter.TagsSummaryView, TagsSummaryPresenter.TagsSummaryProxy> implements TagsSummary {
+ Presenter<TagsSummaryPresenter.TagsSummaryView, TagsSummaryPresenter.TagsSummaryProxy> implements
+ TagsSummary {
- public interface TagsSummaryView extends View {
- void addTag(String name, Long count, String style, ClickHandler clickHandler);
+ @ProxyCodeSplit
+ public interface TagsSummaryProxy extends Proxy<TagsSummaryPresenter> {
+ }
- void clear();
+ public interface TagsSummaryView extends View {
+ void addTag(String name, Long count, String style, ClickHandler clickHandler);
- void setVisible(boolean visible);
- }
+ void clear();
- @ProxyCodeSplit
- public interface TagsSummaryProxy extends Proxy<TagsSummaryPresenter> {
- }
+ void setVisible(boolean visible);
+ }
- private static final int MINSIZE = 11;
- private static final int MAXSIZE = 26;
+ private static final int MAXSIZE = 26;
+ private static final int MINSIZE = 11;
- @Override
- protected void revealInParent() {
- RevealRootContentEvent.fire(this, this);
- }
+ @Inject
+ public TagsSummaryPresenter(final EventBus eventBus, final TagsSummaryView view,
+ final TagsSummaryProxy proxy, final Session session, final StateManager stateManager) {
+ super(eventBus, view, proxy);
+ stateManager.onStateChanged(true, new StateChangedHandler() {
+ @Override
+ public void onStateChanged(final StateChangedEvent event) {
+ final StateAbstractDTO state = event.getState();
+ if (state instanceof StateContainerDTO) {
+ setState((StateContainerDTO) state);
+ } else {
+ getView().setVisible(false);
+ }
+ }
+ });
+ }
- @Inject
- public TagsSummaryPresenter(EventBus eventBus, TagsSummaryView view, TagsSummaryProxy proxy, final Session session,
- final StateManager stateManager) {
- super(eventBus, view, proxy);
- stateManager.onStateChanged(true, new StateChangedHandler() {
- @Override
- public void onStateChanged(StateChangedEvent event) {
- StateAbstractDTO state = event.getState();
- if (state instanceof StateContainerDTO) {
- setState((StateContainerDTO) state);
- } else {
- getView().setVisible(false);
- }
- }
- });
- }
+ public void doSearchTag(final String name) {
+ // searcherProvider.get().doSearchOfType(
+ // "group:" + session.getCurrentState().getGroup().getShortName() +
+ // " tag:" + name,
+ // SiteSearcherType.content);
+ NotifyUser.info("Searcher in development");
+ }
- public void doSearchTag(final String name) {
- // searcherProvider.get().doSearchOfType(
- // "group:" + session.getCurrentState().getGroup().getShortName() +
- // " tag:" + name,
- // SiteSearcherType.content);
- NotifyUser.info("Searcher in development");
- }
+ @Override
+ protected void revealInParent() {
+ RevealRootContentEvent.fire(this, this);
+ }
- public void setGroupTags(final TagCloudResult tagCloud) {
- setCloud(tagCloud);
- getView().setVisible(true);
- }
-
- // @PMD:REVIEWED:DefaultPackage: by vjrj on 27/05/09 3:13
- void setState(final StateContainerDTO state) {
- if (state.getTagCloudResult() != null && state.getTagCloudResult().getTagCountList().size() > 0) {
- Log.debug(state.getTagCloudResult().toString());
- setCloud(state.getTagCloudResult());
- getView().setVisible(true);
- } else {
- getView().setVisible(false);
+ private void setCloud(final TagCloudResult tagCloudResult) {
+ // Inspired in snippet http://www.bytemycode.com/snippets/snippet/415/
+ getView().clear();
+ final int max = tagCloudResult.getMaxValue();
+ final int min = tagCloudResult.getMinValue();
+ final int diff = max - min;
+ final int step = (MAXSIZE - MINSIZE) / (diff == 0 ? 1 : diff);
+ for (final TagCount tagCount : tagCloudResult.getTagCountList()) {
+ final String name = tagCount.getName();
+ final int size = Math.round((MINSIZE + (tagCount.getCount().floatValue() - min) * step));
+ getView().addTag(name, tagCount.getCount(), "kune-ft" + size + "px", new ClickHandler() {
+ @Override
+ public void onClick(final ClickEvent event) {
+ doSearchTag(name);
}
+ });
}
+ }
- private void setCloud(final TagCloudResult tagCloudResult) {
- // Inspired in snippet http://www.bytemycode.com/snippets/snippet/415/
- getView().clear();
- final int max = tagCloudResult.getMaxValue();
- final int min = tagCloudResult.getMinValue();
- final int diff = max - min;
- final int step = (MAXSIZE - MINSIZE) / (diff == 0 ? 1 : diff);
- for (final TagCount tagCount : tagCloudResult.getTagCountList()) {
- final String name = tagCount.getName();
- final int size = Math.round((MINSIZE + (tagCount.getCount().floatValue() - min) * step));
- getView().addTag(name, tagCount.getCount(), "kune-ft" + size + "px", new ClickHandler() {
- @Override
- public void onClick(ClickEvent event) {
- doSearchTag(name);
- }
- });
- }
+ @Override
+ public void setGroupTags(final TagCloudResult tagCloud) {
+ setCloud(tagCloud);
+ getView().setVisible(true);
+ }
+
+ // @PMD:REVIEWED:DefaultPackage: by vjrj on 27/05/09 3:13
+ void setState(final StateContainerDTO state) {
+ if (state.getTagCloudResult() != null && state.getTagCloudResult().getTagCountList().size() > 0) {
+ Log.debug(state.getTagCloudResult().toString());
+ setCloud(state.getTagCloudResult());
+ getView().setVisible(true);
+ } else {
+ getView().setVisible(false);
}
+ }
}
Modified: trunk/src/main/java/cc/kune/hspace/client/HSpacePanel.java
===================================================================
--- trunk/src/main/java/cc/kune/hspace/client/HSpacePanel.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/hspace/client/HSpacePanel.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -117,7 +117,7 @@
tabPanel.addTab(lastGroupsPanel);
tabPanel.addTab(lastPublishedPanel);
globalStats.removeFromParent();
- unreadInYourInbox.setTargetHistoryToken(SiteTokens.WAVEINBOX);
+ unreadInYourInbox.setTargetHistoryToken(SiteTokens.WAVE_INBOX);
globalStatsParent = RootPanel.get(K_HOME_GLOBAL_STATS);
groupStatsParent = RootPanel.get(K_HOME_GROUP_STATS);
if (globalStatsParent != null) {
Modified: trunk/src/main/java/cc/kune/lists/client/ListsParts.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/ListsParts.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/lists/client/ListsParts.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -19,7 +19,7 @@
*/
package cc.kune.lists.client;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.gspace.client.tool.ContentViewerSelector;
import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import cc.kune.gspace.client.viewers.FolderViewerPresenter;
@@ -32,7 +32,7 @@
public class ListsParts {
@Inject
- public ListsParts(final Session session, final Provider<ListsClientTool> clientTool,
+ public ListsParts(final SessionConstants session, final Provider<ListsClientTool> clientTool,
final ContentViewerSelector viewerSelector, final ListsClientActions listsActions,
final ContentViewerPresenter contentViewer, final FolderViewerPresenter folderViewer) {
clientTool.get();
Modified: trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/lists/client/actions/NewListPostAction.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -114,7 +114,7 @@
} else {
signIn.get().setErrorMessage(i18n.t("Sign in or create an account to susbscribe to this list"),
NotifyLevel.info);
- stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGNIN,
+ stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGN_IN,
session.getCurrentStateToken().toString()));
}
}
Modified: trunk/src/main/java/cc/kune/lists/client/actions/SubscriteToListAction.java
===================================================================
--- trunk/src/main/java/cc/kune/lists/client/actions/SubscriteToListAction.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/lists/client/actions/SubscriteToListAction.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -81,7 +81,7 @@
} else {
signIn.get().setErrorMessage(i18n.t("Sign in or create an account to susbscribe to this list"),
NotifyLevel.info);
- stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGNIN,
+ stateManager.gotoHistoryToken(TokenUtils.addRedirect(SiteTokens.SIGN_IN,
session.getCurrentStateToken().toString()));
}
}
Modified: trunk/src/main/java/cc/kune/tasks/client/TasksParts.java
===================================================================
--- trunk/src/main/java/cc/kune/tasks/client/TasksParts.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/tasks/client/TasksParts.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -19,7 +19,7 @@
*/
package cc.kune.tasks.client;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.gspace.client.tool.ContentViewerSelector;
import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import cc.kune.gspace.client.viewers.FolderViewerPresenter;
@@ -32,7 +32,7 @@
public class TasksParts {
@Inject
- public TasksParts(final Session session, final Provider<TasksClientTool> clientTool,
+ public TasksParts(final SessionConstants session, final Provider<TasksClientTool> clientTool,
final ContentViewerSelector viewerSelector, final TasksClientActions tasksActions,
final ContentViewerPresenter contentViewer, final FolderViewerPresenter folderViewer) {
clientTool.get();
Modified: trunk/src/main/java/cc/kune/wave/client/WebClient.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/client/WebClient.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/wave/client/WebClient.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -443,7 +443,7 @@
});
final String encodedToken = History.getToken();
// Kune patch
- if (encodedToken != null && !encodedToken.isEmpty() && !encodedToken.equals(SiteTokens.WAVEINBOX)) {
+ if (encodedToken != null && !encodedToken.isEmpty() && !encodedToken.equals(SiteTokens.WAVE_INBOX)) {
WaveRef fromWaveRef;
try {
fromWaveRef = GwtWaverefEncoder.decodeWaveRefFromPath(encodedToken);
Modified: trunk/src/main/java/cc/kune/wave/server/kspecific/WaveEmailNotifier.java
===================================================================
--- trunk/src/main/java/cc/kune/wave/server/kspecific/WaveEmailNotifier.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/wave/server/kspecific/WaveEmailNotifier.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -111,7 +111,7 @@
private FormatedString removeWaveTemplate(final String by, final String title) {
return FormatedString.build(
"Hi there,<br><br>You have been removed by '%s' from message '%s' at %s. <a href=\"%s#%s\">Read more</a>.<br>",
- by, title, siteCommonName, siteUrl, SiteTokens.WAVEINBOX);
+ by, title, siteCommonName, siteUrl, SiteTokens.WAVE_INBOX);
}
private FormatedString updatedWaveTemplate(final String by, final String title, final String url) {
Modified: trunk/src/main/java/cc/kune/wiki/client/WikiParts.java
===================================================================
--- trunk/src/main/java/cc/kune/wiki/client/WikiParts.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/java/cc/kune/wiki/client/WikiParts.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -19,7 +19,7 @@
*/
package cc.kune.wiki.client;
-import cc.kune.core.client.state.Session;
+import cc.kune.core.shared.SessionConstants;
import cc.kune.gspace.client.tool.ContentViewerSelector;
import cc.kune.gspace.client.viewers.ContentViewerPresenter;
import cc.kune.gspace.client.viewers.FolderViewerPresenter;
@@ -32,7 +32,7 @@
public class WikiParts {
@Inject
- public WikiParts(final Session session, final Provider<WikiClientTool> clientTool,
+ public WikiParts(final SessionConstants session, final Provider<WikiClientTool> clientTool,
final ContentViewerSelector viewerSelector, final WikiClientActions wikiActions,
final ContentViewerPresenter contentViewer, final FolderViewerPresenter folderViewer) {
clientTool.get();
Modified: trunk/src/main/resources/kune.properties
===================================================================
--- trunk/src/main/resources/kune.properties 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/main/resources/kune.properties 2012-01-16 20:53:44 UTC (rev 1663)
@@ -78,7 +78,7 @@
### Other params
# Reserved words to avoid it's use in the client side for user and group names (see client tokens used in SiteTokens)
-kune.server.names.reservedwords = root,adm,kune,fuck,about,home,newgroup,preview,register,signin,translate,inbox,sub,www,ftp,pop,pop3,smtp,mail,wave
+kune.server.names.reservedwords = root,adm,kune,fuck,about,home,newgroup,preview,register,signin,translate,inbox,sub,www,ftp,pop,pop3,smtp,mail,wave,resetpasswd,verifyemail,prefs,gprefs
# If defined create a copy of this wave as welcome to new users
# kune.site.welcomewave = w+rtackLTkDCA
Modified: trunk/src/test/java/cc/kune/core/client/state/impl/StateManagerDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/client/state/impl/StateManagerDefaultTest.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/test/java/cc/kune/core/client/state/impl/StateManagerDefaultTest.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -29,16 +29,16 @@
import cc.kune.common.client.actions.BeforeActionListener;
import cc.kune.core.client.events.AppStartEvent;
-import cc.kune.core.client.events.GroupChangedEvent;
-import cc.kune.core.client.events.StateChangedEvent;
-import cc.kune.core.client.events.ToolChangedEvent;
-import cc.kune.core.client.events.UserSignInEvent;
-import cc.kune.core.client.events.UserSignOutEvent;
import cc.kune.core.client.events.AppStartEvent.AppStartHandler;
+import cc.kune.core.client.events.GroupChangedEvent;
import cc.kune.core.client.events.GroupChangedEvent.GroupChangedHandler;
+import cc.kune.core.client.events.StateChangedEvent;
import cc.kune.core.client.events.StateChangedEvent.StateChangedHandler;
+import cc.kune.core.client.events.ToolChangedEvent;
import cc.kune.core.client.events.ToolChangedEvent.ToolChangedHandler;
+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.UserSignOutEvent.UserSignOutHandler;
import cc.kune.core.client.state.ContentCache;
import cc.kune.core.client.state.HistoryTokenCallback;
@@ -47,7 +47,6 @@
import cc.kune.core.client.state.SiteTokenListeners;
import cc.kune.core.client.state.SiteTokens;
import cc.kune.core.client.state.TokenMatcher;
-import cc.kune.core.client.state.impl.StateManagerDefault;
import cc.kune.core.shared.domain.utils.StateToken;
import cc.kune.core.shared.dto.InitDataDTO;
import cc.kune.core.shared.dto.StateAbstractDTO;
@@ -237,7 +236,6 @@
return newToken;
}
- @SuppressWarnings("unchecked")
@Test
public void getDefGroup() {
stateManager.processHistoryToken("site.docs");
@@ -248,7 +246,6 @@
stateManager.processHistoryToken("example.com/w+abcd/~/conv+root/b+45kg");
}
- @SuppressWarnings("unchecked")
@Test
public void normalStartLoggedUser() {
// When a user enter reload state, also if the application is starting
@@ -258,7 +255,6 @@
verifyGetServerContent();
}
- @SuppressWarnings("unchecked")
@Test
public void oneBeforeStateChangeListenerAddAndRemove() {
final String newToken = confBeforeStateChangeListeners(false, false);
@@ -294,7 +290,6 @@
(StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
}
- @SuppressWarnings("unchecked")
@Test
public void oneBeforeStateChangeListenerReturnTrue() {
stateManager.processHistoryToken(confBeforeStateChangeListeners(true, true));
@@ -306,13 +301,12 @@
stateManager.removeBeforeStateChangeListener(beforeChangeListener2);
}
- @SuppressWarnings("unchecked")
@Test
public void siteTokenFirstLoadDefContentAndFireListener() {
final HistoryTokenCallback listener = Mockito.mock(HistoryTokenCallback.class);
- final String token = SiteTokens.SIGNIN;
+ final String token = SiteTokens.SIGN_IN;
stateManager.addSiteToken(token, listener);
- Mockito.when(siteTokens.get(SiteTokens.SIGNIN)).thenReturn(listener);
+ Mockito.when(siteTokens.get(SiteTokens.SIGN_IN)).thenReturn(listener);
stateManager.processHistoryToken(token);
Mockito.verify(listener, Mockito.times(1)).onHistoryToken(Mockito.anyString());
verifyGetServerContent();
@@ -321,8 +315,8 @@
@Test
public void siteTokenTest() {
final HistoryTokenCallback listener = Mockito.mock(HistoryTokenCallback.class);
- stateManager.addSiteToken(SiteTokens.SIGNIN, listener);
- Mockito.when(siteTokens.get(SiteTokens.SIGNIN)).thenReturn(listener);
+ stateManager.addSiteToken(SiteTokens.SIGN_IN, listener);
+ Mockito.when(siteTokens.get(SiteTokens.SIGN_IN)).thenReturn(listener);
stateManager.processHistoryToken("signIn");
Mockito.verify(listener, Mockito.times(1)).onHistoryToken(Mockito.anyString());
}
@@ -335,6 +329,7 @@
verifyGetServerContent();
}
+ @SuppressWarnings("unchecked")
private void verifyGetServerContent() {
Mockito.verify(contentProvider, Mockito.times(1)).getContent(Mockito.anyString(),
(StateToken) Mockito.anyObject(), (AsyncCallback<StateAbstractDTO>) Mockito.anyObject());
Modified: trunk/src/test/java/cc/kune/core/server/mail/MailServiceDefaultTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/server/mail/MailServiceDefaultTest.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/test/java/cc/kune/core/server/mail/MailServiceDefaultTest.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -39,4 +39,12 @@
service.sendPlain(FormatedString.build("Some test subject"), FormatedString.build("Some body"),
"vjrj at localhost");
}
+
+ @Test
+ public void utf8Test() {
+ service.sendPlain(FormatedString.build("áéíóú"), FormatedString.build("Some body áéíóú"),
+ "vjrj at localhost");
+ service.sendHtml(FormatedString.build("áéíóú"), FormatedString.build("Some body áéíóú"),
+ "vjrj at localhost");
+ }
}
Added: trunk/src/test/java/cc/kune/core/shared/utils/SharedFileDownloadUtilsTest.java
===================================================================
--- trunk/src/test/java/cc/kune/core/shared/utils/SharedFileDownloadUtilsTest.java (rev 0)
+++ trunk/src/test/java/cc/kune/core/shared/utils/SharedFileDownloadUtilsTest.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -0,0 +1,46 @@
+package cc.kune.core.shared.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class SharedFileDownloadUtilsTest {
+
+ private static final String GROUP = "groupname";
+ private SharedFileDownloadUtils noPrefixUtils;
+ private SharedFileDownloadUtils prefixUtils;
+
+ @Before
+ public void before() {
+ prefixUtils = new SharedFileDownloadUtils("http://example.org");
+ noPrefixUtils = new SharedFileDownloadUtils("");
+ }
+
+ @Test
+ public void testGetLogoHtml() {
+ assertTrue(prefixUtils.getLogoAvatarHtml(GROUP, false, false, 50, 5).contains(
+ "'http://example.org/others/defgroup.gif"));
+ assertTrue(noPrefixUtils.getLogoAvatarHtml(GROUP, false, true, 50, 5),
+ prefixUtils.getLogoAvatarHtml(GROUP, false, true, 50, 5).contains("/others/unknown.jpg"));
+ assertTrue(
+ prefixUtils.getLogoAvatarHtml(GROUP, true, false, 50, 5),
+ prefixUtils.getLogoAvatarHtml(GROUP, true, false, 50, 5).contains(
+ "'http://example.org/ws/servlets/EntityLogoDownloadManager?token=groupname"));
+ assertTrue(
+ noPrefixUtils.getLogoAvatarHtml(GROUP, true, true, 50, 5),
+ noPrefixUtils.getLogoAvatarHtml(GROUP, true, true, 50, 5).contains(
+ "/ws/servlets/EntityLogoDownloadManager?token=groupname"));
+ assertTrue(!noPrefixUtils.getLogoAvatarHtml(GROUP, true, true, 50, 5).contains("http"));
+ }
+
+ @Test
+ public void testUserAvatar() {
+ assertEquals("http://example.org/ws/servlets/UserLogoDownloadManager?username=groupname",
+ prefixUtils.getUserAvatar(GROUP));
+ assertEquals("/ws/servlets/UserLogoDownloadManager?username=groupname",
+ noPrefixUtils.getUserAvatar(GROUP));
+ }
+
+}
Modified: trunk/src/test/java/cc/kune/gspace/client/tags/TagsSummaryPresenterTest.java
===================================================================
--- trunk/src/test/java/cc/kune/gspace/client/tags/TagsSummaryPresenterTest.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/test/java/cc/kune/gspace/client/tags/TagsSummaryPresenterTest.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -31,51 +31,50 @@
import cc.kune.core.shared.domain.TagCloudResult;
import cc.kune.core.shared.domain.TagCount;
import cc.kune.core.shared.dto.StateContainerDTO;
-import cc.kune.gspace.client.tags.TagsSummaryPresenter;
import cc.kune.gspace.client.tags.TagsSummaryPresenter.TagsSummaryProxy;
import cc.kune.gspace.client.tags.TagsSummaryPresenter.TagsSummaryView;
public class TagsSummaryPresenterTest {
- private TagsSummaryPresenter tagsSummaryPresenter;
- private TagsSummaryView view;
+ private TagsSummaryPresenter tagsSummaryPresenter;
+ private TagsSummaryView view;
- @SuppressWarnings("unchecked")
- @Before
- public void before() {
- final Session session = Mockito.mock(Session.class);
- final StateManager stateManager = Mockito.mock(StateManager.class);
- // final SiteSearcher searcher = Mockito.mock(SiteSearcher.class);
- TagsSummaryProxy proxy = Mockito.mock(TagsSummaryProxy.class);
- // Mockito.when(searcherProvider.get()).thenReturn(searcher);
- view = Mockito.mock(TagsSummaryView.class);
- EventBusTester eventBus = new EventBusTester();
- tagsSummaryPresenter = new TagsSummaryPresenter(eventBus, view, proxy, session, stateManager);
- }
+ @SuppressWarnings("unchecked")
+ @Before
+ public void before() {
+ final Session session = Mockito.mock(Session.class);
+ final StateManager stateManager = Mockito.mock(StateManager.class);
+ // final SiteSearcher searcher = Mockito.mock(SiteSearcher.class);
+ final TagsSummaryProxy proxy = Mockito.mock(TagsSummaryProxy.class);
+ // Mockito.when(searcherProvider.get()).thenReturn(searcher);
+ view = Mockito.mock(TagsSummaryView.class);
+ final EventBusTester eventBus = new EventBusTester();
+ tagsSummaryPresenter = new TagsSummaryPresenter(eventBus, view, proxy, session, stateManager);
+ }
- @Test
- public void noTagsViewNotVisible() {
- final StateContainerDTO state = new StateContainerDTO();
- tagsSummaryPresenter.setState(state);
- Mockito.verify(view).setVisible(false);
- }
+ @Test
+ public void noTagsViewNotVisible() {
+ final StateContainerDTO state = new StateContainerDTO();
+ tagsSummaryPresenter.setState(state);
+ Mockito.verify(view).setVisible(false);
+ }
- @Test
- public void withTagsViewFalse() {
- final StateContainerDTO state = new StateContainerDTO();
- final ArrayList<TagCount> list = new ArrayList<TagCount>();
- state.setTagCloudResult(new TagCloudResult(list, 0, 0));
- tagsSummaryPresenter.setState(state);
- Mockito.verify(view).setVisible(false);
- }
+ @Test
+ public void withTagsViewFalse() {
+ final StateContainerDTO state = new StateContainerDTO();
+ final ArrayList<TagCount> list = new ArrayList<TagCount>();
+ state.setTagCloudResult(new TagCloudResult(list, 0, 0));
+ tagsSummaryPresenter.setState(state);
+ Mockito.verify(view).setVisible(false);
+ }
- @Test
- public void withTagsViewVisible() {
- final StateContainerDTO state = new StateContainerDTO();
- final ArrayList<TagCount> list = new ArrayList<TagCount>();
- list.add(new TagCount("abc", 1L));
- state.setTagCloudResult(new TagCloudResult(list, 0, 0));
- tagsSummaryPresenter.setState(state);
- Mockito.verify(view).setVisible(true);
- }
+ @Test
+ public void withTagsViewVisible() {
+ final StateContainerDTO state = new StateContainerDTO();
+ final ArrayList<TagCount> list = new ArrayList<TagCount>();
+ list.add(new TagCount("abc", 1L));
+ state.setTagCloudResult(new TagCloudResult(list, 0, 0));
+ tagsSummaryPresenter.setState(state);
+ Mockito.verify(view).setVisible(true);
+ }
}
Modified: trunk/src/test/java/cc/kune/selenium/login/ScreenCastsViaSeleniumTests.java
===================================================================
--- trunk/src/test/java/cc/kune/selenium/login/ScreenCastsViaSeleniumTests.java 2012-01-16 10:30:38 UTC (rev 1662)
+++ trunk/src/test/java/cc/kune/selenium/login/ScreenCastsViaSeleniumTests.java 2012-01-16 20:53:44 UTC (rev 1663)
@@ -133,7 +133,7 @@
sleep(2000);
showTitleSlide(t("Chat with your buddies"), t("compatible with gmail and similars"),
- SiteTokens.WAVEINBOX);
+ SiteTokens.WAVE_INBOX);
// showTooltip(chat.icon());
chat.show();
sleep(2000);
More information about the kune-commits
mailing list