From 6bab9bddd6a3f4ab699c91a83af48cda45ae2143 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Thu, 23 May 2024 09:56:03 -0400 Subject: [PATCH 01/10] SWC-6844 - Redirect PasswordReset place to OneSage --- .../users/PasswordResetPresenter.java | 168 +-------------- .../presenter/PasswordResetPresenterTest.java | 199 +----------------- 2 files changed, 11 insertions(+), 356 deletions(-) diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java index 20fd6ee67f..789f07cbba 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java @@ -2,180 +2,28 @@ import com.google.gwt.activity.shared.AbstractActivity; import com.google.gwt.event.shared.EventBus; -import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AcceptsOneWidget; import com.google.inject.Inject; -import org.sagebionetworks.repo.model.ErrorResponseCode; -import org.sagebionetworks.repo.model.UserProfile; -import org.sagebionetworks.repo.model.auth.ChangePasswordWithCurrentPassword; -import org.sagebionetworks.web.client.ClientProperties; -import org.sagebionetworks.web.client.DisplayConstants; -import org.sagebionetworks.web.client.DisplayUtils; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.SynapseJavascriptClient; -import org.sagebionetworks.web.client.place.LoginPlace; import org.sagebionetworks.web.client.place.users.PasswordReset; import org.sagebionetworks.web.client.presenter.Presenter; -import org.sagebionetworks.web.client.security.AuthenticationController; -import org.sagebionetworks.web.client.view.users.PasswordResetView; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; -import org.sagebionetworks.web.shared.exceptions.NotFoundException; -@SuppressWarnings("unused") public class PasswordResetPresenter extends AbstractActivity - implements PasswordResetView.Presenter, Presenter { + implements Presenter { + private static final String ONE_SAGE_RESET_PASSWORD_URL = + "https://accounts.sagebionetworks.synapse.org/resetPassword"; private PasswordReset place; - private PasswordResetView view; - private AuthenticationController authenticationController; - private GlobalApplicationState globalApplicationState; - private SynapseAlert synAlert; - private SynapseJavascriptClient jsClient; @Inject - public PasswordResetPresenter( - PasswordResetView view, - AuthenticationController authenticationController, - GlobalApplicationState globalApplicationState, - SynapseJavascriptClient jsClient, - SynapseAlert synAlert - ) { - this.view = view; - this.authenticationController = authenticationController; - this.globalApplicationState = globalApplicationState; - this.jsClient = jsClient; - this.synAlert = synAlert; - view.setSynAlertWidget(synAlert.asWidget()); - view.setPresenter(this); - } - - @Override - public void start(AcceptsOneWidget panel, EventBus eventBus) { - // Install the view - panel.setWidget(view); - } + public PasswordResetPresenter() {} @Override - public void setPlace(PasswordReset place) { - this.place = place; - view.setPresenter(this); - view.clear(); - if ( - ErrorResponseCode.PASSWORD_RESET_VIA_EMAIL_REQUIRED - .toString() - .equals(place.toToken()) - ) { - view.showRequestForm(); - view.showPasswordResetRequired(); - } else if (!ClientProperties.DEFAULT_PLACE_TOKEN.equals(place.toToken())) { - // Assume all tokens other than the default are session tokens - // validate that session token is still valid before showing form - view.showLoading(); - authenticationController.setNewAccessToken( - place.toToken(), - new AsyncCallback() { - @Override - public void onSuccess(UserProfile result) { - view.showResetForm(); - } - - @Override - public void onFailure(Throwable caught) { - view.showExpiredRequest(); - } - } - ); - } else { - view.showRequestForm(); - } + public void start(AcceptsOneWidget acceptsOneWidget, EventBus eventBus) { + Window.Location.replace(ONE_SAGE_RESET_PASSWORD_URL); } @Override - public void requestPasswordReset(String emailAddress) { - synAlert.clear(); - jsClient.sendPasswordResetEmail( - emailAddress, - new AsyncCallback() { - @Override - public void onSuccess(Void result) { - view.showRequestSentSuccess(); - } - - @Override - public void onFailure(Throwable caught) { - if (caught instanceof NotFoundException) { - view.showErrorMessage(caught.getMessage()); - } else { - synAlert.handleException(caught); - } - view.setSubmitButtonEnabled(true); - } - } - ); - } - - @Override - public void resetPassword(String currentPassword, String newPassword) { - synAlert.clear(); - ChangePasswordWithCurrentPassword changePasswordRequest = - new ChangePasswordWithCurrentPassword(); - changePasswordRequest.setCurrentPassword(currentPassword); - changePasswordRequest.setNewPassword(newPassword); - changePasswordRequest.setUsername( - authenticationController.getCurrentUserProfile().getUserName() - ); - jsClient.changePassword( - changePasswordRequest, - new AsyncCallback() { - @Override - public void onSuccess(Void result) { - view.showInfo(DisplayConstants.PASSWORD_RESET_TEXT); - view.showPasswordResetSuccess(); - - UserProfile profile = - authenticationController.getCurrentUserProfile(); - if ( - profile != null && - profile.getUserName() != null && - !DisplayUtils.isTemporaryUsername(profile.getUserName()) - ) reloginUser(profile.getUserName(), newPassword); else { // re-login like we do on the Settings page (when changing the password) - // pop up terms of service on re-login - authenticationController.logoutUser(); - globalApplicationState - .getPlaceChanger() - .goTo(new LoginPlace(ClientProperties.DEFAULT_PLACE_TOKEN)); // redirect to login page - } - } - - @Override - public void onFailure(Throwable caught) { - synAlert.showError(caught.getMessage()); - view.setSubmitButtonEnabled(true); - } - } - ); - } - - public void reloginUser(String username, String newPassword) { - // login user as session token has changed - authenticationController.loginUser( - username, - newPassword, - new AsyncCallback() { - @Override - public void onSuccess(UserProfile result) { - globalApplicationState.gotoLastPlace(); - } - - @Override - public void onFailure(Throwable caught) { - // if login fails, simple send them to the login page to get a new session - globalApplicationState - .getPlaceChanger() - .goTo(new LoginPlace(LoginPlace.LOGIN_TOKEN)); - } - } - ); - } + public void setPlace(PasswordReset place) {} } diff --git a/src/test/java/org/sagebionetworks/web/unitclient/presenter/PasswordResetPresenterTest.java b/src/test/java/org/sagebionetworks/web/unitclient/presenter/PasswordResetPresenterTest.java index b787cf2b39..0efe6643ff 100644 --- a/src/test/java/org/sagebionetworks/web/unitclient/presenter/PasswordResetPresenterTest.java +++ b/src/test/java/org/sagebionetworks/web/unitclient/presenter/PasswordResetPresenterTest.java @@ -1,104 +1,33 @@ package org.sagebionetworks.web.unitclient.presenter; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isA; import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.verify; import static org.mockito.Mockito.when; import com.google.gwt.event.shared.EventBus; -import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.AcceptsOneWidget; +import com.google.gwtmockito.GwtMockitoTestRunner; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; -import org.sagebionetworks.repo.model.UserProfile; -import org.sagebionetworks.repo.model.auth.ChangePasswordWithCurrentPassword; import org.sagebionetworks.web.client.ClientProperties; -import org.sagebionetworks.web.client.DisplayConstants; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.PlaceChanger; -import org.sagebionetworks.web.client.SynapseJavascriptClient; -import org.sagebionetworks.web.client.place.LoginPlace; import org.sagebionetworks.web.client.place.users.PasswordReset; import org.sagebionetworks.web.client.presenter.users.PasswordResetPresenter; -import org.sagebionetworks.web.client.security.AuthenticationController; -import org.sagebionetworks.web.client.view.users.PasswordResetView; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; -import org.sagebionetworks.web.shared.WebConstants; -import org.sagebionetworks.web.shared.exceptions.RestServiceException; -import org.sagebionetworks.web.test.helper.AsyncMockStubber; -@RunWith(MockitoJUnitRunner.class) +@RunWith(GwtMockitoTestRunner.class) public class PasswordResetPresenterTest { PasswordResetPresenter presenter; - @Mock - PasswordResetView mockView; - - @Mock - GlobalApplicationState mockGlobalApplicationState; - - @Mock - AuthenticationController mockAuthenticationController; - - @Mock - PlaceChanger mockPlaceChanger; - @Mock PasswordReset place; - @Mock - SynapseJavascriptClient mockJsClient; - - @Mock - SynapseAlert mockSynAlert; - - UserProfile profile; - @Before public void setup() { - profile = new UserProfile(); - mockGlobalApplicationState = mock(GlobalApplicationState.class); - mockAuthenticationController = mock(AuthenticationController.class); - mockPlaceChanger = mock(PlaceChanger.class); - mockAuthenticationController = Mockito.mock(AuthenticationController.class); - - presenter = - new PasswordResetPresenter( - mockView, - mockAuthenticationController, - mockGlobalApplicationState, - mockJsClient, - mockSynAlert - ); - verify(mockView).setPresenter(presenter); + presenter = new PasswordResetPresenter(); when(place.toToken()).thenReturn(ClientProperties.DEFAULT_PLACE_TOKEN); } - private void resetAll() { - reset(mockView); - reset(mockGlobalApplicationState); - reset(mockAuthenticationController); - - when(mockGlobalApplicationState.getPlaceChanger()) - .thenReturn(mockPlaceChanger); - when(mockAuthenticationController.isLoggedIn()).thenReturn(true); - when(mockAuthenticationController.getCurrentUserProfile()) - .thenReturn(profile); - AsyncMockStubber - .callSuccessWith(profile) - .when(mockAuthenticationController) - .loginUser(anyString(), anyString(), any(AsyncCallback.class)); - } - @Test public void testStart() { presenter.setPlace(place); @@ -107,127 +36,5 @@ public void testStart() { EventBus eventBus = mock(EventBus.class); presenter.start(panel, eventBus); - verify(panel).setWidget(mockView); - } - - @Test - public void testSetPasswordLoad() { - AsyncMockStubber - .callSuccessWith(profile) - .when(mockAuthenticationController) - .setNewAccessToken(anyString(), any(AsyncCallback.class)); - PasswordReset place = new PasswordReset("someSessionToken"); - presenter.setPlace(place); - verify(mockView).showResetForm(); - } - - @Test - public void testSetPasswordLoadFail() { - AsyncMockStubber - .callFailureWith(new Exception()) - .when(mockAuthenticationController) - .setNewAccessToken(anyString(), any(AsyncCallback.class)); - PasswordReset place = new PasswordReset("someSessionToken"); - presenter.setPlace(place); - verify(mockView).showExpiredRequest(); - } - - @Test - public void testResetPassword() { - // mock a successful user service call - resetAll(); - profile.setUserName("007"); - presenter.setPlace(place); - AsyncMockStubber - .callSuccessWith(null) - .when(mockJsClient) - .changePassword( - any(ChangePasswordWithCurrentPassword.class), - any(AsyncCallback.class) - ); - presenter.resetPassword("oldPassword", "myPassword"); - // verify password reset text is shown in the view - verify(mockView).showInfo(eq(DisplayConstants.PASSWORD_RESET_TEXT)); - // verify that place is changed to last place - verify(mockGlobalApplicationState).gotoLastPlace(); - } - - @Test - public void testResetPassword2() { - // if there is a failure to re-login using the available credentials, send to the login page instead - resetAll(); - AsyncMockStubber - .callFailureWith(new Exception()) - .when(mockAuthenticationController) - .loginUser(anyString(), anyString(), any(AsyncCallback.class)); - presenter.setPlace(place); - AsyncMockStubber - .callSuccessWith(null) - .when(mockJsClient) - .changePassword( - any(ChangePasswordWithCurrentPassword.class), - any(AsyncCallback.class) - ); - presenter.resetPassword("oldPassword", "myPassword"); - // verify password reset text is shown in the view - verify(mockView).showInfo(eq(DisplayConstants.PASSWORD_RESET_TEXT)); - // verify that place is changed to login page - verify(mockPlaceChanger).goTo(isA(LoginPlace.class)); - } - - @Test - public void testResetPassword3() { - // or if the profile username is not set - resetAll(); - presenter.setPlace(place); - AsyncMockStubber - .callSuccessWith(null) - .when(mockJsClient) - .changePassword( - any(ChangePasswordWithCurrentPassword.class), - any(AsyncCallback.class) - ); - profile.setUserName(null); - presenter.resetPassword("oldPassword", "myPassword"); - // verify that place is changed to Login - verify(mockPlaceChanger).goTo(isA(LoginPlace.class)); - } - - @Test - public void testResetPassword4() { - // or if the profile username is a temporary username - resetAll(); - presenter.setPlace(place); - AsyncMockStubber - .callSuccessWith(null) - .when(mockJsClient) - .changePassword( - any(ChangePasswordWithCurrentPassword.class), - any(AsyncCallback.class) - ); - profile.setUserName(WebConstants.TEMPORARY_USERNAME_PREFIX + "123"); - presenter.resetPassword("oldPassword", "myPassword"); - // verify that place is changed to Login - verify(mockPlaceChanger).goTo(isA(LoginPlace.class)); - } - - @Test - public void testServiceFailure() { - // without the registration token set, mock a failed user service call - resetAll(); - String errorMessage = "unknown error"; - Exception ex = new RestServiceException(errorMessage); - AsyncMockStubber - .callFailureWith(ex) - .when(mockJsClient) - .changePassword( - any(ChangePasswordWithCurrentPassword.class), - any(AsyncCallback.class) - ); - presenter.setPlace(place); - presenter.resetPassword("oldPassword", "myPassword"); - verify(mockSynAlert).clear(); - // verify password reset failed text is shown in the view - verify(mockSynAlert).showError(errorMessage); } } From 5939b734f012e6e3ccd0511233f71b8f1ea556a8 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Thu, 23 May 2024 11:53:24 -0400 Subject: [PATCH 02/10] SWC-6844 - Point user to OneSage to change password --- .../client/presenter/SettingsPresenter.java | 102 ------------- .../web/client/view/SettingsView.java | 27 ---- .../web/client/view/SettingsViewImpl.java | 140 ------------------ .../web/client/view/SettingsViewImpl.ui.xml | 58 ++------ .../UserProfileEditorWidgetViewImpl.ui.xml | 2 +- .../presenter/SettingsPresenterTest.java | 140 +----------------- 6 files changed, 16 insertions(+), 453 deletions(-) diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/SettingsPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/SettingsPresenter.java index 92523662e6..f4ce427f75 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/SettingsPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/SettingsPresenter.java @@ -44,7 +44,6 @@ public class SettingsPresenter implements SettingsView.Presenter { private SynapseClientAsync synapseClient; private SynapseAlert apiSynAlert; private SynapseAlert notificationSynAlert; - private SynapseAlert passwordSynAlert; private PortalGinInjector ginInjector; private EmailAddressesWidget emailAddressesWidget; private SynapseJavascriptClient jsClient; @@ -86,10 +85,8 @@ public SettingsPresenter( private void setSynAlertWidgets() { apiSynAlert = ginInjector.getSynapseAlertWidget(); notificationSynAlert = ginInjector.getSynapseAlertWidget(); - passwordSynAlert = ginInjector.getSynapseAlertWidget(); view.setAPISynAlertWidget(apiSynAlert); view.setNotificationSynAlertWidget(notificationSynAlert); - view.setPasswordSynAlertWidget(passwordSynAlert); } @Override @@ -110,69 +107,6 @@ public void onFailure(Throwable caught) { synapseClient.getAPIKey(callback); } - @Override - public void resetPassword( - final String existingPassword, - final String newPassword - ) { - clearPasswordErrors(); - if (authenticationController.isLoggedIn()) { - if ( - authenticationController.getCurrentUserProfile() != null && - authenticationController.getCurrentUserProfile().getUserName() != null - ) { - String username = authenticationController - .getCurrentUserProfile() - .getUserName(); - ChangePasswordWithCurrentPassword changePasswordRequest = - new ChangePasswordWithCurrentPassword(); - changePasswordRequest.setCurrentPassword(existingPassword); - changePasswordRequest.setNewPassword(newPassword); - changePasswordRequest.setUsername( - authenticationController.getCurrentUserProfile().getUserName() - ); - jsClient.changePassword( - changePasswordRequest, - new AsyncCallback() { - @Override - public void onSuccess(Void result) { - view.showPasswordChangeSuccess(); - // login user as session token - // has changed - authenticationController.loginUser( - username, - newPassword, - new AsyncCallback() { - @Override - public void onSuccess(UserProfile result) {} - - @Override - public void onFailure(Throwable caught) { - // if login fails, simple send them to the login page to get a new session - globalApplicationState - .getPlaceChanger() - .goTo(new LoginPlace(LoginPlace.LOGIN_TOKEN)); - } - } - ); - } - - @Override - public void onFailure(Throwable caught) { - passwordSynAlert.showError(caught.getMessage()); - view.setChangePasswordEnabled(true); - } - } - ); - } else { - view.showErrorMessage(DisplayConstants.ERROR_GENERIC_RELOAD); - } - } else { - view.showInfo("Reset Password failed. Please Login again."); - goTo(new LoginPlace(LoginPlace.LOGIN_TOKEN)); - } - } - @Override public void goTo(Place place) { globalApplicationState.getPlaceChanger().goTo(place); @@ -230,7 +164,6 @@ public void clear() { apiSynAlert.clear(); notificationSynAlert.clear(); emailAddressesWidget.clear(); - passwordSynAlert.clear(); } public void configure() { @@ -325,41 +258,6 @@ public void onEditProfile() { .goTo(new Profile(Profile.EDIT_PROFILE_TOKEN)); } - @Override - public void changePassword() { - clearPasswordErrors(); - String currentPassword = view.getCurrentPasswordField(); - String password1 = view.getPassword1Field(); - String password2 = view.getPassword2Field(); - if (!checkPasswordDefined(currentPassword)) { - view.setCurrentPasswordInError(true); - passwordSynAlert.showError(DisplayConstants.ERROR_ALL_FIELDS_REQUIRED); - } else if (!checkPasswordDefined(password1)) { - view.setPassword1InError(true); - passwordSynAlert.showError(DisplayConstants.ERROR_ALL_FIELDS_REQUIRED); - } else if (!checkPasswordDefined(password2)) { - view.setPassword2InError(true); - passwordSynAlert.showError(DisplayConstants.ERROR_ALL_FIELDS_REQUIRED); - } else if (!password1.equals(password2)) { - view.setPassword2InError(true); - passwordSynAlert.showError(DisplayConstants.PASSWORDS_MISMATCH); - } else { - view.setChangePasswordEnabled(false); - resetPassword(currentPassword, password1); - } - } - - public void clearPasswordErrors() { - passwordSynAlert.clear(); - view.setCurrentPasswordInError(false); - view.setPassword1InError(false); - view.setPassword2InError(false); - } - - private boolean checkPasswordDefined(String password) { - return password != null && !password.isEmpty(); - } - @Override public void setShowUTCTime(boolean isUTC) { globalApplicationState.setShowUTCTime(isUTC); diff --git a/src/main/java/org/sagebionetworks/web/client/view/SettingsView.java b/src/main/java/org/sagebionetworks/web/client/view/SettingsView.java index 53d0b77027..aabf636eab 100644 --- a/src/main/java/org/sagebionetworks/web/client/view/SettingsView.java +++ b/src/main/java/org/sagebionetworks/web/client/view/SettingsView.java @@ -20,18 +20,11 @@ public interface SettingsView extends IsWidget, SynapseView { */ public void render(); - /** - * Shows the user that their password change succeeded - */ - public void showPasswordChangeSuccess(); - public void updateNotificationCheckbox(UserProfile profile); void setEmailAddressesWidget(IsWidget w); public interface Presenter { - void resetPassword(String existingPassword, String newPassword); - void goTo(Place place); void updateMyNotificationSettings( @@ -45,8 +38,6 @@ void updateMyNotificationSettings( void getAPIKey(); - void changePassword(); - void setShowUTCTime(boolean isUTC); void newVerificationSubmissionClicked(); @@ -66,28 +57,10 @@ void updateMyNotificationSettings( public void setAPISynAlertWidget(IsWidget synAlert); - public void setPasswordSynAlertWidget(IsWidget synAlert); - void hideAPIKey(); void showConfirm(String message, Callback callback); - String getPassword1Field(); - - String getCurrentPasswordField(); - - String getPassword2Field(); - - void setCurrentPasswordInError(boolean inError); - - void setPassword1InError(boolean inError); - - void setPassword2InError(boolean inError); - - void setChangePasswordEnabled(boolean isEnabled); - - void resetChangePasswordUI(); - void setShowingUTCTime(); void setShowingLocalTime(); diff --git a/src/main/java/org/sagebionetworks/web/client/view/SettingsViewImpl.java b/src/main/java/org/sagebionetworks/web/client/view/SettingsViewImpl.java index 6b667fdce3..07ed717c23 100644 --- a/src/main/java/org/sagebionetworks/web/client/view/SettingsViewImpl.java +++ b/src/main/java/org/sagebionetworks/web/client/view/SettingsViewImpl.java @@ -1,9 +1,5 @@ package org.sagebionetworks.web.client.view; -import static org.sagebionetworks.web.client.DisplayConstants.AUTOCOMPLETE_ATTRIBUTE; -import static org.sagebionetworks.web.client.DisplayConstants.AUTOCOMPLETE_VALUE_CURRENT_PASSWORD; -import static org.sagebionetworks.web.client.DisplayConstants.AUTOCOMPLETE_VALUE_NEW_PASSWORD; - import com.google.gwt.event.dom.client.ClickEvent; import com.google.gwt.event.dom.client.ClickHandler; import com.google.gwt.uibinder.client.UiBinder; @@ -13,7 +9,6 @@ import com.google.gwt.user.client.ui.FlowPanel; import com.google.gwt.user.client.ui.HTMLPanel; import com.google.gwt.user.client.ui.IsWidget; -import com.google.gwt.user.client.ui.PasswordTextBox; import com.google.gwt.user.client.ui.SimplePanel; import com.google.gwt.user.client.ui.TextBox; import com.google.gwt.user.client.ui.Widget; @@ -24,7 +19,6 @@ import org.gwtbootstrap3.client.ui.CheckBox; import org.gwtbootstrap3.client.ui.Icon; import org.gwtbootstrap3.client.ui.Panel; -import org.gwtbootstrap3.client.ui.Row; import org.gwtbootstrap3.client.ui.html.Div; import org.gwtbootstrap3.client.ui.html.Span; import org.sagebionetworks.repo.model.UserProfile; @@ -42,7 +36,6 @@ import org.sagebionetworks.web.client.place.PersonalAccessTokenPlace; import org.sagebionetworks.web.client.place.Quiz; import org.sagebionetworks.web.client.place.TwoFactorAuthPlace; -import org.sagebionetworks.web.client.place.users.PasswordReset; import org.sagebionetworks.web.client.utils.Callback; import org.sagebionetworks.web.client.widget.ReactComponentDiv; @@ -69,38 +62,9 @@ public interface SettingsViewImplUiBinder @UiField org.gwtbootstrap3.client.ui.Button editProfileButton; - @UiField - FlowPanel forgotPasswordContainer; - - Anchor forgotPasswordLink; - @UiField Div emailsPanel; - @UiField - PasswordTextBox currentPasswordField; - - @UiField - PasswordTextBox password1Field; - - @UiField - PasswordTextBox password2Field; - - @UiField - Row currentPassword; - - @UiField - Row password1; - - @UiField - Row password2; - - @UiField - SimplePanel passwordSynAlertPanel; - - @UiField - Button changePasswordBtn; - @UiField TextBox apiKeyContainer; @@ -193,10 +157,6 @@ public SettingsViewImpl( ClickHandler notificationsClickHandler = getNotificationsClickHandler(); emailNotificationsCheckbox.addClickHandler(notificationsClickHandler); - changePasswordBtn.addClickHandler(event -> { - presenter.changePassword(); - }); - changeApiKey.addClickHandler(event -> { presenter.changeApiKey(); }); @@ -205,15 +165,6 @@ public SettingsViewImpl( presenter.getAPIKey(); }); - forgotPasswordLink = new Anchor(); - forgotPasswordLink.addStyleName("link movedown-4 margin-left-10"); - forgotPasswordLink.setText(DisplayConstants.FORGOT_PASSWORD); - forgotPasswordLink.addClickHandler(event -> { - presenter.goTo(new PasswordReset(ClientProperties.DEFAULT_PLACE_TOKEN)); - }); - forgotPasswordContainer.addStyleName("inline-block"); - forgotPasswordContainer.add(forgotPasswordLink); - ClickHandler editProfileClickHandler = event -> { presenter.onEditProfile(); }; @@ -315,36 +266,9 @@ public void setPresenter(final Presenter presenter) { @Override public void render() { - currentPasswordField - .getElement() - .setAttribute("placeholder", "Enter current password"); - password1Field - .getElement() - .setAttribute("placeholder", "Enter new password"); - password2Field - .getElement() - .setAttribute("placeholder", "Confirm new password"); - currentPasswordField - .getElement() - .setAttribute( - AUTOCOMPLETE_ATTRIBUTE, - AUTOCOMPLETE_VALUE_CURRENT_PASSWORD - ); - password1Field - .getElement() - .setAttribute(AUTOCOMPLETE_ATTRIBUTE, AUTOCOMPLETE_VALUE_NEW_PASSWORD); - password2Field - .getElement() - .setAttribute(AUTOCOMPLETE_ATTRIBUTE, AUTOCOMPLETE_VALUE_NEW_PASSWORD); clear(); } - @Override - public void showPasswordChangeSuccess() { - resetChangePasswordUI(); - showInfo("Password has been successfully changed"); - } - @Override public void showErrorMessage(String message) { DisplayUtils.showErrorMessage(message); @@ -383,52 +307,9 @@ public void showInfo(String message) { DisplayUtils.showInfo(message); } - @Override - public String getCurrentPasswordField() { - return currentPasswordField.getText(); - } - - @Override - public void setCurrentPasswordInError(boolean inError) { - if (inError) { - currentPassword.addStyleName("has-error"); - } else { - currentPassword.removeStyleName("has-error"); - } - } - - @Override - public String getPassword1Field() { - return password1Field.getText(); - } - - @Override - public void setPassword1InError(boolean inError) { - if (inError) { - password1.addStyleName("has-error"); - } else { - password1.removeStyleName("has-error"); - } - } - - @Override - public String getPassword2Field() { - return password2Field.getText(); - } - - @Override - public void setPassword2InError(boolean inError) { - if (inError) { - password2.addStyleName("has-error"); - } else { - password2.removeStyleName("has-error"); - } - } - @Override public void clear() { hideAPIKey(); - resetChangePasswordUI(); verificationApprovedButton.setVisible(false); resubmitProfileValidationButton.setVisible(false); verificationSubmittedButton.setVisible(false); @@ -437,17 +318,6 @@ public void clear() { verifyAlert.setVisible(false); } - @Override - public void resetChangePasswordUI() { - currentPasswordField.setValue(""); - password1Field.setValue(""); - password2Field.setValue(""); - changePasswordBtn.setEnabled(true); - setCurrentPasswordInError(false); - setPassword1InError(false); - setPassword2InError(false); - } - @Override public void setApiKey(String apiKey) { apiKeyContainer.setText(apiKey); @@ -479,16 +349,6 @@ public void showConfirm(String message, Callback callback) { DisplayUtils.confirm(message, callback); } - @Override - public void setChangePasswordEnabled(boolean isEnabled) { - changePasswordBtn.setEnabled(isEnabled); - } - - @Override - public void setPasswordSynAlertWidget(IsWidget synAlert) { - passwordSynAlertPanel.setWidget(synAlert); - } - @Override public void setShowingUTCTime() { dateFormatDropdown.setText(dateFormatUTC.getText()); diff --git a/src/main/resources/org/sagebionetworks/web/client/view/SettingsViewImpl.ui.xml b/src/main/resources/org/sagebionetworks/web/client/view/SettingsViewImpl.ui.xml index 0968c93e16..5b446a8ed1 100644 --- a/src/main/resources/org/sagebionetworks/web/client/view/SettingsViewImpl.ui.xml +++ b/src/main/resources/org/sagebionetworks/web/client/view/SettingsViewImpl.ui.xml @@ -174,52 +174,22 @@ - - - Current password - - - - - - - - New password - - - - - - - - Confirm password - - - - - - - - - - - - + + + + + + diff --git a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.ui.xml b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.ui.xml index 76a64f5d75..18896909bb 100755 --- a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.ui.xml +++ b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.ui.xml @@ -162,7 +162,7 @@ addStyleNames="displayInlineBlock" ui:field="changePasswordLink" target="_blank" - href="/Profile:v/settings" + href="https://accounts.sagebionetworks.synapse.org/authenticated/myaccount#ChangePassword" visible="false" > Change password diff --git a/src/test/java/org/sagebionetworks/web/unitclient/presenter/SettingsPresenterTest.java b/src/test/java/org/sagebionetworks/web/unitclient/presenter/SettingsPresenterTest.java index 18518cbfd4..86b465f10b 100644 --- a/src/test/java/org/sagebionetworks/web/unitclient/presenter/SettingsPresenterTest.java +++ b/src/test/java/org/sagebionetworks/web/unitclient/presenter/SettingsPresenterTest.java @@ -243,65 +243,6 @@ public void setup() throws JSONObjectAdapterException { .thenReturn(getDoneFuture(twoFactorDisabledStatus)); } - @Test - public void testResetPassword() throws RestServiceException { - AsyncMockStubber - .callSuccessWith(profile) - .when(mockAuthenticationController) - .loginUser(eq(username), eq(password), any(AsyncCallback.class)); - AsyncMockStubber - .callSuccessWith(null) - .when(mockSynapseJavascriptClient) - .changePassword( - any(ChangePasswordWithCurrentPassword.class), - any(AsyncCallback.class) - ); - AsyncMockStubber - .callSuccessWith(profile) - .when(mockAuthenticationController) - .loginUser(eq(username), eq(newPassword), any(AsyncCallback.class)); - - presenter.resetPassword(password, newPassword); - verify(mockView).showPasswordChangeSuccess(); - } - - @Test - public void testResetPasswordFailChangePw() throws RestServiceException { - String errorMessage = - "pw change failed, could happen if user provides the incorrect current password"; - Exception ex = new Exception(errorMessage); - AsyncMockStubber - .callFailureWith(ex) - .when(mockSynapseJavascriptClient) - .changePassword( - any(ChangePasswordWithCurrentPassword.class), - any(AsyncCallback.class) - ); - - presenter.resetPassword(password, newPassword); - verify(mockSynAlert).clear(); - verify(mockSynAlert).showError(errorMessage); - } - - @Test - public void testResetPasswordFailFinalLogin() throws RestServiceException { - AsyncMockStubber - .callSuccessWith(null) - .when(mockSynapseJavascriptClient) - .changePassword( - any(ChangePasswordWithCurrentPassword.class), - any(AsyncCallback.class) - ); - AsyncMockStubber - .callFailureWith(new Exception()) - .when(mockAuthenticationController) - .loginUser(eq(username), eq(newPassword), any(AsyncCallback.class)); - - presenter.resetPassword(password, newPassword); - verify(mockView).showPasswordChangeSuccess(); - verify(mockPlaceChanger).goTo(isA(LoginPlace.class)); - } - // if notification settings are null, should still successfully update with user specified // notification setting public void testUpdateMyNotificationSettingsLazyInstantiation() @@ -422,7 +363,7 @@ public void testOnEditProfile() { public void testConfigure() { when(mockGlobalApplicationState.isShowingUTCTime()).thenReturn(false); presenter.configure(); - verify(mockSynAlert, times(3)).clear(); + verify(mockSynAlert, times(2)).clear(); verify(mockView).clear(); verify(mockView).updateNotificationCheckbox(profile); verify(mockAuthenticationController).updateCachedProfile(profile); @@ -490,85 +431,6 @@ public void testAPIKeyChangeConfirmedFailure() { verify(mockSynAlert).handleException(e); } - @Test - public void testChangePasswordCurrentPasswordFailure() { - when(mockView.getCurrentPasswordField()).thenReturn(""); - presenter.changePassword(); - verify(mockView).getCurrentPasswordField(); - verify(mockView).getPassword1Field(); - verify(mockView).getPassword2Field(); - verify(mockSynAlert).showError(DisplayConstants.ERROR_ALL_FIELDS_REQUIRED); - verify(mockView).setCurrentPasswordInError(true); - } - - @Test - public void testChangePasswordPassword1Failure() { - when(mockView.getCurrentPasswordField()).thenReturn(password); - when(mockView.getPassword1Field()).thenReturn(""); - presenter.changePassword(); - verify(mockView).getCurrentPasswordField(); - verify(mockView).getPassword1Field(); - verify(mockView).getPassword2Field(); - verify(mockSynAlert).showError(DisplayConstants.ERROR_ALL_FIELDS_REQUIRED); - verify(mockView).setPassword1InError(true); - } - - @Test - public void testChangePasswordPassword2Failure() { - // empty second password - when(mockView.getCurrentPasswordField()).thenReturn(password); - when(mockView.getPassword1Field()).thenReturn(newPassword); - when(mockView.getPassword2Field()).thenReturn(""); - presenter.changePassword(); - verify(mockView).getCurrentPasswordField(); - verify(mockView).getPassword1Field(); - verify(mockView).getPassword2Field(); - verify(mockSynAlert).showError(DisplayConstants.ERROR_ALL_FIELDS_REQUIRED); - verify(mockView).setPassword2InError(true); - - // unmatching second password - Mockito.reset(mockView); - when(mockView.getCurrentPasswordField()).thenReturn(password); - when(mockView.getPassword1Field()).thenReturn(newPassword); - when(mockView.getPassword2Field()).thenReturn(newPassword + "abc"); - presenter.changePassword(); - verify(mockView).getCurrentPasswordField(); - verify(mockView).getPassword1Field(); - verify(mockView).getPassword2Field(); - verify(mockSynAlert).showError(DisplayConstants.PASSWORDS_MISMATCH); - verify(mockView).setPassword2InError(true); - } - - @Test - public void testChangePasswordPasswordSuccess() { - AsyncMockStubber - .callSuccessWith(profile) - .when(mockAuthenticationController) - .loginUser(eq(username), eq(password), any(AsyncCallback.class)); - when(mockView.getCurrentPasswordField()).thenReturn(password); - when(mockView.getPassword1Field()).thenReturn(newPassword); - when(mockView.getPassword2Field()).thenReturn(newPassword); - presenter.changePassword(); - verify(mockView).getCurrentPasswordField(); - verify(mockView).getPassword1Field(); - verify(mockView).getPassword2Field(); - verify(mockView).setChangePasswordEnabled(false); - verify(mockSynapseJavascriptClient) - .changePassword( - any(ChangePasswordWithCurrentPassword.class), - any(AsyncCallback.class) - ); - } - - @Test - public void testClearPasswordErrors() { - presenter.clearPasswordErrors(); - verify(mockSynAlert).clear(); - verify(mockView).setCurrentPasswordInError(false); - verify(mockView).setPassword1InError(false); - verify(mockView).setPassword2InError(false); - } - @Test public void testSetShowUTCTime() { presenter.setShowUTCTime(true); From bec538c3b761d972ab03d5ea545c79c05d42c90d Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Tue, 28 May 2024 12:36:08 -0400 Subject: [PATCH 03/10] Remove account settings and redirect users to OneSage --- .../web/client/PortalGinInjector.java | 3 - .../web/client/PortalGinModule.java | 707 +----------------- .../jsinterop/AccessTokenPageProps.java | 21 - .../web/client/jsinterop/SRC.java | 10 - .../TwoFactorAuthSettingsPanelProps.java | 32 - .../jsinterop/TwoFactorBackupCodesProps.java | 31 - .../TwoFactorEnrollmentFormProps.java | 26 - .../web/client/place/Synapse.java | 1 + .../client/presenter/AccountPresenter.java | 4 +- .../presenter/EmailInvitationPresenter.java | 17 +- .../PersonalAccessTokensPresenter.java | 17 +- .../client/presenter/ProfilePresenter.java | 39 +- .../client/presenter/SettingsPresenter.java | 386 ---------- .../presenter/TwoFactorAuthPresenter.java | 67 +- .../users/PasswordResetPresenter.java | 1 - .../client/view/PersonalAccessTokensView.java | 19 - .../view/PersonalAccessTokensViewImpl.java | 86 --- .../web/client/view/ProfileViewImpl.java | 43 +- .../web/client/view/SettingsView.java | 89 --- .../web/client/view/SettingsViewImpl.java | 429 ----------- .../web/client/view/TwoFactorAuthView.java | 20 - .../client/view/TwoFactorAuthViewImpl.java | 110 --- .../client/widget/QuarantinedEmailModal.java | 14 +- .../profile/UserProfileEditorWidgetImpl.java | 14 - .../web/shared/WebConstants.java | 5 + .../view/PersonalAccessTokensViewImpl.ui.xml | 26 - .../web/client/view/SettingsViewImpl.ui.xml | 363 --------- .../client/view/TwoFactorAuthViewImpl.ui.xml | 15 - .../widget/QuarantinedEmailModal.ui.xml | 10 +- .../UserProfileEditorWidgetViewImpl.ui.xml | 2 +- .../profile/UserProfileModalViewImpl.ui.xml | 2 +- .../PersonalAccessTokensPresenterTest.java | 75 -- .../EmailInvitationPresenterTest.java | 2 +- .../presenter/ProfilePresenterTest.java | 54 +- .../presenter/SettingsPresenterTest.java | 616 --------------- .../presenter/TwoFactorAuthPresenterTest.java | 120 --- 36 files changed, 107 insertions(+), 3369 deletions(-) delete mode 100644 src/main/java/org/sagebionetworks/web/client/jsinterop/AccessTokenPageProps.java delete mode 100644 src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorAuthSettingsPanelProps.java delete mode 100644 src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorBackupCodesProps.java delete mode 100644 src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorEnrollmentFormProps.java delete mode 100644 src/main/java/org/sagebionetworks/web/client/presenter/SettingsPresenter.java delete mode 100644 src/main/java/org/sagebionetworks/web/client/view/PersonalAccessTokensView.java delete mode 100644 src/main/java/org/sagebionetworks/web/client/view/PersonalAccessTokensViewImpl.java delete mode 100644 src/main/java/org/sagebionetworks/web/client/view/SettingsView.java delete mode 100644 src/main/java/org/sagebionetworks/web/client/view/SettingsViewImpl.java delete mode 100644 src/main/java/org/sagebionetworks/web/client/view/TwoFactorAuthView.java delete mode 100644 src/main/java/org/sagebionetworks/web/client/view/TwoFactorAuthViewImpl.java delete mode 100644 src/main/resources/org/sagebionetworks/web/client/view/PersonalAccessTokensViewImpl.ui.xml delete mode 100644 src/main/resources/org/sagebionetworks/web/client/view/SettingsViewImpl.ui.xml delete mode 100644 src/main/resources/org/sagebionetworks/web/client/view/TwoFactorAuthViewImpl.ui.xml delete mode 100644 src/test/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenterTest.java delete mode 100644 src/test/java/org/sagebionetworks/web/unitclient/presenter/SettingsPresenterTest.java delete mode 100644 src/test/java/org/sagebionetworks/web/unitclient/presenter/TwoFactorAuthPresenterTest.java diff --git a/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java b/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java index d1a884cba0..28091f826e 100644 --- a/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java +++ b/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java @@ -37,7 +37,6 @@ import org.sagebionetworks.web.client.presenter.ProfilePresenter; import org.sagebionetworks.web.client.presenter.QuizPresenter; import org.sagebionetworks.web.client.presenter.SearchPresenter; -import org.sagebionetworks.web.client.presenter.SettingsPresenter; import org.sagebionetworks.web.client.presenter.SignedTokenPresenter; import org.sagebionetworks.web.client.presenter.SubscriptionPresenter; import org.sagebionetworks.web.client.presenter.SynapseForumPresenter; @@ -685,8 +684,6 @@ public interface PortalGinInjector extends Ginjector { QueryTokenProvider getQueryTokenProvider(); - SettingsPresenter getSettingsPresenter(); - PersonalAccessTokensPresenter getPersonalAccessTokensPresenter(); AccessControlListModalWidget getAccessControlListModalWidget(); diff --git a/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java b/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java index 51ae1c727d..c593442c13 100644 --- a/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java +++ b/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java @@ -10,194 +10,29 @@ import org.sagebionetworks.schema.adapter.AdapterFactory; import org.sagebionetworks.schema.adapter.JSONArrayAdapter; import org.sagebionetworks.schema.adapter.JSONObjectAdapter; -import org.sagebionetworks.web.client.cache.ClientCache; -import org.sagebionetworks.web.client.cache.ClientCacheImpl; -import org.sagebionetworks.web.client.cache.EntityId2BundleCache; -import org.sagebionetworks.web.client.cache.EntityId2BundleCacheImpl; -import org.sagebionetworks.web.client.cache.SessionStorage; -import org.sagebionetworks.web.client.cache.SessionStorageImpl; -import org.sagebionetworks.web.client.cache.StorageImpl; -import org.sagebionetworks.web.client.cache.StorageWrapper; -import org.sagebionetworks.web.client.context.KeyFactoryProvider; -import org.sagebionetworks.web.client.context.KeyFactoryProviderImpl; -import org.sagebionetworks.web.client.context.QueryClientProvider; -import org.sagebionetworks.web.client.context.QueryClientProviderImpl; -import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider; -import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProviderImpl; +import org.sagebionetworks.web.client.cache.*; +import org.sagebionetworks.web.client.context.*; import org.sagebionetworks.web.client.cookie.CookieProvider; import org.sagebionetworks.web.client.cookie.GWTCookieImpl; -import org.sagebionetworks.web.client.presenter.DownPresenter; -import org.sagebionetworks.web.client.presenter.EntityPresenter; -import org.sagebionetworks.web.client.presenter.EntityPresenterEventBinder; -import org.sagebionetworks.web.client.presenter.EntityPresenterEventBinderImpl; -import org.sagebionetworks.web.client.presenter.PersonalAccessTokensPresenter; -import org.sagebionetworks.web.client.presenter.ProfilePresenter; -import org.sagebionetworks.web.client.presenter.SignedTokenPresenter; +import org.sagebionetworks.web.client.presenter.*; import org.sagebionetworks.web.client.resources.ResourceLoader; import org.sagebionetworks.web.client.resources.ResourceLoaderImpl; import org.sagebionetworks.web.client.security.AuthenticationController; import org.sagebionetworks.web.client.security.AuthenticationControllerImpl; import org.sagebionetworks.web.client.transform.JsoProvider; import org.sagebionetworks.web.client.transform.JsoProviderImpl; -import org.sagebionetworks.web.client.view.ACTAccessApprovalsView; -import org.sagebionetworks.web.client.view.ACTAccessApprovalsViewImpl; -import org.sagebionetworks.web.client.view.ACTDataAccessSubmissionsView; -import org.sagebionetworks.web.client.view.ACTDataAccessSubmissionsViewImpl; -import org.sagebionetworks.web.client.view.ACTView; -import org.sagebionetworks.web.client.view.ACTViewImpl; -import org.sagebionetworks.web.client.view.AccountView; -import org.sagebionetworks.web.client.view.AccountViewImpl; -import org.sagebionetworks.web.client.view.CertificationQuizView; -import org.sagebionetworks.web.client.view.CertificationQuizViewImpl; -import org.sagebionetworks.web.client.view.ChallengeOverviewView; -import org.sagebionetworks.web.client.view.ChallengeOverviewViewImpl; -import org.sagebionetworks.web.client.view.ChangeUsernameView; -import org.sagebionetworks.web.client.view.ChangeUsernameViewImpl; -import org.sagebionetworks.web.client.view.ComingSoonView; -import org.sagebionetworks.web.client.view.ComingSoonViewImpl; -import org.sagebionetworks.web.client.view.DataAccessApprovalTokenView; -import org.sagebionetworks.web.client.view.DataAccessApprovalTokenViewImpl; -import org.sagebionetworks.web.client.view.DataAccessManagementView; -import org.sagebionetworks.web.client.view.DataAccessManagementViewImpl; -import org.sagebionetworks.web.client.view.DivView; -import org.sagebionetworks.web.client.view.DivViewImpl; -import org.sagebionetworks.web.client.view.DownView; -import org.sagebionetworks.web.client.view.DownViewImpl; -import org.sagebionetworks.web.client.view.DownloadCartPageView; -import org.sagebionetworks.web.client.view.DownloadCartPageViewImpl; -import org.sagebionetworks.web.client.view.EmailInvitationView; -import org.sagebionetworks.web.client.view.EmailInvitationViewImpl; -import org.sagebionetworks.web.client.view.EntityView; -import org.sagebionetworks.web.client.view.EntityViewImpl; -import org.sagebionetworks.web.client.view.ErrorView; -import org.sagebionetworks.web.client.view.ErrorViewImpl; -import org.sagebionetworks.web.client.view.FollowingPageView; -import org.sagebionetworks.web.client.view.FollowingPageViewImpl; -import org.sagebionetworks.web.client.view.HelpView; -import org.sagebionetworks.web.client.view.HelpViewImpl; -import org.sagebionetworks.web.client.view.HomeView; -import org.sagebionetworks.web.client.view.HomeViewImpl; -import org.sagebionetworks.web.client.view.LoginView; -import org.sagebionetworks.web.client.view.LoginViewImpl; -import org.sagebionetworks.web.client.view.MapView; -import org.sagebionetworks.web.client.view.MapViewImpl; -import org.sagebionetworks.web.client.view.NewAccountView; -import org.sagebionetworks.web.client.view.NewAccountViewImpl; -import org.sagebionetworks.web.client.view.OAuthClientEditorView; -import org.sagebionetworks.web.client.view.OAuthClientEditorViewImpl; -import org.sagebionetworks.web.client.view.PasswordResetSignedTokenView; -import org.sagebionetworks.web.client.view.PasswordResetSignedTokenViewImpl; -import org.sagebionetworks.web.client.view.PeopleSearchView; -import org.sagebionetworks.web.client.view.PeopleSearchViewImpl; -import org.sagebionetworks.web.client.view.PersonalAccessTokensView; -import org.sagebionetworks.web.client.view.PersonalAccessTokensViewImpl; -import org.sagebionetworks.web.client.view.PlaceView; -import org.sagebionetworks.web.client.view.PlaceViewImpl; -import org.sagebionetworks.web.client.view.ProfileView; -import org.sagebionetworks.web.client.view.ProfileViewImpl; -import org.sagebionetworks.web.client.view.SearchView; -import org.sagebionetworks.web.client.view.SearchViewImpl; -import org.sagebionetworks.web.client.view.SettingsView; -import org.sagebionetworks.web.client.view.SettingsViewImpl; -import org.sagebionetworks.web.client.view.SignedTokenView; -import org.sagebionetworks.web.client.view.SignedTokenViewImpl; -import org.sagebionetworks.web.client.view.SubscriptionView; -import org.sagebionetworks.web.client.view.SubscriptionViewImpl; -import org.sagebionetworks.web.client.view.SynapseForumView; -import org.sagebionetworks.web.client.view.SynapseForumViewImpl; -import org.sagebionetworks.web.client.view.SynapseStandaloneWikiView; -import org.sagebionetworks.web.client.view.SynapseStandaloneWikiViewImpl; -import org.sagebionetworks.web.client.view.SynapseWikiView; -import org.sagebionetworks.web.client.view.SynapseWikiViewImpl; -import org.sagebionetworks.web.client.view.TeamSearchView; -import org.sagebionetworks.web.client.view.TeamSearchViewImpl; -import org.sagebionetworks.web.client.view.TeamView; -import org.sagebionetworks.web.client.view.TeamViewImpl; -import org.sagebionetworks.web.client.view.TrashView; -import org.sagebionetworks.web.client.view.TrashViewImpl; -import org.sagebionetworks.web.client.view.TwoFactorAuthView; -import org.sagebionetworks.web.client.view.TwoFactorAuthViewImpl; -import org.sagebionetworks.web.client.view.WikiDiffView; -import org.sagebionetworks.web.client.view.WikiDiffViewImpl; -import org.sagebionetworks.web.client.view.users.PasswordResetView; -import org.sagebionetworks.web.client.view.users.PasswordResetViewImpl; -import org.sagebionetworks.web.client.view.users.RegisterAccountView; -import org.sagebionetworks.web.client.view.users.RegisterAccountViewImpl; -import org.sagebionetworks.web.client.view.users.RegisterWidgetView; -import org.sagebionetworks.web.client.view.users.RegisterWidgetViewImpl; -import org.sagebionetworks.web.client.widget.Button; -import org.sagebionetworks.web.client.widget.ButtonImpl; -import org.sagebionetworks.web.client.widget.CommaSeparatedValuesParserView; -import org.sagebionetworks.web.client.widget.CommaSeparatedValuesParserViewImpl; -import org.sagebionetworks.web.client.widget.CopyTextModal; -import org.sagebionetworks.web.client.widget.CopyTextModalImpl; -import org.sagebionetworks.web.client.widget.DownloadSpeedTester; -import org.sagebionetworks.web.client.widget.DownloadSpeedTesterImpl; -import org.sagebionetworks.web.client.widget.FileHandleWidgetView; -import org.sagebionetworks.web.client.widget.FileHandleWidgetViewImpl; -import org.sagebionetworks.web.client.widget.LoadMoreWidgetContainerView; -import org.sagebionetworks.web.client.widget.LoadMoreWidgetContainerViewImpl; -import org.sagebionetworks.web.client.widget.QuarantinedEmailModal; -import org.sagebionetworks.web.client.widget.RadioWidget; -import org.sagebionetworks.web.client.widget.RadioWidgetViewImpl; -import org.sagebionetworks.web.client.widget.accessrequirements.ACTAccessRequirementWidgetView; -import org.sagebionetworks.web.client.widget.accessrequirements.ACTAccessRequirementWidgetViewImpl; -import org.sagebionetworks.web.client.widget.accessrequirements.EntitySubjectsWidgetView; -import org.sagebionetworks.web.client.widget.accessrequirements.EntitySubjectsWidgetViewImpl; -import org.sagebionetworks.web.client.widget.accessrequirements.LockAccessRequirementWidgetView; -import org.sagebionetworks.web.client.widget.accessrequirements.LockAccessRequirementWidgetViewImpl; -import org.sagebionetworks.web.client.widget.accessrequirements.ManagedACTAccessRequirementWidgetView; -import org.sagebionetworks.web.client.widget.accessrequirements.ManagedACTAccessRequirementWidgetViewImpl; -import org.sagebionetworks.web.client.widget.accessrequirements.SelfSignAccessRequirementWidgetView; -import org.sagebionetworks.web.client.widget.accessrequirements.SelfSignAccessRequirementWidgetViewImpl; -import org.sagebionetworks.web.client.widget.accessrequirements.TeamSubjectWidgetView; -import org.sagebionetworks.web.client.widget.accessrequirements.TeamSubjectWidgetViewImpl; -import org.sagebionetworks.web.client.widget.accessrequirements.TermsOfUseAccessRequirementWidgetView; -import org.sagebionetworks.web.client.widget.accessrequirements.TermsOfUseAccessRequirementWidgetViewImpl; +import org.sagebionetworks.web.client.view.*; +import org.sagebionetworks.web.client.view.users.*; +import org.sagebionetworks.web.client.widget.*; +import org.sagebionetworks.web.client.widget.accessrequirements.*; import org.sagebionetworks.web.client.widget.accessrequirements.approval.AccessorGroupView; import org.sagebionetworks.web.client.widget.accessrequirements.approval.AccessorGroupViewImpl; -import org.sagebionetworks.web.client.widget.accessrequirements.createaccessrequirement.CreateAccessRequirementStep1View; -import org.sagebionetworks.web.client.widget.accessrequirements.createaccessrequirement.CreateAccessRequirementStep1ViewImpl; -import org.sagebionetworks.web.client.widget.accessrequirements.createaccessrequirement.CreateBasicAccessRequirementStep2View; -import org.sagebionetworks.web.client.widget.accessrequirements.createaccessrequirement.CreateBasicAccessRequirementStep2ViewImpl; -import org.sagebionetworks.web.client.widget.accessrequirements.createaccessrequirement.CreateManagedACTAccessRequirementStep2View; -import org.sagebionetworks.web.client.widget.accessrequirements.createaccessrequirement.CreateManagedACTAccessRequirementStep2ViewImpl; -import org.sagebionetworks.web.client.widget.accessrequirements.createaccessrequirement.CreateManagedACTAccessRequirementStep3View; -import org.sagebionetworks.web.client.widget.accessrequirements.createaccessrequirement.CreateManagedACTAccessRequirementStep3ViewImpl; +import org.sagebionetworks.web.client.widget.accessrequirements.createaccessrequirement.*; import org.sagebionetworks.web.client.widget.accessrequirements.submission.ACTDataAccessSubmissionWidgetView; import org.sagebionetworks.web.client.widget.accessrequirements.submission.ACTDataAccessSubmissionWidgetViewImpl; import org.sagebionetworks.web.client.widget.accessrequirements.submission.OpenSubmissionWidgetView; import org.sagebionetworks.web.client.widget.accessrequirements.submission.OpenSubmissionWidgetViewImpl; -import org.sagebionetworks.web.client.widget.asynch.AsynchronousJobTracker; -import org.sagebionetworks.web.client.widget.asynch.AsynchronousJobTrackerImpl; -import org.sagebionetworks.web.client.widget.asynch.AsynchronousProgressView; -import org.sagebionetworks.web.client.widget.asynch.AsynchronousProgressViewImpl; -import org.sagebionetworks.web.client.widget.asynch.AsynchronousProgressWidget; -import org.sagebionetworks.web.client.widget.asynch.EntityHeaderAsyncHandler; -import org.sagebionetworks.web.client.widget.asynch.EntityHeaderAsyncHandlerImpl; -import org.sagebionetworks.web.client.widget.asynch.FileHandleAsyncHandler; -import org.sagebionetworks.web.client.widget.asynch.FileHandleAsyncHandlerImpl; -import org.sagebionetworks.web.client.widget.asynch.IsACTMemberAsyncHandler; -import org.sagebionetworks.web.client.widget.asynch.IsACTMemberAsyncHandlerImpl; -import org.sagebionetworks.web.client.widget.asynch.JobTrackingWidget; -import org.sagebionetworks.web.client.widget.asynch.NumberFormatProvider; -import org.sagebionetworks.web.client.widget.asynch.NumberFormatProviderImpl; -import org.sagebionetworks.web.client.widget.asynch.PresignedAndFileHandleURLAsyncHandler; -import org.sagebionetworks.web.client.widget.asynch.PresignedAndFileHandleURLAsyncHandlerImpl; -import org.sagebionetworks.web.client.widget.asynch.PresignedURLAsyncHandler; -import org.sagebionetworks.web.client.widget.asynch.PresignedURLAsyncHandlerImpl; -import org.sagebionetworks.web.client.widget.asynch.TeamAsyncHandler; -import org.sagebionetworks.web.client.widget.asynch.TeamAsyncHandlerImpl; -import org.sagebionetworks.web.client.widget.asynch.TimerProvider; -import org.sagebionetworks.web.client.widget.asynch.TimerProviderImpl; -import org.sagebionetworks.web.client.widget.asynch.UserGroupHeaderAsyncHandler; -import org.sagebionetworks.web.client.widget.asynch.UserGroupHeaderAsyncHandlerImpl; -import org.sagebionetworks.web.client.widget.asynch.UserGroupHeaderFromAliasAsyncHandler; -import org.sagebionetworks.web.client.widget.asynch.UserGroupHeaderFromAliasAsyncHandlerImpl; -import org.sagebionetworks.web.client.widget.asynch.UserProfileAsyncHandler; -import org.sagebionetworks.web.client.widget.asynch.UserProfileAsyncHandlerImpl; -import org.sagebionetworks.web.client.widget.asynch.VersionedEntityHeaderAsyncHandler; -import org.sagebionetworks.web.client.widget.asynch.VersionedEntityHeaderAsyncHandlerImpl; +import org.sagebionetworks.web.client.widget.asynch.*; import org.sagebionetworks.web.client.widget.biodalliance13.BiodallianceWidgetView; import org.sagebionetworks.web.client.widget.biodalliance13.BiodallianceWidgetViewImpl; import org.sagebionetworks.web.client.widget.biodalliance13.editor.BiodallianceEditorView; @@ -206,246 +41,30 @@ import org.sagebionetworks.web.client.widget.biodalliance13.editor.BiodallianceSourceEditorViewImpl; import org.sagebionetworks.web.client.widget.breadcrumb.BreadcrumbView; import org.sagebionetworks.web.client.widget.breadcrumb.BreadcrumbViewImpl; -import org.sagebionetworks.web.client.widget.clienthelp.ContainerClientsHelp; -import org.sagebionetworks.web.client.widget.clienthelp.ContainerClientsHelpImpl; -import org.sagebionetworks.web.client.widget.clienthelp.FileClientsHelpView; -import org.sagebionetworks.web.client.widget.clienthelp.FileClientsHelpViewImpl; -import org.sagebionetworks.web.client.widget.clienthelp.FileViewClientsHelp; -import org.sagebionetworks.web.client.widget.clienthelp.FileViewClientsHelpImpl; +import org.sagebionetworks.web.client.widget.clienthelp.*; import org.sagebionetworks.web.client.widget.csv.PapaCSVParser; -import org.sagebionetworks.web.client.widget.discussion.DiscussionThreadListItemWidgetView; -import org.sagebionetworks.web.client.widget.discussion.DiscussionThreadListItemWidgetViewImpl; -import org.sagebionetworks.web.client.widget.discussion.DiscussionThreadListWidgetView; -import org.sagebionetworks.web.client.widget.discussion.DiscussionThreadListWidgetViewImpl; -import org.sagebionetworks.web.client.widget.discussion.ForumWidgetView; -import org.sagebionetworks.web.client.widget.discussion.ForumWidgetViewImpl; -import org.sagebionetworks.web.client.widget.discussion.NewReplyWidgetView; -import org.sagebionetworks.web.client.widget.discussion.NewReplyWidgetViewImpl; -import org.sagebionetworks.web.client.widget.discussion.ReplyWidgetView; -import org.sagebionetworks.web.client.widget.discussion.ReplyWidgetViewImpl; -import org.sagebionetworks.web.client.widget.discussion.SingleDiscussionThreadWidgetView; -import org.sagebionetworks.web.client.widget.discussion.SingleDiscussionThreadWidgetViewImpl; -import org.sagebionetworks.web.client.widget.discussion.SubscribersWidgetView; -import org.sagebionetworks.web.client.widget.discussion.SubscribersWidgetViewImpl; +import org.sagebionetworks.web.client.widget.discussion.*; import org.sagebionetworks.web.client.widget.discussion.modal.DiscussionThreadModalView; import org.sagebionetworks.web.client.widget.discussion.modal.DiscussionThreadModalViewImpl; import org.sagebionetworks.web.client.widget.discussion.modal.ReplyModalView; import org.sagebionetworks.web.client.widget.discussion.modal.ReplyModalViewImpl; -import org.sagebionetworks.web.client.widget.docker.DockerCommitListWidgetView; -import org.sagebionetworks.web.client.widget.docker.DockerCommitListWidgetViewImpl; -import org.sagebionetworks.web.client.widget.docker.DockerCommitRowWidgetView; -import org.sagebionetworks.web.client.widget.docker.DockerCommitRowWidgetViewImpl; -import org.sagebionetworks.web.client.widget.docker.DockerRepoListWidgetView; -import org.sagebionetworks.web.client.widget.docker.DockerRepoListWidgetViewImpl; -import org.sagebionetworks.web.client.widget.docker.DockerRepoWidgetView; -import org.sagebionetworks.web.client.widget.docker.DockerRepoWidgetViewImpl; +import org.sagebionetworks.web.client.widget.docker.*; import org.sagebionetworks.web.client.widget.docker.modal.AddExternalRepoModalView; import org.sagebionetworks.web.client.widget.docker.modal.AddExternalRepoModalViewImpl; import org.sagebionetworks.web.client.widget.doi.CreateOrUpdateDoiModalView; import org.sagebionetworks.web.client.widget.doi.CreateOrUpdateDoiModalViewImpl; import org.sagebionetworks.web.client.widget.doi.DoiWidgetV2View; import org.sagebionetworks.web.client.widget.doi.DoiWidgetV2ViewImpl; -import org.sagebionetworks.web.client.widget.entity.BigPromptModalView; -import org.sagebionetworks.web.client.widget.entity.BigPromptModalViewImpl; -import org.sagebionetworks.web.client.widget.entity.ChallengeBadgeView; -import org.sagebionetworks.web.client.widget.entity.ChallengeBadgeViewImpl; -import org.sagebionetworks.web.client.widget.entity.ContainerItemCountWidgetView; -import org.sagebionetworks.web.client.widget.entity.ContainerItemCountWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.EditFileMetadataModalView; -import org.sagebionetworks.web.client.widget.entity.EditFileMetadataModalViewImpl; -import org.sagebionetworks.web.client.widget.entity.EditFileMetadataModalWidget; -import org.sagebionetworks.web.client.widget.entity.EditFileMetadataModalWidgetImpl; -import org.sagebionetworks.web.client.widget.entity.EditProjectMetadataModalView; -import org.sagebionetworks.web.client.widget.entity.EditProjectMetadataModalViewImpl; -import org.sagebionetworks.web.client.widget.entity.EditProjectMetadataModalWidget; -import org.sagebionetworks.web.client.widget.entity.EditProjectMetadataModalWidgetImpl; -import org.sagebionetworks.web.client.widget.entity.EditRegisteredTeamDialogView; -import org.sagebionetworks.web.client.widget.entity.EditRegisteredTeamDialogViewImpl; -import org.sagebionetworks.web.client.widget.entity.EntityBadgeView; -import org.sagebionetworks.web.client.widget.entity.EntityBadgeViewImpl; -import org.sagebionetworks.web.client.widget.entity.EntityListRowBadgeView; -import org.sagebionetworks.web.client.widget.entity.EntityListRowBadgeViewImpl; -import org.sagebionetworks.web.client.widget.entity.EntityMetadataView; -import org.sagebionetworks.web.client.widget.entity.EntityMetadataViewImpl; -import org.sagebionetworks.web.client.widget.entity.EntityModalWidgetView; -import org.sagebionetworks.web.client.widget.entity.EntityModalWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.EntityPageTopView; -import org.sagebionetworks.web.client.widget.entity.EntityPageTopViewImpl; -import org.sagebionetworks.web.client.widget.entity.EntitySearchBoxView; -import org.sagebionetworks.web.client.widget.entity.EntitySearchBoxViewImpl; -import org.sagebionetworks.web.client.widget.entity.EntityViewScopeEditorModalWidgetView; -import org.sagebionetworks.web.client.widget.entity.EntityViewScopeEditorModalWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.FavoriteWidgetView; -import org.sagebionetworks.web.client.widget.entity.FavoriteWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.MarkdownEditorWidgetView; -import org.sagebionetworks.web.client.widget.entity.MarkdownEditorWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.MarkdownWidgetView; -import org.sagebionetworks.web.client.widget.entity.MarkdownWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.ModifiedCreatedByWidgetView; -import org.sagebionetworks.web.client.widget.entity.ModifiedCreatedByWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.MoreTreeItemView; -import org.sagebionetworks.web.client.widget.entity.MoreTreeItemViewImpl; -import org.sagebionetworks.web.client.widget.entity.PreviewWidgetView; -import org.sagebionetworks.web.client.widget.entity.PreviewWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.ProjectBadgeView; -import org.sagebionetworks.web.client.widget.entity.ProjectBadgeViewImpl; -import org.sagebionetworks.web.client.widget.entity.PromptForValuesModalConfigurationImpl; -import org.sagebionetworks.web.client.widget.entity.PromptForValuesModalView; -import org.sagebionetworks.web.client.widget.entity.PromptForValuesModalViewImpl; -import org.sagebionetworks.web.client.widget.entity.RegisterTeamDialogView; -import org.sagebionetworks.web.client.widget.entity.RegisterTeamDialogViewImpl; -import org.sagebionetworks.web.client.widget.entity.RenameEntityModalWidget; -import org.sagebionetworks.web.client.widget.entity.RenameEntityModalWidgetImpl; -import org.sagebionetworks.web.client.widget.entity.SharingAndDataUseConditionWidgetView; -import org.sagebionetworks.web.client.widget.entity.SharingAndDataUseConditionWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.SqlDefinedEditorModalWidgetView; -import org.sagebionetworks.web.client.widget.entity.SqlDefinedEditorModalWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.TutorialWizardView; -import org.sagebionetworks.web.client.widget.entity.TutorialWizardViewImpl; -import org.sagebionetworks.web.client.widget.entity.VersionHistoryRowView; -import org.sagebionetworks.web.client.widget.entity.VersionHistoryRowViewImpl; -import org.sagebionetworks.web.client.widget.entity.VersionHistoryWidgetView; -import org.sagebionetworks.web.client.widget.entity.VersionHistoryWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.WikiAttachmentsView; -import org.sagebionetworks.web.client.widget.entity.WikiAttachmentsViewImpl; -import org.sagebionetworks.web.client.widget.entity.WikiHistoryWidgetView; -import org.sagebionetworks.web.client.widget.entity.WikiHistoryWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.WikiMarkdownEditorView; -import org.sagebionetworks.web.client.widget.entity.WikiMarkdownEditorViewImpl; -import org.sagebionetworks.web.client.widget.entity.WikiPageDeleteConfirmationDialogView; -import org.sagebionetworks.web.client.widget.entity.WikiPageDeleteConfirmationDialogViewImpl; -import org.sagebionetworks.web.client.widget.entity.WikiPageWidgetView; -import org.sagebionetworks.web.client.widget.entity.WikiPageWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.act.ApproveUserAccessModalView; -import org.sagebionetworks.web.client.widget.entity.act.ApproveUserAccessModalViewImpl; -import org.sagebionetworks.web.client.widget.entity.act.RejectDataAccessRequestModalView; -import org.sagebionetworks.web.client.widget.entity.act.RejectDataAccessRequestModalViewImpl; -import org.sagebionetworks.web.client.widget.entity.act.RejectReasonView; -import org.sagebionetworks.web.client.widget.entity.act.RejectReasonViewImpl; -import org.sagebionetworks.web.client.widget.entity.act.RevokeUserAccessModalView; -import org.sagebionetworks.web.client.widget.entity.act.RevokeUserAccessModalViewImpl; -import org.sagebionetworks.web.client.widget.entity.act.UserBadgeListView; -import org.sagebionetworks.web.client.widget.entity.act.UserBadgeListViewImpl; -import org.sagebionetworks.web.client.widget.entity.annotation.AnnotationCellFactory; -import org.sagebionetworks.web.client.widget.entity.annotation.AnnotationCellFactoryImpl; -import org.sagebionetworks.web.client.widget.entity.annotation.AnnotationEditorView; -import org.sagebionetworks.web.client.widget.entity.annotation.AnnotationEditorViewImpl; -import org.sagebionetworks.web.client.widget.entity.annotation.AnnotationTransformer; -import org.sagebionetworks.web.client.widget.entity.annotation.AnnotationTransformerImpl; -import org.sagebionetworks.web.client.widget.entity.annotation.AnnotationsRendererWidgetView; -import org.sagebionetworks.web.client.widget.entity.annotation.AnnotationsRendererWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.annotation.EditAnnotationsDialogView; -import org.sagebionetworks.web.client.widget.entity.annotation.EditAnnotationsDialogViewImpl; -import org.sagebionetworks.web.client.widget.entity.browse.EntityFinderWidget; -import org.sagebionetworks.web.client.widget.entity.browse.EntityFinderWidgetImpl; -import org.sagebionetworks.web.client.widget.entity.browse.EntityFinderWidgetView; -import org.sagebionetworks.web.client.widget.entity.browse.EntityFinderWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.browse.EntityTreeBrowserView; -import org.sagebionetworks.web.client.widget.entity.browse.EntityTreeBrowserViewImpl; -import org.sagebionetworks.web.client.widget.entity.browse.FilesBrowserView; -import org.sagebionetworks.web.client.widget.entity.browse.FilesBrowserViewImpl; -import org.sagebionetworks.web.client.widget.entity.browse.MyEntitiesBrowserView; -import org.sagebionetworks.web.client.widget.entity.browse.MyEntitiesBrowserViewImpl; -import org.sagebionetworks.web.client.widget.entity.controller.CertifiedUserController; -import org.sagebionetworks.web.client.widget.entity.controller.CertifiedUserControllerImpl; -import org.sagebionetworks.web.client.widget.entity.controller.EntityActionController; -import org.sagebionetworks.web.client.widget.entity.controller.EntityActionControllerImpl; -import org.sagebionetworks.web.client.widget.entity.controller.EntityActionControllerView; -import org.sagebionetworks.web.client.widget.entity.controller.EntityActionControllerViewImpl; -import org.sagebionetworks.web.client.widget.entity.controller.EntityRefProvEntryView; -import org.sagebionetworks.web.client.widget.entity.controller.EntityRefProvEntryViewImpl; -import org.sagebionetworks.web.client.widget.entity.controller.PreflightController; -import org.sagebionetworks.web.client.widget.entity.controller.PreflightControllerImpl; -import org.sagebionetworks.web.client.widget.entity.controller.ProvenanceEditorWidgetView; -import org.sagebionetworks.web.client.widget.entity.controller.ProvenanceEditorWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.controller.ProvenanceListWidgetView; -import org.sagebionetworks.web.client.widget.entity.controller.ProvenanceListWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.controller.ProvenanceURLDialogWidgetView; -import org.sagebionetworks.web.client.widget.entity.controller.ProvenanceURLDialogWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.controller.StorageLocationWidgetView; -import org.sagebionetworks.web.client.widget.entity.controller.StorageLocationWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.controller.StuAlertView; -import org.sagebionetworks.web.client.widget.entity.controller.StuAlertViewImpl; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlertImpl; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlertView; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlertViewImpl; -import org.sagebionetworks.web.client.widget.entity.controller.URLProvEntryView; -import org.sagebionetworks.web.client.widget.entity.controller.URLProvEntryViewImpl; +import org.sagebionetworks.web.client.widget.entity.*; +import org.sagebionetworks.web.client.widget.entity.act.*; +import org.sagebionetworks.web.client.widget.entity.annotation.*; +import org.sagebionetworks.web.client.widget.entity.browse.*; +import org.sagebionetworks.web.client.widget.entity.controller.*; import org.sagebionetworks.web.client.widget.entity.dialog.BaseEditWidgetDescriptorView; import org.sagebionetworks.web.client.widget.entity.dialog.BaseEditWidgetDescriptorViewImpl; -import org.sagebionetworks.web.client.widget.entity.download.AddFolderDialogWidgetView; -import org.sagebionetworks.web.client.widget.entity.download.AddFolderDialogWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.download.AwsLoginView; -import org.sagebionetworks.web.client.widget.entity.download.AwsLoginViewImpl; -import org.sagebionetworks.web.client.widget.entity.download.CertificateWidgetView; -import org.sagebionetworks.web.client.widget.entity.download.CertificateWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.download.QuizInfoViewImpl; -import org.sagebionetworks.web.client.widget.entity.download.QuizInfoWidgetView; -import org.sagebionetworks.web.client.widget.entity.download.UploadDialogWidgetView; -import org.sagebionetworks.web.client.widget.entity.download.UploadDialogWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.download.UploaderView; -import org.sagebionetworks.web.client.widget.entity.download.UploaderViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.APITableColumnConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.APITableColumnConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.APITableColumnManagerView; -import org.sagebionetworks.web.client.widget.entity.editor.APITableColumnManagerViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.APITableConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.APITableConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.AttachmentConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.AttachmentConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.ButtonLinkConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.ButtonLinkConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.CytoscapeConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.CytoscapeConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.DetailsSummaryConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.DetailsSummaryConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.EntityListConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.EntityListConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.EvaluationSubmissionConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.EvaluationSubmissionConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.ImageConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.ImageConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.ImageParamsPanelView; -import org.sagebionetworks.web.client.widget.entity.editor.ImageParamsPanelViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.LinkConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.LinkConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.PlotlyConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.PlotlyConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.PreviewConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.PreviewConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.ProvenanceConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.ProvenanceConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.QueryTableConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.QueryTableConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.ReferenceConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.ReferenceConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.ShinySiteConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.ShinySiteConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.SynapseFormConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.SynapseFormConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.TabbedTableConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.TabbedTableConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.TableQueryResultWikiView; -import org.sagebionetworks.web.client.widget.entity.editor.TableQueryResultWikiViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.TeamSelectEditorView; -import org.sagebionetworks.web.client.widget.entity.editor.TeamSelectEditorViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.UserSelectorView; -import org.sagebionetworks.web.client.widget.entity.editor.UserSelectorViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.UserTeamConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.UserTeamConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.editor.VideoConfigView; -import org.sagebionetworks.web.client.widget.entity.editor.VideoConfigViewImpl; -import org.sagebionetworks.web.client.widget.entity.file.AddToDownloadListV2; -import org.sagebionetworks.web.client.widget.entity.file.AddToDownloadListV2Impl; -import org.sagebionetworks.web.client.widget.entity.file.BasicTitleBarView; -import org.sagebionetworks.web.client.widget.entity.file.BasicTitleBarViewImpl; -import org.sagebionetworks.web.client.widget.entity.file.FileDownloadMenuItemView; -import org.sagebionetworks.web.client.widget.entity.file.FileDownloadMenuItemViewImpl; -import org.sagebionetworks.web.client.widget.entity.file.ProjectTitleBarView; -import org.sagebionetworks.web.client.widget.entity.file.ProjectTitleBarViewImpl; -import org.sagebionetworks.web.client.widget.entity.file.S3DirectLoginDialog; -import org.sagebionetworks.web.client.widget.entity.file.S3DirectLoginDialogImpl; +import org.sagebionetworks.web.client.widget.entity.download.*; +import org.sagebionetworks.web.client.widget.entity.editor.*; +import org.sagebionetworks.web.client.widget.entity.file.*; import org.sagebionetworks.web.client.widget.entity.file.downloadlist.PackageSizeSummaryView; import org.sagebionetworks.web.client.widget.entity.file.downloadlist.PackageSizeSummaryViewImpl; import org.sagebionetworks.web.client.widget.entity.menu.v3.EntityActionMenu; @@ -454,92 +73,11 @@ import org.sagebionetworks.web.client.widget.entity.menu.v3.EntityActionMenuViewImpl; import org.sagebionetworks.web.client.widget.entity.registration.WidgetRegistrar; import org.sagebionetworks.web.client.widget.entity.registration.WidgetRegistrarImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.AttachmentPreviewWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.AttachmentPreviewWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.BookmarkWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.BookmarkWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.ButtonLinkWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.ButtonLinkWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.ChallengeTeamsView; -import org.sagebionetworks.web.client.widget.entity.renderer.ChallengeTeamsViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.CytoscapeView; -import org.sagebionetworks.web.client.widget.entity.renderer.CytoscapeViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.EmptyWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.EmptyWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.EntityListWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.EntityListWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.HtmlPreviewView; -import org.sagebionetworks.web.client.widget.entity.renderer.HtmlPreviewViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.IFrameView; -import org.sagebionetworks.web.client.widget.entity.renderer.IFrameViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.ImageWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.ImageWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.IntendedDataUseReportWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.IntendedDataUseReportWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.NbConvertPreviewView; -import org.sagebionetworks.web.client.widget.entity.renderer.NbConvertPreviewViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.PlotlyWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.PlotlyWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.ReferenceWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.ReferenceWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.SingleButtonView; -import org.sagebionetworks.web.client.widget.entity.renderer.SingleButtonViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.SubmitToEvaluationWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.SubmitToEvaluationWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.SynapseTableFormWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.SynapseTableFormWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.TIFFPreviewWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.TIFFPreviewWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.TableOfContentsWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.TableOfContentsWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.TeamMemberCountView; -import org.sagebionetworks.web.client.widget.entity.renderer.TeamMemberCountViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.UserListRowWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.UserListRowWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.UserListView; -import org.sagebionetworks.web.client.widget.entity.renderer.UserListViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.VideoWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.VideoWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.WikiFilesPreviewWidgetView; -import org.sagebionetworks.web.client.widget.entity.renderer.WikiFilesPreviewWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.WikiSubpageNavigationTreeView; -import org.sagebionetworks.web.client.widget.entity.renderer.WikiSubpageNavigationTreeViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.WikiSubpageOrderEditorTreeView; -import org.sagebionetworks.web.client.widget.entity.renderer.WikiSubpageOrderEditorTreeViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.WikiSubpagesOrderEditorView; -import org.sagebionetworks.web.client.widget.entity.renderer.WikiSubpagesOrderEditorViewImpl; -import org.sagebionetworks.web.client.widget.entity.renderer.WikiSubpagesView; -import org.sagebionetworks.web.client.widget.entity.renderer.WikiSubpagesViewImpl; +import org.sagebionetworks.web.client.widget.entity.renderer.*; import org.sagebionetworks.web.client.widget.entity.restriction.v2.RestrictionWidgetView; import org.sagebionetworks.web.client.widget.entity.restriction.v2.RestrictionWidgetViewImpl; -import org.sagebionetworks.web.client.widget.entity.tabs.ChallengeTabView; -import org.sagebionetworks.web.client.widget.entity.tabs.ChallengeTabViewImpl; -import org.sagebionetworks.web.client.widget.entity.tabs.DiscussionTabView; -import org.sagebionetworks.web.client.widget.entity.tabs.DiscussionTabViewImpl; -import org.sagebionetworks.web.client.widget.entity.tabs.DockerTabView; -import org.sagebionetworks.web.client.widget.entity.tabs.DockerTabViewImpl; -import org.sagebionetworks.web.client.widget.entity.tabs.FilesTabView; -import org.sagebionetworks.web.client.widget.entity.tabs.FilesTabViewImpl; -import org.sagebionetworks.web.client.widget.entity.tabs.TabView; -import org.sagebionetworks.web.client.widget.entity.tabs.TabViewImpl; -import org.sagebionetworks.web.client.widget.entity.tabs.TablesTabView; -import org.sagebionetworks.web.client.widget.entity.tabs.TablesTabViewImpl; -import org.sagebionetworks.web.client.widget.entity.tabs.TabsView; -import org.sagebionetworks.web.client.widget.entity.tabs.TabsViewImpl; -import org.sagebionetworks.web.client.widget.evaluation.AdministerEvaluationsListView; -import org.sagebionetworks.web.client.widget.evaluation.AdministerEvaluationsListViewImpl; -import org.sagebionetworks.web.client.widget.evaluation.ChallengeWidgetView; -import org.sagebionetworks.web.client.widget.evaluation.ChallengeWidgetViewImpl; -import org.sagebionetworks.web.client.widget.evaluation.EvaluationEditorModalView; -import org.sagebionetworks.web.client.widget.evaluation.EvaluationEditorModalViewImpl; -import org.sagebionetworks.web.client.widget.evaluation.EvaluationFinderView; -import org.sagebionetworks.web.client.widget.evaluation.EvaluationFinderViewImpl; -import org.sagebionetworks.web.client.widget.evaluation.EvaluationListView; -import org.sagebionetworks.web.client.widget.evaluation.EvaluationListViewImpl; -import org.sagebionetworks.web.client.widget.evaluation.EvaluationSubmitterView; -import org.sagebionetworks.web.client.widget.evaluation.EvaluationSubmitterViewImpl; -import org.sagebionetworks.web.client.widget.evaluation.SubmissionViewScopeEditorModalWidgetView; -import org.sagebionetworks.web.client.widget.evaluation.SubmissionViewScopeEditorModalWidgetViewImpl; +import org.sagebionetworks.web.client.widget.entity.tabs.*; +import org.sagebionetworks.web.client.widget.evaluation.*; import org.sagebionetworks.web.client.widget.footer.Footer; import org.sagebionetworks.web.client.widget.footer.FooterView; import org.sagebionetworks.web.client.widget.footer.FooterViewImpl; @@ -562,18 +100,7 @@ import org.sagebionetworks.web.client.widget.pageprogress.PageProgressWidgetViewImpl; import org.sagebionetworks.web.client.widget.pagination.BasicPaginationView; import org.sagebionetworks.web.client.widget.pagination.BasicPaginationViewImpl; -import org.sagebionetworks.web.client.widget.profile.EmailAddressesWidgetView; -import org.sagebionetworks.web.client.widget.profile.EmailAddressesWidgetViewImpl; -import org.sagebionetworks.web.client.widget.profile.ProfileCertifiedValidatedView; -import org.sagebionetworks.web.client.widget.profile.ProfileCertifiedValidatedViewImpl; -import org.sagebionetworks.web.client.widget.profile.ProfileImageView; -import org.sagebionetworks.web.client.widget.profile.ProfileImageViewImpl; -import org.sagebionetworks.web.client.widget.profile.ProfileImageWidget; -import org.sagebionetworks.web.client.widget.profile.ProfileImageWidgetImpl; -import org.sagebionetworks.web.client.widget.profile.UserProfileEditorWidget; -import org.sagebionetworks.web.client.widget.profile.UserProfileEditorWidgetImpl; -import org.sagebionetworks.web.client.widget.profile.UserProfileEditorWidgetView; -import org.sagebionetworks.web.client.widget.profile.UserProfileEditorWidgetViewImpl; +import org.sagebionetworks.web.client.widget.profile.*; import org.sagebionetworks.web.client.widget.provenance.v2.ProvenanceWidgetView; import org.sagebionetworks.web.client.widget.provenance.v2.ProvenanceWidgetViewImpl; import org.sagebionetworks.web.client.widget.refresh.RefreshAlertView; @@ -582,20 +109,7 @@ import org.sagebionetworks.web.client.widget.search.SearchBoxViewImpl; import org.sagebionetworks.web.client.widget.search.SynapseSuggestBoxView; import org.sagebionetworks.web.client.widget.search.SynapseSuggestBoxViewImpl; -import org.sagebionetworks.web.client.widget.sharing.AccessControlListEditorView; -import org.sagebionetworks.web.client.widget.sharing.AccessControlListEditorViewImpl; -import org.sagebionetworks.web.client.widget.sharing.AccessControlListModalWidget; -import org.sagebionetworks.web.client.widget.sharing.AccessControlListModalWidgetImpl; -import org.sagebionetworks.web.client.widget.sharing.AccessControlListModalWidgetView; -import org.sagebionetworks.web.client.widget.sharing.AccessControlListModalWidgetViewImpl; -import org.sagebionetworks.web.client.widget.sharing.EvaluationAccessControlListModalWidget; -import org.sagebionetworks.web.client.widget.sharing.EvaluationAccessControlListModalWidgetImpl; -import org.sagebionetworks.web.client.widget.sharing.OpenDataView; -import org.sagebionetworks.web.client.widget.sharing.OpenDataViewImpl; -import org.sagebionetworks.web.client.widget.sharing.PublicPrivateBadgeView; -import org.sagebionetworks.web.client.widget.sharing.PublicPrivateBadgeViewImpl; -import org.sagebionetworks.web.client.widget.sharing.SharingPermissionsGridView; -import org.sagebionetworks.web.client.widget.sharing.SharingPermissionsGridViewImpl; +import org.sagebionetworks.web.client.widget.sharing.*; import org.sagebionetworks.web.client.widget.statistics.StatisticsPlotWidgetView; import org.sagebionetworks.web.client.widget.statistics.StatisticsPlotWidgetViewImpl; import org.sagebionetworks.web.client.widget.subscription.SubscribeButtonWidgetView; @@ -606,163 +120,20 @@ import org.sagebionetworks.web.client.widget.table.TableListWidgetViewImpl; import org.sagebionetworks.web.client.widget.table.api.APITableWidgetView; import org.sagebionetworks.web.client.widget.table.api.APITableWidgetViewImpl; -import org.sagebionetworks.web.client.widget.table.modal.download.CreateDownloadPage; -import org.sagebionetworks.web.client.widget.table.modal.download.CreateDownloadPageImpl; -import org.sagebionetworks.web.client.widget.table.modal.download.CreateDownloadPageView; -import org.sagebionetworks.web.client.widget.table.modal.download.CreateDownloadPageViewImpl; -import org.sagebionetworks.web.client.widget.table.modal.download.DownloadFilePage; -import org.sagebionetworks.web.client.widget.table.modal.download.DownloadFilePageImpl; -import org.sagebionetworks.web.client.widget.table.modal.download.DownloadFilePageView; -import org.sagebionetworks.web.client.widget.table.modal.download.DownloadFilePageViewImpl; -import org.sagebionetworks.web.client.widget.table.modal.download.DownloadTableQueryModalWidget; -import org.sagebionetworks.web.client.widget.table.modal.download.DownloadTableQueryModalWidgetImpl; -import org.sagebionetworks.web.client.widget.table.modal.fileview.EntityContainerListWidgetView; -import org.sagebionetworks.web.client.widget.table.modal.fileview.EntityContainerListWidgetViewImpl; -import org.sagebionetworks.web.client.widget.table.modal.fileview.EntityViewScopeWidgetView; -import org.sagebionetworks.web.client.widget.table.modal.fileview.EntityViewScopeWidgetViewImpl; -import org.sagebionetworks.web.client.widget.table.modal.fileview.SubmissionViewScopeWidgetView; -import org.sagebionetworks.web.client.widget.table.modal.fileview.SubmissionViewScopeWidgetViewImpl; -import org.sagebionetworks.web.client.widget.table.modal.fileview.ViewDefaultColumns; -import org.sagebionetworks.web.client.widget.table.modal.upload.CSVOptionsView; -import org.sagebionetworks.web.client.widget.table.modal.upload.CSVOptionsViewImpl; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVAppendPage; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVAppendPageImpl; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVAppendPageView; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVAppendPageViewImpl; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVFilePage; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVFilePageImpl; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVFinishPage; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVFinishPageImpl; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVFinishPageView; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVFinishPageViewImpl; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVPreviewPage; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVPreviewPageImpl; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVPreviewPageView; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadCSVPreviewPageViewImpl; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadPreviewView; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadPreviewViewImpl; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadPreviewWidget; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadPreviewWidgetImpl; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadTableModalWidget; -import org.sagebionetworks.web.client.widget.table.modal.upload.UploadTableModalWidgetImpl; +import org.sagebionetworks.web.client.widget.table.modal.download.*; +import org.sagebionetworks.web.client.widget.table.modal.fileview.*; +import org.sagebionetworks.web.client.widget.table.modal.upload.*; import org.sagebionetworks.web.client.widget.table.modal.wizard.ModalWizardView; import org.sagebionetworks.web.client.widget.table.modal.wizard.ModalWizardViewImpl; import org.sagebionetworks.web.client.widget.table.modal.wizard.ModalWizardWidget; import org.sagebionetworks.web.client.widget.table.modal.wizard.ModalWizardWidgetImpl; -import org.sagebionetworks.web.client.widget.table.v2.QueryInputView; -import org.sagebionetworks.web.client.widget.table.v2.QueryInputViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.TableEntityWidgetView; -import org.sagebionetworks.web.client.widget.table.v2.TableEntityWidgetViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.TotalVisibleResultsWidgetView; -import org.sagebionetworks.web.client.widget.table.v2.TotalVisibleResultsWidgetViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.QueryResultEditorView; -import org.sagebionetworks.web.client.widget.table.v2.results.QueryResultEditorViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.RowFormView; -import org.sagebionetworks.web.client.widget.table.v2.results.RowFormViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.RowView; -import org.sagebionetworks.web.client.widget.table.v2.results.RowViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.SortableTableHeader; -import org.sagebionetworks.web.client.widget.table.v2.results.SortableTableHeaderImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.StaticTableHeader; -import org.sagebionetworks.web.client.widget.table.v2.results.StaticTableHeaderImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.TablePageView; -import org.sagebionetworks.web.client.widget.table.v2.results.TablePageViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.TableQueryResultWikiWidgetView; -import org.sagebionetworks.web.client.widget.table.v2.results.TableQueryResultWikiWidgetViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.CellEditorView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.CellEditorViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.DateCellEditorView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.DateCellEditorViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.DateListRendererCellView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.DateListRendererCellViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.EditJSONListModalView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.EditJSONListModalViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.EntityIdCellRendererView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.EntityIdCellRendererViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.EntityIdListRendererCellView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.EntityIdListRendererCellViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.FileCellEditorView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.FileCellEditorViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.FileCellRendererView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.FileCellRendererViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.JSONListCellEditorView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.JSONListCellEditorViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.LargeStringCellEditorView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.LargeStringCellEditorViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.LinkCellRendererView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.LinkCellRendererViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.ListCellEditorView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.ListCellEditorViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.NumberCellEditorView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.NumberCellEditorViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.RadioCellEditorView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.RadioCellEditorViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.StringListRendererCellView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.StringListRendererCellViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.StringRendererCellView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.StringRendererCellViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.UserIdCellEditorView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.UserIdCellEditorViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.UserIdListRendererCellView; -import org.sagebionetworks.web.client.widget.table.v2.results.cell.UserIdListRendererCellViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.schema.ColumnModelTableRowEditorView; -import org.sagebionetworks.web.client.widget.table.v2.schema.ColumnModelTableRowEditorViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.schema.ColumnModelTableRowEditorWidget; -import org.sagebionetworks.web.client.widget.table.v2.schema.ColumnModelTableRowEditorWidgetImpl; -import org.sagebionetworks.web.client.widget.table.v2.schema.ColumnModelTableRowViewer; -import org.sagebionetworks.web.client.widget.table.v2.schema.ColumnModelTableRowViewerImpl; -import org.sagebionetworks.web.client.widget.table.v2.schema.ColumnModelsEditorWidgetView; -import org.sagebionetworks.web.client.widget.table.v2.schema.ColumnModelsEditorWidgetViewImpl; -import org.sagebionetworks.web.client.widget.table.v2.schema.ColumnModelsView; -import org.sagebionetworks.web.client.widget.table.v2.schema.ColumnModelsViewImpl; -import org.sagebionetworks.web.client.widget.team.BigTeamBadgeView; -import org.sagebionetworks.web.client.widget.team.BigTeamBadgeViewImpl; -import org.sagebionetworks.web.client.widget.team.EmailInvitationBadgeView; -import org.sagebionetworks.web.client.widget.team.EmailInvitationBadgeViewImpl; -import org.sagebionetworks.web.client.widget.team.InviteWidgetView; -import org.sagebionetworks.web.client.widget.team.InviteWidgetViewImpl; -import org.sagebionetworks.web.client.widget.team.JoinTeamConfigEditorView; -import org.sagebionetworks.web.client.widget.team.JoinTeamConfigEditorViewImpl; -import org.sagebionetworks.web.client.widget.team.JoinTeamWidgetView; -import org.sagebionetworks.web.client.widget.team.JoinTeamWidgetViewImpl; -import org.sagebionetworks.web.client.widget.team.MemberListWidgetView; -import org.sagebionetworks.web.client.widget.team.MemberListWidgetViewImpl; -import org.sagebionetworks.web.client.widget.team.OpenMembershipRequestsWidgetView; -import org.sagebionetworks.web.client.widget.team.OpenMembershipRequestsWidgetViewImpl; -import org.sagebionetworks.web.client.widget.team.OpenTeamInvitationsWidgetView; -import org.sagebionetworks.web.client.widget.team.OpenTeamInvitationsWidgetViewImpl; -import org.sagebionetworks.web.client.widget.team.OpenUserInvitationsWidgetView; -import org.sagebionetworks.web.client.widget.team.OpenUserInvitationsWidgetViewImpl; -import org.sagebionetworks.web.client.widget.team.SelectTeamModalView; -import org.sagebionetworks.web.client.widget.team.SelectTeamModalViewImpl; -import org.sagebionetworks.web.client.widget.team.TeamBadgeView; -import org.sagebionetworks.web.client.widget.team.TeamBadgeViewImpl; -import org.sagebionetworks.web.client.widget.team.TeamListWidgetView; -import org.sagebionetworks.web.client.widget.team.TeamListWidgetViewImpl; -import org.sagebionetworks.web.client.widget.team.WizardProgressWidgetView; -import org.sagebionetworks.web.client.widget.team.WizardProgressWidgetViewImpl; -import org.sagebionetworks.web.client.widget.team.controller.TeamDeleteModalWidgetView; -import org.sagebionetworks.web.client.widget.team.controller.TeamDeleteModalWidgetViewImpl; -import org.sagebionetworks.web.client.widget.team.controller.TeamEditModalWidgetView; -import org.sagebionetworks.web.client.widget.team.controller.TeamEditModalWidgetViewImpl; -import org.sagebionetworks.web.client.widget.team.controller.TeamLeaveModalWidgetView; -import org.sagebionetworks.web.client.widget.team.controller.TeamLeaveModalWidgetViewImpl; -import org.sagebionetworks.web.client.widget.team.controller.TeamProjectsModalWidgetView; -import org.sagebionetworks.web.client.widget.team.controller.TeamProjectsModalWidgetViewImpl; -import org.sagebionetworks.web.client.widget.upload.FileHandleListView; -import org.sagebionetworks.web.client.widget.upload.FileHandleListViewImpl; -import org.sagebionetworks.web.client.widget.upload.FileHandleUploadView; -import org.sagebionetworks.web.client.widget.upload.FileHandleUploadViewImpl; -import org.sagebionetworks.web.client.widget.upload.FileHandleUploadWidget; -import org.sagebionetworks.web.client.widget.upload.FileHandleUploadWidgetImpl; -import org.sagebionetworks.web.client.widget.upload.FileInputView; -import org.sagebionetworks.web.client.widget.upload.FileInputViewImpl; -import org.sagebionetworks.web.client.widget.upload.ImageUploadView; -import org.sagebionetworks.web.client.widget.upload.ImageUploadViewImpl; -import org.sagebionetworks.web.client.widget.upload.MultipartUploader; -import org.sagebionetworks.web.client.widget.upload.MultipartUploaderImplV2; -import org.sagebionetworks.web.client.widget.upload.SRCUploadFileWrapper; -import org.sagebionetworks.web.client.widget.upload.SRCUploadFileWrapperImpl; +import org.sagebionetworks.web.client.widget.table.v2.*; +import org.sagebionetworks.web.client.widget.table.v2.results.*; +import org.sagebionetworks.web.client.widget.table.v2.results.cell.*; +import org.sagebionetworks.web.client.widget.table.v2.schema.*; +import org.sagebionetworks.web.client.widget.team.*; +import org.sagebionetworks.web.client.widget.team.controller.*; +import org.sagebionetworks.web.client.widget.upload.*; import org.sagebionetworks.web.client.widget.user.UserBadgeView; import org.sagebionetworks.web.client.widget.user.UserBadgeViewImpl; @@ -872,9 +243,6 @@ protected void configure() { // ProfileView bind(ProfileView.class).to(ProfileViewImpl.class).in(Singleton.class); - // SettingsView - bind(SettingsView.class).to(SettingsViewImpl.class).in(Singleton.class); - // CominSoonView bind(ComingSoonView.class).to(ComingSoonViewImpl.class).in(Singleton.class); @@ -1587,7 +955,6 @@ protected void configure() { bind(EvaluationFinderView.class).to(EvaluationFinderViewImpl.class); bind(SubmissionViewScopeWidgetView.class) .to(SubmissionViewScopeWidgetViewImpl.class); - bind(PersonalAccessTokensView.class).to(PersonalAccessTokensViewImpl.class); bind(PageProgressWidgetView.class).to(PageProgressWidgetViewImpl.class); bind(EntityFinderWidget.class).to(EntityFinderWidgetImpl.class); bind(EntityFinderWidget.Builder.class) @@ -1606,10 +973,6 @@ protected void configure() { .to(IntendedDataUseReportWidgetViewImpl.class); bind(DialogView.class).to(Dialog.class); - bind(TwoFactorAuthView.class) - .to(TwoFactorAuthViewImpl.class) - .in(Singleton.class); - bind(FollowingPageView.class) .to(FollowingPageViewImpl.class) .in(Singleton.class); diff --git a/src/main/java/org/sagebionetworks/web/client/jsinterop/AccessTokenPageProps.java b/src/main/java/org/sagebionetworks/web/client/jsinterop/AccessTokenPageProps.java deleted file mode 100644 index d6d276cef3..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/jsinterop/AccessTokenPageProps.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.sagebionetworks.web.client.jsinterop; - -import jsinterop.annotations.JsOverlay; -import jsinterop.annotations.JsPackage; -import jsinterop.annotations.JsType; - -@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") -public class AccessTokenPageProps extends ReactComponentProps { - - public String title; - - public String body; - - @JsOverlay - public static AccessTokenPageProps create(String title, String body) { - AccessTokenPageProps props = new AccessTokenPageProps(); - props.title = title; - props.body = body; - return props; - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/jsinterop/SRC.java b/src/main/java/org/sagebionetworks/web/client/jsinterop/SRC.java index 0ad8164b48..dd31226bb4 100644 --- a/src/main/java/org/sagebionetworks/web/client/jsinterop/SRC.java +++ b/src/main/java/org/sagebionetworks/web/client/jsinterop/SRC.java @@ -24,7 +24,6 @@ public static class SynapseComponents { public static ReactComponentType< EvaluationEditorPageProps > EvaluationEditorPage; - public static ReactComponentType AccessTokenPage; public static ReactComponentType DownloadCartPage; public static ReactComponentType< DownloadConfirmationProps @@ -80,15 +79,6 @@ public static class SynapseComponents { public static ReactComponentType< CreatedByModifiedByProps > CreatedByModifiedBy; - public static ReactComponentType< - TwoFactorAuthSettingsPanelProps - > TwoFactorAuthSettingsPanel; - public static ReactComponentType< - TwoFactorBackupCodesProps - > TwoFactorBackupCodes; - public static ReactComponentType< - TwoFactorEnrollmentFormProps - > TwoFactorEnrollmentForm; public static ReactComponentType SubscriptionPage; public static ReactComponentType< AccessRequirementListProps diff --git a/src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorAuthSettingsPanelProps.java b/src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorAuthSettingsPanelProps.java deleted file mode 100644 index cbc8f34d17..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorAuthSettingsPanelProps.java +++ /dev/null @@ -1,32 +0,0 @@ -package org.sagebionetworks.web.client.jsinterop; - -import jsinterop.annotations.JsFunction; -import jsinterop.annotations.JsOverlay; -import jsinterop.annotations.JsPackage; -import jsinterop.annotations.JsType; - -@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") -public class TwoFactorAuthSettingsPanelProps extends ReactComponentProps { - - @JsFunction - public interface Callback { - void run(); - } - - Callback onBeginTwoFactorEnrollment; - Callback onRegenerateBackupCodes; - boolean hideTitle; - - @JsOverlay - public static TwoFactorAuthSettingsPanelProps create( - Callback onBeginTwoFactorEnrollment, - Callback onRegenerateBackupCodes - ) { - TwoFactorAuthSettingsPanelProps props = - new TwoFactorAuthSettingsPanelProps(); - props.onBeginTwoFactorEnrollment = onBeginTwoFactorEnrollment; - props.onRegenerateBackupCodes = onRegenerateBackupCodes; - props.hideTitle = true; // always true in SWC - return props; - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorBackupCodesProps.java b/src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorBackupCodesProps.java deleted file mode 100644 index 09ba934f11..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorBackupCodesProps.java +++ /dev/null @@ -1,31 +0,0 @@ -package org.sagebionetworks.web.client.jsinterop; - -import jsinterop.annotations.JsFunction; -import jsinterop.annotations.JsOverlay; -import jsinterop.annotations.JsPackage; -import jsinterop.annotations.JsType; - -@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") -public class TwoFactorBackupCodesProps extends ReactComponentProps { - - @JsFunction - public interface Callback { - void run(); - } - - /* Whether to show a warning before generating new codes, to prevent users from overwriting their existing codes */ - boolean showReplaceOldCodesWarning; - /* Invoked when the user decides not to generate new codes, or has acknowledged new codes. */ - Callback onClose; - - @JsOverlay - public static TwoFactorBackupCodesProps create( - boolean showReplaceOldCodesWarning, - Callback onClose - ) { - TwoFactorBackupCodesProps props = new TwoFactorBackupCodesProps(); - props.showReplaceOldCodesWarning = showReplaceOldCodesWarning; - props.onClose = onClose; - return props; - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorEnrollmentFormProps.java b/src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorEnrollmentFormProps.java deleted file mode 100644 index 5249c6e66e..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/jsinterop/TwoFactorEnrollmentFormProps.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.sagebionetworks.web.client.jsinterop; - -import jsinterop.annotations.JsFunction; -import jsinterop.annotations.JsOverlay; -import jsinterop.annotations.JsPackage; -import jsinterop.annotations.JsType; - -@JsType(isNative = true, namespace = JsPackage.GLOBAL, name = "Object") -public class TwoFactorEnrollmentFormProps extends ReactComponentProps { - - @JsFunction - public interface Callback { - void run(); - } - - Callback onTwoFactorEnrollmentSuccess; - - @JsOverlay - public static TwoFactorEnrollmentFormProps create( - Callback onTwoFactorEnrollmentSuccess - ) { - TwoFactorEnrollmentFormProps props = new TwoFactorEnrollmentFormProps(); - props.onTwoFactorEnrollmentSuccess = onTwoFactorEnrollmentSuccess; - return props; - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/place/Synapse.java b/src/main/java/org/sagebionetworks/web/client/place/Synapse.java index 9b2853684b..606974ec09 100644 --- a/src/main/java/org/sagebionetworks/web/client/place/Synapse.java +++ b/src/main/java/org/sagebionetworks/web/client/place/Synapse.java @@ -171,6 +171,7 @@ public static enum ProfileArea { PROJECTS, CHALLENGES, TEAMS, + /* The Settings area now automatically redirects to OneSage */ SETTINGS, } diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/AccountPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/AccountPresenter.java index 23a4a192cd..aab5608904 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/AccountPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/AccountPresenter.java @@ -79,9 +79,7 @@ public void onSuccess(Void result) { view.showInfo(DisplayConstants.EMAIL_SUCCESS); globalAppState .getPlaceChanger() - .goTo( - new Profile(Profile.VIEW_PROFILE_TOKEN, ProfileArea.SETTINGS) - ); + .goTo(new Profile(Profile.VIEW_PROFILE_TOKEN, ProfileArea.PROFILE)); } @Override diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/EmailInvitationPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/EmailInvitationPresenter.java index 5dedd86fba..4ee8a71d5d 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/EmailInvitationPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/EmailInvitationPresenter.java @@ -21,10 +21,8 @@ import org.sagebionetworks.repo.model.SignedTokenInterface; import org.sagebionetworks.repo.model.Team; import org.sagebionetworks.repo.model.UserProfile; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.PlaceChanger; -import org.sagebionetworks.web.client.SynapseClientAsync; -import org.sagebionetworks.web.client.SynapseJavascriptClient; +import org.sagebionetworks.web.client.*; +import org.sagebionetworks.web.client.jsinterop.ToastMessageOptions; import org.sagebionetworks.web.client.place.EmailInvitation; import org.sagebionetworks.web.client.place.LoginPlace; import org.sagebionetworks.web.client.place.Profile; @@ -148,18 +146,19 @@ public void onFailure(Throwable t) { view.hideLoading(); if (t instanceof ForbiddenException) { // SWC-4721: fix message in the case where membership invitation email is not associated to the - // currently logged in user + // currently logged-in user view.showErrorMessage( "This invitation was sent to an email address not associated to the current user. \"" + membershipInvitation.getInviteeEmail() + - "\" Please add this email to your Synapse account under \"Settings\", or log in with the correct Synapse account before accepting the invitation." + "\" Please add this email to your Synapse account under \"Edit Profile\", or log in with the correct Synapse account before accepting the invitation." ); - // SWC-4741: invitation not associated to the current user, send user to the Settings page to add - // the new email address + // SWC-4741: invitation not associated to the current user, send user to the Profile page, where they can + // click 'Edit Profile', then 'Change email' to get to OneSage and add the new email address + // NOTE: We don't send the user directly to OneSage so that they have a chance to read the message first placeChanger.goTo( new Profile( authController.getCurrentUserPrincipalId(), - ProfileArea.SETTINGS + ProfileArea.PROFILE ) ); } else { diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenter.java index a27fe610cd..c719ce6eee 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenter.java @@ -3,38 +3,35 @@ import com.google.gwt.activity.shared.AbstractActivity; import com.google.gwt.event.shared.EventBus; import com.google.gwt.place.shared.Place; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AcceptsOneWidget; import com.google.inject.Inject; import org.sagebionetworks.web.client.GlobalApplicationState; import org.sagebionetworks.web.client.place.PersonalAccessTokenPlace; -import org.sagebionetworks.web.client.view.PersonalAccessTokensView; +import org.sagebionetworks.web.shared.WebConstants; public class PersonalAccessTokensPresenter extends AbstractActivity implements Presenter { - private PersonalAccessTokensView view; private GlobalApplicationState globalApplicationState; @Inject public PersonalAccessTokensPresenter( - PersonalAccessTokensView view, GlobalApplicationState globalApplicationState ) { - this.view = view; this.globalApplicationState = globalApplicationState; - this.view.setPresenter(this); } @Override - public void setPlace(PersonalAccessTokenPlace place) { - this.view.setPresenter(this); - } + public void setPlace(PersonalAccessTokenPlace place) {} @Override public void start(AcceptsOneWidget panel, EventBus eventBus) { - this.view.render(); - panel.setWidget(view.asWidget()); + Window.Location.replace( + WebConstants.ONESAGE_PRODUCTION_URL + + "/authenticated/personalaccesstokens" + ); } public void goTo(Place place) { diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/ProfilePresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/ProfilePresenter.java index e19a619af7..1129440c39 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/ProfilePresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/ProfilePresenter.java @@ -1,38 +1,25 @@ package org.sagebionetworks.web.client.presenter; import static com.google.common.util.concurrent.MoreExecutors.directExecutor; +import static org.sagebionetworks.web.shared.WebConstants.ONESAGE_ACCOUNT_SETTINGS_URL; import com.google.common.util.concurrent.FutureCallback; import com.google.gwt.activity.shared.AbstractActivity; import com.google.gwt.event.shared.EventBus; import com.google.gwt.place.shared.Place; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.AcceptsOneWidget; import com.google.gwt.user.client.ui.Widget; import com.google.inject.Inject; import java.util.ArrayList; import java.util.List; -import org.sagebionetworks.repo.model.Challenge; -import org.sagebionetworks.repo.model.Entity; -import org.sagebionetworks.repo.model.EntityHeader; -import org.sagebionetworks.repo.model.PaginatedTeamIds; -import org.sagebionetworks.repo.model.Project; -import org.sagebionetworks.repo.model.ProjectHeader; -import org.sagebionetworks.repo.model.ProjectHeaderList; -import org.sagebionetworks.repo.model.ProjectListSortColumn; -import org.sagebionetworks.repo.model.ProjectListType; -import org.sagebionetworks.repo.model.Team; -import org.sagebionetworks.repo.model.UserBundle; +import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.model.entity.query.SortDirection; import org.sagebionetworks.repo.model.principal.AliasType; import org.sagebionetworks.repo.model.principal.PrincipalAliasRequest; import org.sagebionetworks.repo.model.principal.PrincipalAliasResponse; -import org.sagebionetworks.web.client.DisplayConstants; -import org.sagebionetworks.web.client.DisplayUtils; -import org.sagebionetworks.web.client.GWTWrapper; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.PortalGinInjector; -import org.sagebionetworks.web.client.SynapseJavascriptClient; +import org.sagebionetworks.web.client.*; import org.sagebionetworks.web.client.place.Profile; import org.sagebionetworks.web.client.place.Synapse; import org.sagebionetworks.web.client.place.Synapse.ProfileArea; @@ -72,7 +59,6 @@ public class ProfilePresenter private GWTWrapper gwt; private OpenTeamInvitationsWidget openInvitesWidget; private UserProfileEditorWidget userProfileEditorWidget; - private SettingsPresenter settingsPresenter; private PortalGinInjector ginInjector; private String currentUserId; private boolean isOwner; @@ -161,14 +147,6 @@ public UserProfileEditorWidget getUserProfileEditorWidget() { return userProfileEditorWidget; } - public SettingsPresenter getSettingsPresenter() { - if (settingsPresenter == null) { - settingsPresenter = ginInjector.getSettingsPresenter(); - view.setSettingsWidget(settingsPresenter.asWidget()); - } - return settingsPresenter; - } - @Override public void start(AcceptsOneWidget panel, EventBus eventBus) { // Install the view @@ -246,9 +224,6 @@ public void updateProfileView(String userId) { } view.clear(); view.showLoading(); - if (settingsPresenter != null) { - settingsPresenter.clear(); - } myTeamsWidget.clear(); currentUserId = userId == null @@ -335,7 +310,7 @@ public void refreshChallenges() { * Sets the project filter. If filtered to a specific team, then the Team argument will be used. * * @param filterType - * @param team + * @param filterTeamId */ public void setProjectFilterAndRefresh( ProjectFilterEnum filterType, @@ -856,7 +831,7 @@ private void showView(Profile place) { .goTo( new Profile( authenticationController.getCurrentUserPrincipalId(), - ProfileArea.SETTINGS + ProfileArea.PROFILE ) ); return; @@ -978,7 +953,7 @@ private void refreshData(ProfileArea tab) { refreshTeams(); break; case SETTINGS: - getSettingsPresenter().configure(); + Window.Location.replace(ONESAGE_ACCOUNT_SETTINGS_URL); break; case CHALLENGES: refreshChallenges(); diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/SettingsPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/SettingsPresenter.java deleted file mode 100644 index f4ce427f75..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/presenter/SettingsPresenter.java +++ /dev/null @@ -1,386 +0,0 @@ -package org.sagebionetworks.web.client.presenter; - -import static org.sagebionetworks.web.client.ServiceEntryPointUtils.fixServiceEntryPoint; -import static org.sagebionetworks.web.client.presenter.ProfilePresenter.IS_CERTIFIED; -import static org.sagebionetworks.web.client.presenter.ProfilePresenter.ORC_ID; -import static org.sagebionetworks.web.client.presenter.ProfilePresenter.PROFILE; -import static org.sagebionetworks.web.client.presenter.ProfilePresenter.VERIFICATION_SUBMISSION; - -import com.google.gwt.place.shared.Place; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Widget; -import com.google.inject.Inject; -import java.util.ArrayList; -import java.util.List; -import org.sagebionetworks.repo.model.UserBundle; -import org.sagebionetworks.repo.model.UserProfile; -import org.sagebionetworks.repo.model.auth.ChangePasswordWithCurrentPassword; -import org.sagebionetworks.repo.model.oauth.OAuthProvider; -import org.sagebionetworks.repo.model.verification.AttachmentMetadata; -import org.sagebionetworks.repo.model.verification.VerificationState; -import org.sagebionetworks.repo.model.verification.VerificationStateEnum; -import org.sagebionetworks.repo.model.verification.VerificationSubmission; -import org.sagebionetworks.web.client.DisplayConstants; -import org.sagebionetworks.web.client.DisplayUtils; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.PopupUtilsView; -import org.sagebionetworks.web.client.PortalGinInjector; -import org.sagebionetworks.web.client.SynapseClientAsync; -import org.sagebionetworks.web.client.SynapseJavascriptClient; -import org.sagebionetworks.web.client.place.LoginPlace; -import org.sagebionetworks.web.client.place.Profile; -import org.sagebionetworks.web.client.security.AuthenticationController; -import org.sagebionetworks.web.client.utils.Callback; -import org.sagebionetworks.web.client.view.SettingsView; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; -import org.sagebionetworks.web.client.widget.profile.EmailAddressesWidget; -import org.sagebionetworks.web.client.widget.verification.VerificationSubmissionWidget; - -public class SettingsPresenter implements SettingsView.Presenter { - - private SettingsView view; - private AuthenticationController authenticationController; - private GlobalApplicationState globalApplicationState; - private SynapseClientAsync synapseClient; - private SynapseAlert apiSynAlert; - private SynapseAlert notificationSynAlert; - private PortalGinInjector ginInjector; - private EmailAddressesWidget emailAddressesWidget; - private SynapseJavascriptClient jsClient; - public Callback resubmitVerificationCallback; - public VerificationSubmissionWidget verificationModal; - public UserBundle currentUserBundle; - private PopupUtilsView popupUtils; - - @Inject - public SettingsPresenter( - SettingsView view, - AuthenticationController authenticationController, - GlobalApplicationState globalApplicationState, - SynapseClientAsync synapseClient, - PortalGinInjector ginInjector, - EmailAddressesWidget emailAddressesWidget, - PopupUtilsView popupUtils, - SynapseJavascriptClient jsClient - ) { - this.view = view; - this.authenticationController = authenticationController; - this.globalApplicationState = globalApplicationState; - this.synapseClient = synapseClient; - fixServiceEntryPoint(synapseClient); - this.ginInjector = ginInjector; - this.emailAddressesWidget = emailAddressesWidget; - this.popupUtils = popupUtils; - this.jsClient = jsClient; - view.setEmailAddressesWidget(emailAddressesWidget); - view.setPresenter(this); - resubmitVerificationCallback = - () -> { - newVerificationSubmissionClicked(); - }; - - setSynAlertWidgets(); - } - - private void setSynAlertWidgets() { - apiSynAlert = ginInjector.getSynapseAlertWidget(); - notificationSynAlert = ginInjector.getSynapseAlertWidget(); - view.setAPISynAlertWidget(apiSynAlert); - view.setNotificationSynAlertWidget(notificationSynAlert); - } - - @Override - public void getAPIKey() { - apiSynAlert.clear(); - // lookup API key - AsyncCallback callback = new AsyncCallback() { - @Override - public void onSuccess(String result) { - view.setApiKey(result); - } - - @Override - public void onFailure(Throwable caught) { - apiSynAlert.handleException(caught); - } - }; - synapseClient.getAPIKey(callback); - } - - @Override - public void goTo(Place place) { - globalApplicationState.getPlaceChanger().goTo(place); - } - - // notification checkbox - @Override - public void updateMyNotificationSettings( - final boolean sendEmailNotifications, - final boolean markEmailedMessagesAsRead - ) { - notificationSynAlert.clear(); - // get my profile - AsyncCallback callback = new AsyncCallback() { - @Override - public void onSuccess(final UserProfile myProfile) { - org.sagebionetworks.repo.model.message.Settings settings = - myProfile.getNotificationSettings(); - if (settings == null) { - settings = new org.sagebionetworks.repo.model.message.Settings(); - settings.setMarkEmailedMessagesAsRead(false); - settings.setSendEmailNotifications(true); - myProfile.setNotificationSettings(settings); - } - settings.setSendEmailNotifications(sendEmailNotifications); - settings.setMarkEmailedMessagesAsRead(markEmailedMessagesAsRead); - - synapseClient.updateUserProfile( - myProfile, - new AsyncCallback() { - @Override - public void onSuccess(Void result) { - view.showInfo(DisplayConstants.UPDATED_NOTIFICATION_SETTINGS); - authenticationController.updateCachedProfile(myProfile); - } - - @Override - public void onFailure(Throwable caught) { - notificationSynAlert.handleException(caught); - } - } - ); - } - - @Override - public void onFailure(Throwable caught) { - notificationSynAlert.handleException(caught); - } - }; - jsClient.getUserProfile(null, callback); - } - - public void clear() { - view.clear(); - apiSynAlert.clear(); - notificationSynAlert.clear(); - emailAddressesWidget.clear(); - } - - public void configure() { - clear(); - if (authenticationController.isLoggedIn()) { - getUserProfile(); - - if (globalApplicationState.isShowingUTCTime()) { - view.setShowingUTCTime(); - } else { - view.setShowingLocalTime(); - } - } - // Only show deprecated API key settings if in experimental mode - view.setApiKeySettingsVisible( - DisplayUtils.isInTestWebsite(ginInjector.getCookieProvider()) - ); - - this.view.render(); - } - - private void getUserProfile() { - // ask for everything in the user bundle - currentUserBundle = null; - int mask = PROFILE | ORC_ID | VERIFICATION_SUBMISSION | IS_CERTIFIED; - view.setOrcIdVisible(false); - view.setUnbindOrcIdVisible(false); - jsClient.getUserBundle( - Long.parseLong(authenticationController.getCurrentUserPrincipalId()), - mask, - new AsyncCallback() { - @Override - public void onSuccess(UserBundle bundle) { - currentUserBundle = bundle; - emailAddressesWidget.configure(bundle.getUserProfile()); - authenticationController.updateCachedProfile(bundle.getUserProfile()); - view.updateNotificationCheckbox(bundle.getUserProfile()); - initializeVerificationUI(); - String orcId = bundle.getORCID(); - if (orcId != null && orcId.length() > 0) { - view.setOrcId(orcId); - view.setOrcIdVisible(true); - view.setUnbindOrcIdVisible(true); - view.setOrcIDLinkButtonVisible(false); - } else { - view.setOrcIDLinkButtonVisible(true); - } - view.setIsCertified(bundle.getIsCertified()); - } - - @Override - public void onFailure(Throwable caught) { - notificationSynAlert.handleException(caught); - } - } - ); - } - - @Override - public void changeApiKey() { - apiSynAlert.clear(); - Callback callback = () -> { - changeApiKeyPostConfirmation(); - }; - view.showConfirm(DisplayConstants.API_KEY_CONFIRMATION, callback); - } - - public void changeApiKeyPostConfirmation() { - AsyncCallback callback = new AsyncCallback() { - @Override - public void onSuccess(String result) { - view.showInfo(DisplayConstants.API_KEY_CHANGED); - view.setApiKey(result); - } - - @Override - public void onFailure(Throwable caught) { - apiSynAlert.handleException(caught); - } - }; - synapseClient.deleteApiKey(callback); - } - - public Widget asWidget() { - return view.asWidget(); - } - - @Override - public void onEditProfile() { - globalApplicationState - .getPlaceChanger() - .goTo(new Profile(Profile.EDIT_PROFILE_TOKEN)); - } - - @Override - public void setShowUTCTime(boolean isUTC) { - globalApplicationState.setShowUTCTime(isUTC); - } - - public VerificationSubmissionWidget getVerificationSubmissionWidget() { - if (verificationModal == null) { - verificationModal = ginInjector.getVerificationSubmissionWidget(); - } - return verificationModal; - } - - @Override - public void editVerificationSubmissionClicked() { - // edit the existing submission - getVerificationSubmissionWidget() - .configure( - currentUserBundle.getVerificationSubmission(), - false, // is ACT - true - ) // isModal - .setResubmitCallback(resubmitVerificationCallback) - .show(); - } - - @Override - public void newVerificationSubmissionClicked() { - List attachments = new ArrayList(); - if (currentUserBundle.getVerificationSubmission() != null) { - attachments = - currentUserBundle.getVerificationSubmission().getAttachments(); - } - - // create a new submission - getVerificationSubmissionWidget() - .configure( - currentUserBundle.getUserProfile(), - currentUserBundle.getORCID(), - true, // isModal - attachments - ) - .show(); - } - - @Override - public void linkOrcIdClicked() { - String orcId = currentUserBundle.getORCID(); - if (orcId != null && orcId.length() > 0) { - // already set! - view.showErrorMessage( - "An ORC ID has already been linked to your Synapse account." - ); - } else { - DisplayUtils.newWindow( - "/Portal/oauth2AliasCallback?oauth2provider=ORCID", - "_self", - "" - ); - } - } - - public void initializeVerificationUI() { - // The UI depends on the current state - VerificationSubmission submission = - currentUserBundle.getVerificationSubmission(); - - if (submission == null) { - // no submission. if the owner, provide way to submit - view.showNotVerified(); - } else { - // there's a submission in a state. - showVerificationUI(submission); - } - } - - public void showVerificationUI(VerificationSubmission submission) { - VerificationState currentState = submission - .getStateHistory() - .get(submission.getStateHistory().size() - 1); - if (currentState.getState() == VerificationStateEnum.SUSPENDED) { - view.setVerificationSuspendedButtonVisible(true); - view.setResubmitVerificationButtonVisible(true); - } else if (currentState.getState() == VerificationStateEnum.REJECTED) { - view.setVerificationRejectedButtonVisible(true); - view.setResubmitVerificationButtonVisible(true); - } else if (currentState.getState() == VerificationStateEnum.SUBMITTED) { - view.setVerificationSubmittedButtonVisible(true); - } else if (currentState.getState() == VerificationStateEnum.APPROVED) { - view.setVerificationDetailsButtonVisible(true); - } - } - - @Override - public void unbindOrcId() { - popupUtils.showConfirmDialog( - "Unlink", - "Are you sure you want to unlink this ORCID from your Synapse user profile?", - new Callback() { - @Override - public void invoke() { - unbindOrcIdAfterConfirmation(); - } - } - ); - } - - public void unbindOrcIdAfterConfirmation() { - jsClient.unbindOAuthProvidersUserId( - OAuthProvider.ORCID, - currentUserBundle.getORCID(), - new AsyncCallback() { - @Override - public void onSuccess(Void result) { - // ORCID successfully removed. refresh so that the user bundle and UI are up to date - view.showInfo("ORCID has been successfully unbound."); - globalApplicationState.refreshPage(); - } - - @Override - public void onFailure(Throwable caught) { - notificationSynAlert.handleException(caught); - } - } - ); - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/TwoFactorAuthPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/TwoFactorAuthPresenter.java index 24eb657f0c..3d83a6d095 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/TwoFactorAuthPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/TwoFactorAuthPresenter.java @@ -2,79 +2,24 @@ import com.google.gwt.activity.shared.AbstractActivity; import com.google.gwt.event.shared.EventBus; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AcceptsOneWidget; import com.google.inject.Inject; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.place.Profile; -import org.sagebionetworks.web.client.place.Synapse; import org.sagebionetworks.web.client.place.TwoFactorAuthPlace; -import org.sagebionetworks.web.client.view.TwoFactorAuthView; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; +import org.sagebionetworks.web.shared.WebConstants; public class TwoFactorAuthPresenter extends AbstractActivity - implements TwoFactorAuthView.Presenter, Presenter { - - private final TwoFactorAuthView view; - private final GlobalApplicationState globalApplicationState; + implements Presenter { @Inject - public TwoFactorAuthPresenter( - TwoFactorAuthView view, - GlobalApplicationState globalApplicationState, - SynapseAlert synAlert - ) { - this.view = view; - this.globalApplicationState = globalApplicationState; - view.setSynAlert(synAlert); - view.setPresenter(this); - } - - public void configureView(final TwoFactorAuthPlace place) { - if (place.toToken().equals(TwoFactorAuthPlace.BEGIN_ENROLLMENT)) { - view.showTwoFactorEnrollmentForm(); - } else if ( - place.toToken().equals(TwoFactorAuthPlace.CREATE_RECOVERY_CODES) - ) { - view.showGenerateRecoveryCodes(false); - } else if ( - place.toToken().equals(TwoFactorAuthPlace.REPLACE_RECOVERY_CODES) - ) { - view.showGenerateRecoveryCodes(true); - } - } + public TwoFactorAuthPresenter() {} @Override public void start(AcceptsOneWidget panel, EventBus eventBus) { - panel.setWidget(this.view.asWidget()); - } - - @Override - public void setPlace(final TwoFactorAuthPlace place) { - view.setPresenter(this); - view.clear(); - configureView(place); + Window.Location.replace(WebConstants.ONESAGE_ACCOUNT_SETTINGS_URL); } @Override - public String mayStop() { - view.clear(); - return null; - } - - @Override - public void onTwoFactorEnrollmentComplete() { - globalApplicationState - .getPlaceChanger() - .goTo(new TwoFactorAuthPlace(TwoFactorAuthPlace.CREATE_RECOVERY_CODES)); - } - - @Override - public void onGenerateRecoveryCodesComplete() { - globalApplicationState - .getPlaceChanger() - .goTo( - new Profile(Profile.VIEW_PROFILE_TOKEN, Synapse.ProfileArea.SETTINGS) - ); - } + public void setPlace(final TwoFactorAuthPlace place) {} } diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java index 789f07cbba..9080e74bab 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java @@ -14,7 +14,6 @@ public class PasswordResetPresenter private static final String ONE_SAGE_RESET_PASSWORD_URL = "https://accounts.sagebionetworks.synapse.org/resetPassword"; - private PasswordReset place; @Inject public PasswordResetPresenter() {} diff --git a/src/main/java/org/sagebionetworks/web/client/view/PersonalAccessTokensView.java b/src/main/java/org/sagebionetworks/web/client/view/PersonalAccessTokensView.java deleted file mode 100644 index c8427edd72..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/view/PersonalAccessTokensView.java +++ /dev/null @@ -1,19 +0,0 @@ -package org.sagebionetworks.web.client.view; - -import com.google.gwt.user.client.ui.IsWidget; -import org.sagebionetworks.web.client.SynapseView; -import org.sagebionetworks.web.client.presenter.PersonalAccessTokensPresenter; - -public interface PersonalAccessTokensView extends IsWidget { - /** - * Set this view's presenter - * - * @param presenter - */ - public void setPresenter(PersonalAccessTokensPresenter presenter); - - /** - * Renders the view for a given presenter - */ - public void render(); -} diff --git a/src/main/java/org/sagebionetworks/web/client/view/PersonalAccessTokensViewImpl.java b/src/main/java/org/sagebionetworks/web/client/view/PersonalAccessTokensViewImpl.java deleted file mode 100644 index 8d1b76cb6a..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/view/PersonalAccessTokensViewImpl.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.sagebionetworks.web.client.view; - -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Widget; -import com.google.inject.Inject; -import org.gwtbootstrap3.client.ui.Anchor; -import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider; -import org.sagebionetworks.web.client.jsinterop.AccessTokenPageProps; -import org.sagebionetworks.web.client.jsinterop.React; -import org.sagebionetworks.web.client.jsinterop.ReactNode; -import org.sagebionetworks.web.client.jsinterop.SRC; -import org.sagebionetworks.web.client.place.Profile; -import org.sagebionetworks.web.client.place.Synapse; -import org.sagebionetworks.web.client.presenter.PersonalAccessTokensPresenter; -import org.sagebionetworks.web.client.security.AuthenticationController; -import org.sagebionetworks.web.client.widget.ReactComponentDiv; -import org.sagebionetworks.web.client.widget.header.Header; - -public class PersonalAccessTokensViewImpl - extends Composite - implements PersonalAccessTokensView { - - public interface PersonalAccessTokensViewImplUiBinder - extends UiBinder {} - - private static String PAGE_TITLE = "Personal Access Tokens"; - private static String PAGE_BODY_COPY = - "Issue personal access tokens to access your Synapse resources in the command line clients. A personal access token will expire if it is unused for 180 consecutive days. You may create up to 100 personal access tokens."; - - @UiField - ReactComponentDiv container; - - @UiField - Anchor backToSettingsAnchor; - - private PersonalAccessTokensPresenter presenter; - private Header headerWidget; - private SynapseReactClientFullContextPropsProvider propsProvider; - - @Inject - public PersonalAccessTokensViewImpl( - PersonalAccessTokensViewImplUiBinder uiBinder, - AuthenticationController authenticationController, - Header headerWidget, - SynapseReactClientFullContextPropsProvider propsProvider - ) { - initWidget(uiBinder.createAndBindUi(this)); - - this.headerWidget = headerWidget; - this.propsProvider = propsProvider; - headerWidget.configure(); - - backToSettingsAnchor.addClickHandler(event -> - presenter.goTo( - new Profile( - authenticationController.getCurrentUserPrincipalId(), - Synapse.ProfileArea.SETTINGS - ) - ) - ); - } - - @Override - public void render() { - Window.scrollTo(0, 0); // scroll user to top of page - AccessTokenPageProps props = AccessTokenPageProps.create( - PAGE_TITLE, - PAGE_BODY_COPY - ); - ReactNode component = React.createElementWithSynapseContext( - SRC.SynapseComponents.AccessTokenPage, - props, - propsProvider.getJsInteropContextProps() - ); - container.render(component); - } - - @Override - public void setPresenter(PersonalAccessTokensPresenter presenter) { - this.presenter = presenter; - headerWidget.refresh(); - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/view/ProfileViewImpl.java b/src/main/java/org/sagebionetworks/web/client/view/ProfileViewImpl.java index b93d73ce9b..3a5cd77412 100644 --- a/src/main/java/org/sagebionetworks/web/client/view/ProfileViewImpl.java +++ b/src/main/java/org/sagebionetworks/web/client/view/ProfileViewImpl.java @@ -253,41 +253,38 @@ public ProfileViewImpl( } }); - teamSearchButton.addClickHandler( - event -> presenter.goTo(new TeamSearch(teamSearchTextBox.getValue())) + teamSearchButton.addClickHandler(event -> + presenter.goTo(new TeamSearch(teamSearchTextBox.getValue())) ); - projectSearchButton.addClickHandler( - event -> presenter.goTo(new Search(projectSearchTextBox.getValue())) + projectSearchButton.addClickHandler(event -> + presenter.goTo(new Search(projectSearchTextBox.getValue())) ); - moreChallengesButton.addClickHandler( - event -> presenter.getMoreChallenges() + moreChallengesButton.addClickHandler(event -> presenter.getMoreChallenges() ); showChallengesLoading(false); - favoritesFilter.addClickHandler( - event -> presenter.applyFilterClicked(ProjectFilterEnum.FAVORITES, null) + favoritesFilter.addClickHandler(event -> + presenter.applyFilterClicked(ProjectFilterEnum.FAVORITES, null) ); - allProjectsFilter.addClickHandler( - event -> presenter.applyFilterClicked(ProjectFilterEnum.ALL, null) + allProjectsFilter.addClickHandler(event -> + presenter.applyFilterClicked(ProjectFilterEnum.ALL, null) ); - myProjectsFilter.addClickHandler( - event -> - presenter.applyFilterClicked(ProjectFilterEnum.CREATED_BY_ME, null) + myProjectsFilter.addClickHandler(event -> + presenter.applyFilterClicked(ProjectFilterEnum.CREATED_BY_ME, null) ); - sharedDirectlyWithMeFilter.addClickHandler( - event -> - presenter.applyFilterClicked( - ProjectFilterEnum.SHARED_DIRECTLY_WITH_ME, - null - ) + sharedDirectlyWithMeFilter.addClickHandler(event -> + presenter.applyFilterClicked( + ProjectFilterEnum.SHARED_DIRECTLY_WITH_ME, + null + ) ); - projectNameColumnHeader.setSortingListener( - headerName -> presenter.sort(ProjectListSortColumn.PROJECT_NAME) + projectNameColumnHeader.setSortingListener(headerName -> + presenter.sort(ProjectListSortColumn.PROJECT_NAME) ); - lastActivityOnColumnHeader.setSortingListener( - headerName -> presenter.sort(ProjectListSortColumn.LAST_ACTIVITY) + lastActivityOnColumnHeader.setSortingListener(headerName -> + presenter.sort(ProjectListSortColumn.LAST_ACTIVITY) ); } diff --git a/src/main/java/org/sagebionetworks/web/client/view/SettingsView.java b/src/main/java/org/sagebionetworks/web/client/view/SettingsView.java deleted file mode 100644 index aabf636eab..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/view/SettingsView.java +++ /dev/null @@ -1,89 +0,0 @@ -package org.sagebionetworks.web.client.view; - -import com.google.gwt.place.shared.Place; -import com.google.gwt.user.client.ui.IsWidget; -import com.google.gwt.user.client.ui.Widget; -import org.sagebionetworks.repo.model.UserProfile; -import org.sagebionetworks.web.client.SynapseView; -import org.sagebionetworks.web.client.utils.Callback; - -public interface SettingsView extends IsWidget, SynapseView { - /** - * Set this view's presenter - * - * @param presenter - */ - public void setPresenter(Presenter presenter); - - /** - * Renders the view for a given presenter - */ - public void render(); - - public void updateNotificationCheckbox(UserProfile profile); - - void setEmailAddressesWidget(IsWidget w); - - public interface Presenter { - void goTo(Place place); - - void updateMyNotificationSettings( - boolean sendEmailNotifications, - boolean markEmailedMessagesAsRead - ); - - void changeApiKey(); - - void onEditProfile(); - - void getAPIKey(); - - void setShowUTCTime(boolean isUTC); - - void newVerificationSubmissionClicked(); - - void editVerificationSubmissionClicked(); - - void linkOrcIdClicked(); - - void unbindOrcId(); - } - - public void setApiKeySettingsVisible(boolean visible); - - public void setApiKey(String apiKey); - - public void setNotificationSynAlertWidget(IsWidget asWidget); - - public void setAPISynAlertWidget(IsWidget synAlert); - - void hideAPIKey(); - - void showConfirm(String message, Callback callback); - - void setShowingUTCTime(); - - void setShowingLocalTime(); - - void setOrcIdVisible(boolean isVisible); - - void setOrcIDLinkButtonVisible(boolean isVisible); - - void setUnbindOrcIdVisible(boolean isVisible); - - void setOrcId(String href); - - void showNotVerified(); - - void setResubmitVerificationButtonVisible(boolean isVisible); - - void setVerificationSuspendedButtonVisible(boolean isVisible); - - void setVerificationRejectedButtonVisible(boolean isVisible); - - void setVerificationSubmittedButtonVisible(boolean isVisible); - - void setVerificationDetailsButtonVisible(boolean isVisible); - - void setIsCertified(boolean isCertified); -} diff --git a/src/main/java/org/sagebionetworks/web/client/view/SettingsViewImpl.java b/src/main/java/org/sagebionetworks/web/client/view/SettingsViewImpl.java deleted file mode 100644 index 07ed717c23..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/view/SettingsViewImpl.java +++ /dev/null @@ -1,429 +0,0 @@ -package org.sagebionetworks.web.client.view; - -import com.google.gwt.event.dom.client.ClickEvent; -import com.google.gwt.event.dom.client.ClickHandler; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.FlowPanel; -import com.google.gwt.user.client.ui.HTMLPanel; -import com.google.gwt.user.client.ui.IsWidget; -import com.google.gwt.user.client.ui.SimplePanel; -import com.google.gwt.user.client.ui.TextBox; -import com.google.gwt.user.client.ui.Widget; -import com.google.inject.Inject; -import org.gwtbootstrap3.client.ui.Anchor; -import org.gwtbootstrap3.client.ui.AnchorListItem; -import org.gwtbootstrap3.client.ui.Button; -import org.gwtbootstrap3.client.ui.CheckBox; -import org.gwtbootstrap3.client.ui.Icon; -import org.gwtbootstrap3.client.ui.Panel; -import org.gwtbootstrap3.client.ui.html.Div; -import org.gwtbootstrap3.client.ui.html.Span; -import org.sagebionetworks.repo.model.UserProfile; -import org.sagebionetworks.web.client.ClientProperties; -import org.sagebionetworks.web.client.DisplayConstants; -import org.sagebionetworks.web.client.DisplayUtils; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.SynapseJSNIUtils; -import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider; -import org.sagebionetworks.web.client.jsinterop.React; -import org.sagebionetworks.web.client.jsinterop.ReactNode; -import org.sagebionetworks.web.client.jsinterop.SRC; -import org.sagebionetworks.web.client.jsinterop.TwoFactorAuthSettingsPanelProps; -import org.sagebionetworks.web.client.place.OAuthClientEditorPlace; -import org.sagebionetworks.web.client.place.PersonalAccessTokenPlace; -import org.sagebionetworks.web.client.place.Quiz; -import org.sagebionetworks.web.client.place.TwoFactorAuthPlace; -import org.sagebionetworks.web.client.utils.Callback; -import org.sagebionetworks.web.client.widget.ReactComponentDiv; - -public class SettingsViewImpl extends Composite implements SettingsView { - - public interface SettingsViewImplUiBinder - extends UiBinder {} - - @UiField - ReactComponentDiv twoFactorAuthSettingsPanel; - - @UiField - Button managePersonalAccessTokensButton; - - @UiField - Button gotoOAuthClientEditorButton; - - @UiField - HTMLPanel apiKeySettingsContainer; - - @UiField - Panel apiKeyUI; - - @UiField - org.gwtbootstrap3.client.ui.Button editProfileButton; - - @UiField - Div emailsPanel; - - @UiField - TextBox apiKeyContainer; - - @UiField - CheckBox emailNotificationsCheckbox; - - @UiField - org.gwtbootstrap3.client.ui.Button changeApiKey; - - @UiField - org.gwtbootstrap3.client.ui.Button showApiKey; - - @UiField - SimplePanel notificationSynAlertPanel; - - @UiField - SimplePanel apiSynAlertPanel; - - @UiField - AnchorListItem dateFormatLocal; - - @UiField - AnchorListItem dateFormatUTC; - - @UiField - Button dateFormatDropdown; - - // Profile Validation UI - @UiField - Div verifyAlert; - - @UiField - Anchor requestProfileValidationLink1; - - @UiField - Anchor requestProfileValidationLink2; - - @UiField - Anchor reviewProfileLink; - - @UiField - Anchor createOrcIdLink; - - @UiField - Anchor orcIdField; - - @UiField - Icon unbindButton; - - @UiField - Span unbindButtonUI; - - @UiField - Button linkORCIDButton; - - @UiField - Button verificationSubmittedButton; - - @UiField - Button verificationSuspendedButton; - - @UiField - Button verificationRejectedButton; - - @UiField - Button resubmitProfileValidationButton; - - @UiField - Button verificationApprovedButton; - - @UiField - Button certificationPassedButton; - - @UiField - Button certificationButton; - - @UiField - Button synapseTermsAcceptedButton; - - private Presenter presenter; - - @Inject - public SettingsViewImpl( - SettingsViewImplUiBinder binder, - final SynapseJSNIUtils jsniUtils, - final GlobalApplicationState globalApplicationState, - final SynapseReactClientFullContextPropsProvider propsProvider - ) { - initWidget(binder.createAndBindUi(this)); - ClickHandler notificationsClickHandler = getNotificationsClickHandler(); - emailNotificationsCheckbox.addClickHandler(notificationsClickHandler); - - changeApiKey.addClickHandler(event -> { - presenter.changeApiKey(); - }); - - showApiKey.addClickHandler(event -> { - presenter.getAPIKey(); - }); - - ClickHandler editProfileClickHandler = event -> { - presenter.onEditProfile(); - }; - editProfileButton.addClickHandler(editProfileClickHandler); - reviewProfileLink.addClickHandler(editProfileClickHandler); - - ClickHandler orcIdClickHandler = event -> presenter.linkOrcIdClicked(); - linkORCIDButton.addClickHandler(orcIdClickHandler); - createOrcIdLink.addClickHandler(orcIdClickHandler); - - apiKeyContainer.addClickHandler(event -> { - apiKeyContainer.selectAll(); - }); - - dateFormatLocal.addClickHandler(event -> { - dateFormatDropdown.setText(dateFormatLocal.getText()); - presenter.setShowUTCTime(false); - }); - dateFormatUTC.addClickHandler(event -> { - dateFormatDropdown.setText(dateFormatUTC.getText()); - presenter.setShowUTCTime(true); - }); - - ClickHandler newVerificationSubmissionCallback = event -> - presenter.newVerificationSubmissionClicked(); - ClickHandler editVerificationSubmissionCallback = event -> - presenter.editVerificationSubmissionClicked(); - - requestProfileValidationLink1.addClickHandler( - newVerificationSubmissionCallback - ); - requestProfileValidationLink2.addClickHandler( - newVerificationSubmissionCallback - ); - verificationApprovedButton.addClickHandler( - editVerificationSubmissionCallback - ); - verificationSubmittedButton.addClickHandler( - editVerificationSubmissionCallback - ); - verificationSuspendedButton.addClickHandler( - editVerificationSubmissionCallback - ); - verificationRejectedButton.addClickHandler( - editVerificationSubmissionCallback - ); - resubmitProfileValidationButton.addClickHandler( - newVerificationSubmissionCallback - ); - - unbindButton.addClickHandler(event -> presenter.unbindOrcId()); - certificationButton.addClickHandler(event -> - presenter.goTo(new Quiz("Certification")) - ); - certificationPassedButton.addClickHandler(event -> - presenter.goTo(new Quiz("Certification")) - ); - synapseTermsAcceptedButton.addClickHandler(event -> - DisplayUtils.newWindow( - "https://s3.amazonaws.com/static.synapse.org/governance/SageBionetworksSynapseTermsandConditionsofUse.pdf?v=5", - "_blank", - "" - ) - ); - - managePersonalAccessTokensButton.addClickHandler(event -> - presenter.goTo(new PersonalAccessTokenPlace("")) - ); - - gotoOAuthClientEditorButton.addClickHandler(event -> - presenter.goTo( - new OAuthClientEditorPlace(ClientProperties.DEFAULT_PLACE_TOKEN) - ) - ); - ReactNode twoFactorAuthPanelNode = React.createElementWithSynapseContext( - SRC.SynapseComponents.TwoFactorAuthSettingsPanel, - TwoFactorAuthSettingsPanelProps.create( - () -> - globalApplicationState - .getPlaceChanger() - .goTo(new TwoFactorAuthPlace(TwoFactorAuthPlace.BEGIN_ENROLLMENT)), - () -> - globalApplicationState - .getPlaceChanger() - .goTo( - new TwoFactorAuthPlace(TwoFactorAuthPlace.REPLACE_RECOVERY_CODES) - ) - ), - propsProvider.getJsInteropContextProps() - ); - twoFactorAuthSettingsPanel.render(twoFactorAuthPanelNode); - } - - @Override - public void setPresenter(final Presenter presenter) { - this.presenter = presenter; - Window.scrollTo(0, 0); // scroll user to top of page - } - - @Override - public void render() { - clear(); - } - - @Override - public void showErrorMessage(String message) { - DisplayUtils.showErrorMessage(message); - } - - @Override - public void showLoading() {} - - @Override - public void updateNotificationCheckbox(UserProfile profile) { - boolean isNotify = true; - if (profile.getNotificationSettings() != null) { - if ( - profile.getNotificationSettings().getSendEmailNotifications() != null - ) isNotify = - profile.getNotificationSettings().getSendEmailNotifications(); - } - emailNotificationsCheckbox.setValue(isNotify, false); - } - - private ClickHandler getNotificationsClickHandler() { - return new ClickHandler() { - @Override - public void onClick(ClickEvent event) { - // update notification settings - presenter.updateMyNotificationSettings( - emailNotificationsCheckbox.getValue(), - false - ); - } - }; - } - - @Override - public void showInfo(String message) { - DisplayUtils.showInfo(message); - } - - @Override - public void clear() { - hideAPIKey(); - verificationApprovedButton.setVisible(false); - resubmitProfileValidationButton.setVisible(false); - verificationSubmittedButton.setVisible(false); - verificationSuspendedButton.setVisible(false); - verificationRejectedButton.setVisible(false); - verifyAlert.setVisible(false); - } - - @Override - public void setApiKey(String apiKey) { - apiKeyContainer.setText(apiKey); - apiKeyUI.setVisible(true); - changeApiKey.setVisible(true); - showApiKey.setVisible(false); - } - - @Override - public void setNotificationSynAlertWidget(IsWidget notificationSynAlert) { - notificationSynAlertPanel.setWidget(notificationSynAlert); - } - - @Override - public void setAPISynAlertWidget(IsWidget apiSynAlert) { - apiSynAlertPanel.setWidget(apiSynAlert); - } - - @Override - public void hideAPIKey() { - apiKeyContainer.setText(""); - apiKeyUI.setVisible(false); - changeApiKey.setVisible(false); - showApiKey.setVisible(true); - } - - @Override - public void showConfirm(String message, Callback callback) { - DisplayUtils.confirm(message, callback); - } - - @Override - public void setShowingUTCTime() { - dateFormatDropdown.setText(dateFormatUTC.getText()); - } - - @Override - public void setShowingLocalTime() { - dateFormatDropdown.setText(dateFormatLocal.getText()); - } - - @Override - public void setEmailAddressesWidget(IsWidget w) { - emailsPanel.clear(); - emailsPanel.add(w); - } - - @Override - public void setApiKeySettingsVisible(boolean visible) { - apiKeySettingsContainer.setVisible(visible); - } - - @Override - public void setOrcIdVisible(boolean isVisible) { - orcIdField.setVisible(isVisible); - } - - @Override - public void setUnbindOrcIdVisible(boolean isVisible) { - unbindButtonUI.setVisible(isVisible); - } - - @Override - public void setOrcId(String href) { - orcIdField.setText(href); - orcIdField.setHref(href); - } - - @Override - public void setOrcIDLinkButtonVisible(boolean isVisible) { - this.linkORCIDButton.setVisible(isVisible); - } - - @Override - public void showNotVerified() { - verifyAlert.setVisible(true); - } - - @Override - public void setResubmitVerificationButtonVisible(boolean isVisible) { - resubmitProfileValidationButton.setVisible(isVisible); - } - - @Override - public void setVerificationSubmittedButtonVisible(boolean isVisible) { - verificationSubmittedButton.setVisible(isVisible); - } - - @Override - public void setVerificationSuspendedButtonVisible(boolean isVisible) { - verificationSuspendedButton.setVisible(isVisible); - } - - @Override - public void setVerificationRejectedButtonVisible(boolean isVisible) { - verificationRejectedButton.setVisible(isVisible); - } - - @Override - public void setVerificationDetailsButtonVisible(boolean isVisible) { - verificationApprovedButton.setVisible(isVisible); - } - - @Override - public void setIsCertified(boolean isCertified) { - certificationButton.setVisible(!isCertified); - certificationPassedButton.setVisible(isCertified); - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/view/TwoFactorAuthView.java b/src/main/java/org/sagebionetworks/web/client/view/TwoFactorAuthView.java deleted file mode 100644 index 8f20c4f8e0..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/view/TwoFactorAuthView.java +++ /dev/null @@ -1,20 +0,0 @@ -package org.sagebionetworks.web.client.view; - -import com.google.gwt.place.shared.Place; -import com.google.gwt.user.client.ui.IsWidget; -import org.sagebionetworks.web.client.SynapseView; - -public interface TwoFactorAuthView extends IsWidget, SynapseView { - void setPresenter(Presenter twoFactorAuthPresenter); - - void showTwoFactorEnrollmentForm(); - - void showGenerateRecoveryCodes(boolean showWarning); - - void setSynAlert(IsWidget w); - - public interface Presenter { - void onTwoFactorEnrollmentComplete(); - void onGenerateRecoveryCodesComplete(); - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/view/TwoFactorAuthViewImpl.java b/src/main/java/org/sagebionetworks/web/client/view/TwoFactorAuthViewImpl.java deleted file mode 100644 index 0eaacdcf56..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/view/TwoFactorAuthViewImpl.java +++ /dev/null @@ -1,110 +0,0 @@ -package org.sagebionetworks.web.client.view; - -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.IsWidget; -import com.google.gwt.user.client.ui.Widget; -import com.google.inject.Inject; -import org.gwtbootstrap3.client.ui.html.Div; -import org.sagebionetworks.web.client.DisplayUtils; -import org.sagebionetworks.web.client.SynapseJSNIUtils; -import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider; -import org.sagebionetworks.web.client.jsinterop.React; -import org.sagebionetworks.web.client.jsinterop.SRC; -import org.sagebionetworks.web.client.jsinterop.TwoFactorBackupCodesProps; -import org.sagebionetworks.web.client.jsinterop.TwoFactorEnrollmentFormProps; -import org.sagebionetworks.web.client.widget.ReactComponentDiv; -import org.sagebionetworks.web.client.widget.header.Header; - -public class TwoFactorAuthViewImpl - extends Composite - implements TwoFactorAuthView { - - @UiField - ReactComponentDiv reactContainer; - - @UiField - Div synAlertContainer; - - private Presenter presenter; - private Header headerWidget; - SynapseJSNIUtils jsniUtils; - SynapseReactClientFullContextPropsProvider propsProvider; - - public interface LoginViewImplBinder - extends UiBinder {} - - @Inject - public TwoFactorAuthViewImpl( - LoginViewImplBinder uiBinder, - Header headerWidget, - SynapseJSNIUtils jsniUtils, - SynapseReactClientFullContextPropsProvider propsProvider - ) { - initWidget(uiBinder.createAndBindUi(this)); - this.headerWidget = headerWidget; - this.jsniUtils = jsniUtils; - this.propsProvider = propsProvider; - headerWidget.configure(); - } - - @Override - public void setPresenter(Presenter twoFactorAuthPresenter) { - this.presenter = twoFactorAuthPresenter; - headerWidget.configure(); - headerWidget.refresh(); - com.google.gwt.user.client.Window.scrollTo(0, 0); // scroll user to top of page - } - - @Override - public void showTwoFactorEnrollmentForm() { - reactContainer.render( - React.createElementWithSynapseContext( - SRC.SynapseComponents.TwoFactorEnrollmentForm, - TwoFactorEnrollmentFormProps.create(() -> - presenter.onTwoFactorEnrollmentComplete() - ), - propsProvider.getJsInteropContextProps() - ) - ); - } - - @Override - public void showGenerateRecoveryCodes(boolean showWarning) { - reactContainer.render( - React.createElementWithSynapseContext( - SRC.SynapseComponents.TwoFactorBackupCodes, - TwoFactorBackupCodesProps.create( - showWarning, - () -> presenter.onGenerateRecoveryCodesComplete() - ), - propsProvider.getJsInteropContextProps() - ) - ); - } - - @Override - public void showErrorMessage(String message) { - DisplayUtils.showErrorMessage(message); - } - - @Override - public void showLoading() {} - - @Override - public void showInfo(String message) { - DisplayUtils.showInfo(message); - } - - @Override - public void clear() { - reactContainer.clear(); - } - - @Override - public void setSynAlert(IsWidget w) { - synAlertContainer.clear(); - synAlertContainer.add(w); - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/widget/QuarantinedEmailModal.java b/src/main/java/org/sagebionetworks/web/client/widget/QuarantinedEmailModal.java index 7452b40f04..0788e4eb5f 100644 --- a/src/main/java/org/sagebionetworks/web/client/widget/QuarantinedEmailModal.java +++ b/src/main/java/org/sagebionetworks/web/client/widget/QuarantinedEmailModal.java @@ -1,15 +1,16 @@ package org.sagebionetworks.web.client.widget; +import static org.sagebionetworks.web.shared.WebConstants.ONESAGE_ACCOUNT_SETTINGS_URL; + import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.Widget; import com.google.inject.Inject; import org.gwtbootstrap3.client.ui.Button; import org.gwtbootstrap3.client.ui.Modal; import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.place.Profile; -import org.sagebionetworks.web.client.place.Synapse.ProfileArea; import org.sagebionetworks.web.client.security.AuthenticationController; public class QuarantinedEmailModal implements IsWidget { @@ -29,14 +30,7 @@ public QuarantinedEmailModal( ) { widget = (Modal) binder.createAndBindUi(this); accountSettingsLink.addClickHandler(event -> { - globalAppState - .getPlaceChanger() - .goTo( - new Profile( - authController.getCurrentUserPrincipalId(), - ProfileArea.SETTINGS - ) - ); + Window.open(ONESAGE_ACCOUNT_SETTINGS_URL, "_blank", ""); widget.hide(); }); } diff --git a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetImpl.java b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetImpl.java index b44ed0be92..189186227a 100755 --- a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetImpl.java +++ b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetImpl.java @@ -26,13 +26,8 @@ public class UserProfileEditorWidgetImpl implements UserProfileEditorWidget, UserProfileEditorWidgetView.Presenter { - public static final String CONFIRM_SAVE_BEFORE_GOTO_SETTINGS_TITLE = - "Would you like to save your profile changes?"; - public static final String CONFIRM_SAVE_BEFORE_GOTO_SETTINGS_MESSAGE = - "Select OK to save the changes to your Profile and go to the Settings tab to change your password, or select Cancel to continue editing your Profile."; public static final String PLEASE_ENTER_A_VALID_URL = "Please enter a valid URL"; - public static final String PLEASE_SELECT_A_FILE = "Please select a file"; public static final String CAN_ONLY_INCLUDE = "Can only include letters, numbers, dot (.), dash (-), and underscore (_)"; public static final String MUST_BE_AT_LEAST_3_CHARACTERS = @@ -53,7 +48,6 @@ public class UserProfileEditorWidgetImpl PopupUtilsView popupUtils; String orcIdHref; Callback callback; - boolean goToAccountSettingsAfterSave = false; boolean isEditing = false; @Inject @@ -107,7 +101,6 @@ public void configure( this.callback = callback; this.orcIdHref = orcIdHref; originalProfile = profile; - goToAccountSettingsAfterSave = false; view.hideUsernameError(); view.hideLinkError(); synAlert.clear(); @@ -296,13 +289,6 @@ public void onSuccess(UserProfile updateProfile) { authController.updateCachedProfile(originalProfile); setIsEditingMode(false); callback.invoke(); - if (goToAccountSettingsAfterSave) { - globalAppState - .getPlaceChanger() - .goTo( - new Profile(originalProfile.getOwnerId(), ProfileArea.SETTINGS) - ); - } } @Override diff --git a/src/main/java/org/sagebionetworks/web/shared/WebConstants.java b/src/main/java/org/sagebionetworks/web/shared/WebConstants.java index ab9727e696..39f9f02a63 100644 --- a/src/main/java/org/sagebionetworks/web/shared/WebConstants.java +++ b/src/main/java/org/sagebionetworks/web/shared/WebConstants.java @@ -25,6 +25,11 @@ public class WebConstants { public static final String INVALID_EMAIL_MESSAGE = "Invalid email address"; + public static final String ONESAGE_PRODUCTION_URL = + "https://accounts.sagebionetworks.synapse.org"; + public static final String ONESAGE_ACCOUNT_SETTINGS_URL = + ONESAGE_PRODUCTION_URL + "/authenticated/myaccount"; + public static final String DOCS_BASE_URL = "https://help.synapse.org/"; public static final String DOCS_URL = DOCS_BASE_URL + "docs/"; public static final String PROVENANCE_API_URL = diff --git a/src/main/resources/org/sagebionetworks/web/client/view/PersonalAccessTokensViewImpl.ui.xml b/src/main/resources/org/sagebionetworks/web/client/view/PersonalAccessTokensViewImpl.ui.xml deleted file mode 100644 index f593862d84..0000000000 --- a/src/main/resources/org/sagebionetworks/web/client/view/PersonalAccessTokensViewImpl.ui.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - -
-
-
- - < - Back to Settings - - -
- - diff --git a/src/main/resources/org/sagebionetworks/web/client/view/SettingsViewImpl.ui.xml b/src/main/resources/org/sagebionetworks/web/client/view/SettingsViewImpl.ui.xml deleted file mode 100644 index 5b446a8ed1..0000000000 --- a/src/main/resources/org/sagebionetworks/web/client/view/SettingsViewImpl.ui.xml +++ /dev/null @@ -1,363 +0,0 @@ - - - - - - - - - Profile - - - - Edit Profile - - - - - - Date/Time Format - - - - - - - - - - - - - - Certification - - - - - Get Certified - - - Passed Certification Quiz - - - - - - - - Profile Validation - - - - - Profile Validation Pending - - - Profile Validation Rejected - - - Validated Profile Suspended - - - Revalidate My Profile - - - Profile Validated - - - - - - - - Users with a validated profile can access more features and - data. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Change Synapse Password - - - - - - - - - - - - - - - - - - ORCID - - - - Link to ORCID - - - - - - - - - - - - Synapse Terms and Conditions for Use - - - - - Accepted Terms and Conditions for Use - - - - - - - - - - Email - - - - - - - - - - - - Following - - - Your followed forums and threads have moved! To view the topics that - you are following, click - - Your Account - - in the main sidebar menu and - then click "Following". - - - - - - Two-factor Authentication (2FA) - - - - - - - Personal Access Tokens - - - - You can issue personal access tokens to authenticate your scripts - with - scoped access to your account. It is - important that you treat personal access tokens with the same - security as your password. - - - - - - - OAuth Client Editor - - - - OAuth Clients can be created to develop applications that use - Synapse - as an identity provider. - - - - - - - - Synapse API Key - -

- Using an API key allows you to authenticate your scripts for an - indefinite amount of time. It is important - that you treat your API key with the same security as your password. -

- - - - - - - - - - -
- - - - - - -
-
diff --git a/src/main/resources/org/sagebionetworks/web/client/view/TwoFactorAuthViewImpl.ui.xml b/src/main/resources/org/sagebionetworks/web/client/view/TwoFactorAuthViewImpl.ui.xml deleted file mode 100644 index ee6cf228f1..0000000000 --- a/src/main/resources/org/sagebionetworks/web/client/view/TwoFactorAuthViewImpl.ui.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - -
- - -
-
-
diff --git a/src/main/resources/org/sagebionetworks/web/client/widget/QuarantinedEmailModal.ui.xml b/src/main/resources/org/sagebionetworks/web/client/widget/QuarantinedEmailModal.ui.xml index 3e3d26b6a2..99debd048a 100644 --- a/src/main/resources/org/sagebionetworks/web/client/widget/QuarantinedEmailModal.ui.xml +++ b/src/main/resources/org/sagebionetworks/web/client/widget/QuarantinedEmailModal.ui.xml @@ -15,10 +15,9 @@ > - It looks like the primary email address associated to your account - is no longer valid. - Please update your primary email address to - continue to receive: + It looks like the primary email address associated to your account is no + longer valid. Please update your primary email address to continue to + receive: @@ -33,8 +32,7 @@ - Account - Settings + Account Settings Close diff --git a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.ui.xml b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.ui.xml index 18896909bb..f2165deeda 100755 --- a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.ui.xml +++ b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.ui.xml @@ -131,7 +131,7 @@ ui:field="changeEmailLink" visible="false" target="_blank" - href="/Profile:v/settings" + href="https://accounts.sagebionetworks.synapse.org/authenticated/myaccount" > Change email diff --git a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileModalViewImpl.ui.xml b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileModalViewImpl.ui.xml index a03d661da9..e0acb0e6f6 100755 --- a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileModalViewImpl.ui.xml +++ b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileModalViewImpl.ui.xml @@ -29,7 +29,7 @@ diff --git a/src/test/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenterTest.java b/src/test/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenterTest.java deleted file mode 100644 index 564d44a214..0000000000 --- a/src/test/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenterTest.java +++ /dev/null @@ -1,75 +0,0 @@ -package org.sagebionetworks.web.client.presenter; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.google.gwt.event.shared.EventBus; -import com.google.gwt.junit.GWTMockUtilities; -import com.google.gwt.user.client.ui.AcceptsOneWidget; -import com.google.gwt.user.client.ui.Widget; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.PlaceChanger; -import org.sagebionetworks.web.client.place.PersonalAccessTokenPlace; -import org.sagebionetworks.web.client.place.Profile; -import org.sagebionetworks.web.client.place.Synapse; -import org.sagebionetworks.web.client.view.PersonalAccessTokensView; - -@RunWith(MockitoJUnitRunner.class) -public class PersonalAccessTokensPresenterTest { - - @Mock - PersonalAccessTokensView mockView; - - @Mock - GlobalApplicationState globalApplicationState; - - @InjectMocks - PersonalAccessTokensPresenter presenter; - - @Test - public void testSetPlace() { - PersonalAccessTokenPlace place = new PersonalAccessTokenPlace("token"); - - // Method under test - presenter.setPlace(place); - - // Called once in the constructor and once on setPlace invocation - verify(mockView, times(2)).setPresenter(presenter); - } - - @Test - public void testStart() { - GWTMockUtilities.disarm(); - - AcceptsOneWidget mockPanel = mock(AcceptsOneWidget.class); - EventBus mockEventBus = mock(EventBus.class); - when(mockView.asWidget()).thenReturn(mock(Widget.class)); - - // Method under test - presenter.start(mockPanel, mockEventBus); - - verify(mockView).render(); - verify(mockPanel).setWidget(mockView.asWidget()); - - GWTMockUtilities.restore(); - } - - @Test - public void testGoTo() { - PlaceChanger mockPlaceChanger = mock(PlaceChanger.class); - when(globalApplicationState.getPlaceChanger()).thenReturn(mockPlaceChanger); - Profile profilePlace = new Profile("token", Synapse.ProfileArea.SETTINGS); - - // Method under test - presenter.goTo(profilePlace); - - verify(mockPlaceChanger).goTo(profilePlace); - } -} diff --git a/src/test/java/org/sagebionetworks/web/unitclient/presenter/EmailInvitationPresenterTest.java b/src/test/java/org/sagebionetworks/web/unitclient/presenter/EmailInvitationPresenterTest.java index f7250f2fd8..3bc351c791 100644 --- a/src/test/java/org/sagebionetworks/web/unitclient/presenter/EmailInvitationPresenterTest.java +++ b/src/test/java/org/sagebionetworks/web/unitclient/presenter/EmailInvitationPresenterTest.java @@ -228,7 +228,7 @@ public void testLoggedInNotEmailOwner() { verify(mockPlaceChanger).goTo(placeCaptor.capture()); Profile profilePlace = placeCaptor.getValue(); assertEquals(CURRENT_USER_ID, profilePlace.getUserId()); - assertEquals(ProfileArea.SETTINGS, profilePlace.getArea()); + assertEquals(ProfileArea.PROFILE, profilePlace.getArea()); } @Test diff --git a/src/test/java/org/sagebionetworks/web/unitclient/presenter/ProfilePresenterTest.java b/src/test/java/org/sagebionetworks/web/unitclient/presenter/ProfilePresenterTest.java index 6b0a3fd190..e6836e71f2 100644 --- a/src/test/java/org/sagebionetworks/web/unitclient/presenter/ProfilePresenterTest.java +++ b/src/test/java/org/sagebionetworks/web/unitclient/presenter/ProfilePresenterTest.java @@ -2,21 +2,8 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyList; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.reset; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; +import static org.mockito.Matchers.*; +import static org.mockito.Mockito.*; import static org.sagebionetworks.web.client.utils.FutureUtils.getDoneFuture; import static org.sagebionetworks.web.client.utils.FutureUtils.getFailedFuture; @@ -24,8 +11,8 @@ import com.google.gwt.place.shared.Place; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.AcceptsOneWidget; -import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.Widget; +import com.google.gwtmockito.GwtMockitoTestRunner; import java.util.ArrayList; import java.util.List; import org.junit.Before; @@ -36,46 +23,23 @@ import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.runners.MockitoJUnitRunner; -import org.sagebionetworks.repo.model.Challenge; -import org.sagebionetworks.repo.model.Entity; -import org.sagebionetworks.repo.model.EntityHeader; -import org.sagebionetworks.repo.model.PaginatedTeamIds; -import org.sagebionetworks.repo.model.Project; -import org.sagebionetworks.repo.model.ProjectHeader; -import org.sagebionetworks.repo.model.ProjectHeaderList; -import org.sagebionetworks.repo.model.ProjectListSortColumn; -import org.sagebionetworks.repo.model.ProjectListType; -import org.sagebionetworks.repo.model.Team; -import org.sagebionetworks.repo.model.UserBundle; -import org.sagebionetworks.repo.model.UserProfile; -import org.sagebionetworks.repo.model.UserSessionData; +import org.sagebionetworks.repo.model.*; import org.sagebionetworks.repo.model.auth.Session; import org.sagebionetworks.repo.model.entity.query.SortDirection; import org.sagebionetworks.repo.model.principal.PrincipalAliasRequest; import org.sagebionetworks.repo.model.principal.PrincipalAliasResponse; import org.sagebionetworks.schema.adapter.JSONObjectAdapterException; -import org.sagebionetworks.web.client.DisplayConstants; -import org.sagebionetworks.web.client.GWTWrapper; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.LinkedInServiceAsync; -import org.sagebionetworks.web.client.PlaceChanger; -import org.sagebionetworks.web.client.PortalGinInjector; -import org.sagebionetworks.web.client.SynapseJSNIUtils; -import org.sagebionetworks.web.client.SynapseJSNIUtilsImpl; -import org.sagebionetworks.web.client.SynapseJavascriptClient; -import org.sagebionetworks.web.client.UserAccountServiceAsync; +import org.sagebionetworks.web.client.*; import org.sagebionetworks.web.client.place.Profile; import org.sagebionetworks.web.client.place.Synapse; import org.sagebionetworks.web.client.place.Synapse.ProfileArea; import org.sagebionetworks.web.client.presenter.ProfilePresenter; import org.sagebionetworks.web.client.presenter.ProjectFilterEnum; -import org.sagebionetworks.web.client.presenter.SettingsPresenter; import org.sagebionetworks.web.client.security.AuthenticationController; import org.sagebionetworks.web.client.utils.Callback; import org.sagebionetworks.web.client.utils.CallbackP; import org.sagebionetworks.web.client.view.ProfileView; import org.sagebionetworks.web.client.widget.LoadMoreWidgetContainer; -import org.sagebionetworks.web.client.widget.asynch.IsACTMemberAsyncHandler; import org.sagebionetworks.web.client.widget.entity.ChallengeBadge; import org.sagebionetworks.web.client.widget.entity.ProjectBadge; import org.sagebionetworks.web.client.widget.entity.PromptForValuesModalView; @@ -88,7 +52,7 @@ import org.sagebionetworks.web.test.helper.AsyncMockStubber; import org.sagebionetworks.web.unitserver.ChallengeClientImplTest; -@RunWith(MockitoJUnitRunner.class) +@RunWith(GwtMockitoTestRunner.class) public class ProfilePresenterTest { ProfilePresenter profilePresenter; @@ -161,9 +125,6 @@ public class ProfilePresenterTest { @Mock Team mockTeam; - @Mock - SettingsPresenter mockSettingsPresenter; - @Mock LoadMoreWidgetContainer mockLoadMoreContainer; @@ -222,7 +183,6 @@ public void setup() throws JSONObjectAdapterException { .thenReturn(mockUserProfileEditorWidget); when(mockInjector.getProjectBadgeWidget()).thenReturn(mockProjectBadge); when(mockInjector.getChallengeBadgeWidget()).thenReturn(mockChallengeBadge); - when(mockInjector.getSettingsPresenter()).thenReturn(mockSettingsPresenter); when(mockInjector.getSynapseJSNIUtils()).thenReturn(mockJSNIUtils); userProfile.setDisplayName("tester"); userProfile.setOwnerId("1"); @@ -1475,8 +1435,6 @@ public void testTabClickedSettings() { profilePresenter.setPlace(place); profilePresenter.showTab(ProfileArea.SETTINGS, true); verify(mockView).setTabSelected(eq(ProfileArea.SETTINGS)); - verify(mockSettingsPresenter).configure(); - verify(mockView).setSettingsWidget(any(Widget.class)); } @Test diff --git a/src/test/java/org/sagebionetworks/web/unitclient/presenter/SettingsPresenterTest.java b/src/test/java/org/sagebionetworks/web/unitclient/presenter/SettingsPresenterTest.java deleted file mode 100644 index 86b465f10b..0000000000 --- a/src/test/java/org/sagebionetworks/web/unitclient/presenter/SettingsPresenterTest.java +++ /dev/null @@ -1,616 +0,0 @@ -package org.sagebionetworks.web.unitclient.presenter; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyInt; -import static org.mockito.Matchers.anyList; -import static org.mockito.Matchers.anyLong; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Matchers.isA; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; -import static org.sagebionetworks.web.client.utils.FutureUtils.getDoneFuture; - -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Widget; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Mock; -import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; -import org.sagebionetworks.repo.model.UserBundle; -import org.sagebionetworks.repo.model.UserProfile; -import org.sagebionetworks.repo.model.auth.ChangePasswordWithCurrentPassword; -import org.sagebionetworks.repo.model.auth.TwoFactorAuthStatus; -import org.sagebionetworks.repo.model.auth.TwoFactorState; -import org.sagebionetworks.repo.model.oauth.OAuthProvider; -import org.sagebionetworks.repo.model.principal.NotificationEmail; -import org.sagebionetworks.repo.model.verification.AttachmentMetadata; -import org.sagebionetworks.repo.model.verification.VerificationState; -import org.sagebionetworks.repo.model.verification.VerificationStateEnum; -import org.sagebionetworks.repo.model.verification.VerificationSubmission; -import org.sagebionetworks.schema.adapter.AdapterFactory; -import org.sagebionetworks.schema.adapter.JSONObjectAdapterException; -import org.sagebionetworks.schema.adapter.org.json.AdapterFactoryImpl; -import org.sagebionetworks.web.client.DisplayConstants; -import org.sagebionetworks.web.client.DisplayUtils; -import org.sagebionetworks.web.client.GWTWrapper; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.PlaceChanger; -import org.sagebionetworks.web.client.PopupUtilsView; -import org.sagebionetworks.web.client.PortalGinInjector; -import org.sagebionetworks.web.client.SynapseClientAsync; -import org.sagebionetworks.web.client.SynapseJavascriptClient; -import org.sagebionetworks.web.client.cookie.CookieProvider; -import org.sagebionetworks.web.client.place.LoginPlace; -import org.sagebionetworks.web.client.place.Profile; -import org.sagebionetworks.web.client.presenter.SettingsPresenter; -import org.sagebionetworks.web.client.security.AuthenticationController; -import org.sagebionetworks.web.client.utils.Callback; -import org.sagebionetworks.web.client.view.SettingsView; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; -import org.sagebionetworks.web.client.widget.profile.EmailAddressesWidget; -import org.sagebionetworks.web.client.widget.verification.VerificationSubmissionWidget; -import org.sagebionetworks.web.shared.exceptions.RestServiceException; -import org.sagebionetworks.web.test.helper.AsyncMockStubber; - -@RunWith(MockitoJUnitRunner.class) -public class SettingsPresenterTest { - - private static final String CURRENT_USER_ID = "94837"; - private static final String APIKEY = "MYAPIKEY"; - private static final String APIKEY2 = "MYAPIKEY2"; - SettingsPresenter presenter; - - @Mock - SettingsView mockView; - - @Mock - AuthenticationController mockAuthenticationController; - - @Mock - GlobalApplicationState mockGlobalApplicationState; - - @Mock - PlaceChanger mockPlaceChanger; - - @Mock - SynapseClientAsync mockSynapseClient; - - @Mock - GWTWrapper mockGWT; - - @Mock - PortalGinInjector mockInjector; - - @Mock - SynapseAlert mockSynAlert; - - UserProfile profile = new UserProfile(); - String password = "password"; - String newPassword = "otherpassword"; - String username = "testuser"; - String email = "testuser@test.com"; - AdapterFactory adapterFactory = new AdapterFactoryImpl(); - - @Mock - EmailAddressesWidget mockEmailAddressesWidget; - - @Mock - SynapseJavascriptClient mockSynapseJavascriptClient; - - @Mock - UserBundle mockUserBundle; - - @Mock - PopupUtilsView mockPopupUtils; - - List verificationStateList; - - @Mock - VerificationSubmissionWidget mockVerificationSubmissionModal; - - @Mock - VerificationSubmission mockVerificationSubmission; - - @Mock - NotificationEmail mockNotificationEmail; - - @Mock - CookieProvider mockCookieProvider; - - TwoFactorAuthStatus twoFactorDisabledStatus = new TwoFactorAuthStatus(); - - @Before - public void setup() throws JSONObjectAdapterException { - when(mockInjector.getSynapseAlertWidget()).thenReturn(mockSynAlert); - - presenter = - new SettingsPresenter( - mockView, - mockAuthenticationController, - mockGlobalApplicationState, - mockSynapseClient, - mockInjector, - mockEmailAddressesWidget, - mockPopupUtils, - mockSynapseJavascriptClient - ); - verify(mockView).setPresenter(presenter); - when(mockAuthenticationController.isLoggedIn()).thenReturn(true); - when(mockAuthenticationController.getCurrentUserProfile()) - .thenReturn(profile); - when(mockGlobalApplicationState.getPlaceChanger()) - .thenReturn(mockPlaceChanger); - when(mockInjector.getCookieProvider()).thenReturn(mockCookieProvider); - AsyncMockStubber - .callSuccessWith(APIKEY) - .when(mockSynapseClient) - .getAPIKey(any(AsyncCallback.class)); - AsyncMockStubber - .callSuccessWith(profile) - .when(mockSynapseJavascriptClient) - .getUserProfile(anyString(), any(AsyncCallback.class)); - AsyncMockStubber - .callSuccessWith(mockUserBundle) - .when(mockSynapseJavascriptClient) - .getUserBundle(anyLong(), anyInt(), any(AsyncCallback.class)); - AsyncMockStubber - .callSuccessWith(null) - .when(mockSynapseJavascriptClient) - .unbindOAuthProvidersUserId( - any(OAuthProvider.class), - anyString(), - any(AsyncCallback.class) - ); - when(mockUserBundle.getUserProfile()).thenReturn(profile); - AsyncMockStubber - .callSuccessWith(null) - .when(mockSynapseClient) - .updateUserProfile(any(UserProfile.class), any(AsyncCallback.class)); - when(mockNotificationEmail.getEmail()).thenReturn(email); - AsyncMockStubber - .callSuccessWith(mockNotificationEmail) - .when(mockSynapseJavascriptClient) - .getNotificationEmail(any(AsyncCallback.class)); - AsyncMockStubber - .callSuccessWith(null) - .when(mockSynapseClient) - .setNotificationEmail(anyString(), any(AsyncCallback.class)); - AsyncMockStubber - .callSuccessWith(null) - .when(mockSynapseJavascriptClient) - .additionalEmailValidation( - anyString(), - anyString(), - anyString(), - any(AsyncCallback.class) - ); - AsyncMockStubber - .callSuccessWith(APIKEY2) - .when(mockSynapseClient) - .deleteApiKey(any(AsyncCallback.class)); - - profile.setDisplayName("tester"); - profile.setEmail(username); - profile.setUserName(username); - List emails = new ArrayList(); - emails.add(email); - profile.setEmails(emails); - - twoFactorDisabledStatus.setStatus(TwoFactorState.DISABLED); - - when(mockUserBundle.getVerificationSubmission()) - .thenReturn(mockVerificationSubmission); - when(mockInjector.getVerificationSubmissionWidget()) - .thenReturn(mockVerificationSubmissionModal); - verificationStateList = new ArrayList(); - VerificationState oldState = new VerificationState(); - oldState.setState(VerificationStateEnum.SUSPENDED); - oldState.setReason("numerous violations of the terms of use"); - verificationStateList.add(oldState); - when(mockVerificationSubmission.getStateHistory()) - .thenReturn(verificationStateList); - when( - mockVerificationSubmissionModal.setResubmitCallback(any(Callback.class)) - ) - .thenReturn(mockVerificationSubmissionModal); - when( - mockVerificationSubmissionModal.configure( - any(VerificationSubmission.class), - anyBoolean(), - anyBoolean() - ) - ) - .thenReturn(mockVerificationSubmissionModal); - when(mockAuthenticationController.isLoggedIn()).thenReturn(true); - when(mockAuthenticationController.getCurrentUserPrincipalId()) - .thenReturn(CURRENT_USER_ID); - - when(mockSynapseJavascriptClient.getTwoFactorAuthStatusForCurrentUser()) - .thenReturn(getDoneFuture(twoFactorDisabledStatus)); - } - - // if notification settings are null, should still successfully update with user specified - // notification setting - public void testUpdateMyNotificationSettingsLazyInstantiation() - throws JSONObjectAdapterException { - // creates new UserProfile notification settings - boolean sendEmailNotifications = true; - boolean markEmailedMessagesAsRead = true; - assertNull(profile.getNotificationSettings()); - presenter.updateMyNotificationSettings( - sendEmailNotifications, - markEmailedMessagesAsRead - ); - - ArgumentCaptor argument = ArgumentCaptor.forClass( - UserProfile.class - ); - // should have called updateUserProfile - verify(mockSynapseClient) - .updateUserProfile(argument.capture(), any(AsyncCallback.class)); - // with our new notification settings - UserProfile updatedProfile = argument.getValue(); - assertNotNull(updatedProfile.getNotificationSettings()); - assertEquals( - sendEmailNotifications, - updatedProfile.getNotificationSettings().getSendEmailNotifications() - ); - assertEquals( - markEmailedMessagesAsRead, - updatedProfile.getNotificationSettings().getMarkEmailedMessagesAsRead() - ); - verify(mockView) - .showInfo(eq(DisplayConstants.UPDATED_NOTIFICATION_SETTINGS)); - } - - @Test - public void testUpdateMyNotificationSettings() - throws JSONObjectAdapterException { - // updates existing UserProfile notification settings - boolean sendEmailNotifications = false; - boolean markEmailedMessagesAsRead = false; - - org.sagebionetworks.repo.model.message.Settings notificationSettings = - new org.sagebionetworks.repo.model.message.Settings(); - notificationSettings.setMarkEmailedMessagesAsRead(true); - notificationSettings.setSendEmailNotifications(true); - profile.setNotificationSettings(notificationSettings); - assertNotNull(profile.getNotificationSettings()); - presenter.updateMyNotificationSettings( - sendEmailNotifications, - markEmailedMessagesAsRead - ); - - ArgumentCaptor argument = ArgumentCaptor.forClass( - UserProfile.class - ); - // should have called updateUserProfile - verify(mockSynapseClient) - .updateUserProfile(argument.capture(), any(AsyncCallback.class)); - // with our new notification settings - UserProfile updatedProfile = argument.getValue(); - assertEquals( - sendEmailNotifications, - updatedProfile.getNotificationSettings().getSendEmailNotifications() - ); - assertEquals( - markEmailedMessagesAsRead, - updatedProfile.getNotificationSettings().getMarkEmailedMessagesAsRead() - ); - verify(mockView) - .showInfo(eq(DisplayConstants.UPDATED_NOTIFICATION_SETTINGS)); - } - - @Test - public void testUpdateMyNotificationSettingsFailure() - throws JSONObjectAdapterException { - Exception ex = new Exception("unexpected exception"); - AsyncMockStubber - .callFailureWith(ex) - .when(mockSynapseClient) - .updateUserProfile(any(UserProfile.class), any(AsyncCallback.class)); - presenter.updateMyNotificationSettings(true, true); - verify(mockSynapseClient) - .updateUserProfile(any(UserProfile.class), any(AsyncCallback.class)); - verify(mockSynAlert).handleException(ex); - } - - @Test - public void testGetAPIKey() { - presenter.getAPIKey(); - verify(mockSynapseClient).getAPIKey(any(AsyncCallback.class)); - verify(mockView).setApiKey(APIKEY); - - // verify not cached - presenter.getAPIKey(); - verify(mockSynapseClient, times(2)).getAPIKey(any(AsyncCallback.class)); - } - - @Test - public void testGetAPIKeyFailure() { - Exception e = new Exception(); - AsyncMockStubber - .callFailureWith(e) - .when(mockSynapseClient) - .getAPIKey(any(AsyncCallback.class)); - presenter.getAPIKey(); - verify(mockSynapseClient).getAPIKey(any(AsyncCallback.class)); - verify(mockSynAlert).handleException(e); - } - - @Test - public void testOnEditProfile() { - presenter.onEditProfile(); - - verify(mockPlaceChanger).goTo(isA(Profile.class)); - } - - @Test - public void testConfigure() { - when(mockGlobalApplicationState.isShowingUTCTime()).thenReturn(false); - presenter.configure(); - verify(mockSynAlert, times(2)).clear(); - verify(mockView).clear(); - verify(mockView).updateNotificationCheckbox(profile); - verify(mockAuthenticationController).updateCachedProfile(profile); - verify(mockView).setShowingLocalTime(); - } - - @Test - public void testConfigureIsShowingUTCTime() { - when(mockGlobalApplicationState.isShowingUTCTime()).thenReturn(true); - presenter.configure(); - verify(mockView).setShowingUTCTime(); - } - - @Test - public void testConfigureFailure() { - Exception ex = new Exception("error occurred"); - AsyncMockStubber - .callFailureWith(ex) - .when(mockSynapseJavascriptClient) - .getUserBundle(anyLong(), anyInt(), any(AsyncCallback.class)); - presenter.configure(); - verify(mockView).clear(); - verify(mockSynAlert).handleException(ex); - } - - @Test - public void testAsWidget() { - presenter.asWidget(); - verify(mockView).asWidget(); - } - - @Test - public void testConfigureAnonymousSWC2943() { - // used to result in NPE before fix for SWC-2943 - when(mockAuthenticationController.isLoggedIn()).thenReturn(false); - when(mockAuthenticationController.getCurrentUserProfile()).thenReturn(null); - presenter.configure(); - verify(mockView).clear(); - } - - @Test - public void testConfirmAPIKeyChange() { - presenter.changeApiKey(); - ArgumentCaptor captor = ArgumentCaptor.forClass(Callback.class); - verify(mockView).showConfirm(anyString(), captor.capture()); - - Callback callback = captor.getValue(); - verify(mockSynapseClient, never()).deleteApiKey(any(AsyncCallback.class)); - verify(mockView, never()).setApiKey(APIKEY2); - - callback.invoke(); - verify(mockSynapseClient).deleteApiKey(any(AsyncCallback.class)); - verify(mockView).setApiKey(APIKEY2); - } - - @Test - public void testAPIKeyChangeConfirmedFailure() { - Exception e = new Exception(); - AsyncMockStubber - .callFailureWith(e) - .when(mockSynapseClient) - .deleteApiKey(any(AsyncCallback.class)); - presenter.changeApiKeyPostConfirmation(); - verify(mockSynapseClient).deleteApiKey(any(AsyncCallback.class)); - verify(mockSynAlert).handleException(e); - } - - @Test - public void testSetShowUTCTime() { - presenter.setShowUTCTime(true); - verify(mockGlobalApplicationState).setShowUTCTime(true); - } - - private void setupVerificationState(VerificationStateEnum s, String reason) { - when(mockAuthenticationController.isLoggedIn()).thenReturn(true); - VerificationState state = new VerificationState(); - state.setState(s); - state.setReason(reason); - verificationStateList.add(state); - } - - @Test - public void testVerificationUIInitRejectedIsOwner() { - setupVerificationState(VerificationStateEnum.REJECTED, "bad behavior"); - when(mockUserBundle.getIsVerified()).thenReturn(false); - - presenter.configure(); - - verify(mockView).setVerificationRejectedButtonVisible(true); - verify(mockView).setResubmitVerificationButtonVisible(true); - } - - @Test - public void testVerificationUIInitSuspendedIsOwner() { - setupVerificationState( - VerificationStateEnum.SUSPENDED, - "missing documents" - ); - when(mockUserBundle.getIsVerified()).thenReturn(false); - - presenter.configure(); - - verify(mockView).setVerificationSuspendedButtonVisible(true); - verify(mockView).setResubmitVerificationButtonVisible(true); - } - - @Test - public void testVerificationUIInitApproved() { - setupVerificationState(VerificationStateEnum.APPROVED, null); - - String fName = "Luke"; - String lName = "Skywalker"; - String company = "Rebel Alliance"; - String orcId = "http://orcid/address"; - String location = "Jundland Wastes, Tatooine"; - String friendlyDate = "October 2nd"; - when(mockVerificationSubmission.getFirstName()).thenReturn(fName); - when(mockVerificationSubmission.getLastName()).thenReturn(lName); - when(mockVerificationSubmission.getCompany()).thenReturn(company); - when(mockVerificationSubmission.getOrcid()).thenReturn(orcId); - when(mockVerificationSubmission.getLocation()).thenReturn(location); - - presenter.configure(); - - // user bundle reported that target user is verified - verify(mockView).setVerificationDetailsButtonVisible(true); - } - - @Test - public void testNewVerificationSubmissionClicked() { - when(mockUserBundle.getIsCertified()).thenReturn(true); - // view my own profile. submit a new verification submission, verify that modal is shown - when( - mockVerificationSubmissionModal.configure( - any(UserProfile.class), - anyString(), - anyBoolean(), - anyList() - ) - ) - .thenReturn(mockVerificationSubmissionModal); - presenter.configure(); - presenter.newVerificationSubmissionClicked(); - verify(mockVerificationSubmissionModal) - .configure( - any(UserProfile.class), - anyString(), - eq(true), - eq(new ArrayList()) - ); - verify(mockVerificationSubmissionModal).show(); - } - - @Test - public void testNewVerificationSubmissionClickedWithExistingAttachments() { - // view my own profile. submit a new verification submission, verify that modal is shown - when(mockUserBundle.getIsCertified()).thenReturn(true); - String currentUserId = "94837"; - when(mockAuthenticationController.isLoggedIn()).thenReturn(true); - when(mockAuthenticationController.getCurrentUserPrincipalId()) - .thenReturn(currentUserId); - AttachmentMetadata attachment = mock(AttachmentMetadata.class); - List attachmentList = Collections.singletonList( - attachment - ); - when(mockVerificationSubmission.getAttachments()) - .thenReturn(attachmentList); - when( - mockVerificationSubmissionModal.configure( - any(UserProfile.class), - anyString(), - anyBoolean(), - anyList() - ) - ) - .thenReturn(mockVerificationSubmissionModal); - presenter.configure(); - presenter.newVerificationSubmissionClicked(); - verify(mockVerificationSubmissionModal) - .configure( - any(UserProfile.class), - anyString(), - eq(true), - eq(attachmentList) - ); - verify(mockVerificationSubmissionModal).show(); - } - - @Test - public void testEditVerificationSubmissionClicked() { - // view my own profile. submit a new verification submission, verify that modal is shown - String currentUserId = "94837"; - when(mockAuthenticationController.isLoggedIn()).thenReturn(true); - when(mockAuthenticationController.getCurrentUserPrincipalId()) - .thenReturn(currentUserId); - presenter.configure(); - presenter.editVerificationSubmissionClicked(); - verify(mockVerificationSubmissionModal) - .configure(eq(mockVerificationSubmission), anyBoolean(), eq(true)); - verify(mockVerificationSubmissionModal) - .setResubmitCallback(any(Callback.class)); - verify(mockVerificationSubmissionModal).show(); - } - - @Test - public void testUnbindOrcId() { - presenter.configure(); - presenter.unbindOrcIdAfterConfirmation(); - // success message and page refresh - verify(mockView).showInfo(anyString()); - verify(mockGlobalApplicationState).refreshPage(); - } - - @Test - public void testUnbindOrcIdFailure() { - Exception ex = new Exception("bad things happened"); - AsyncMockStubber - .callFailureWith(ex) - .when(mockSynapseJavascriptClient) - .unbindOAuthProvidersUserId( - any(OAuthProvider.class), - anyString(), - any(AsyncCallback.class) - ); - presenter.configure(); - presenter.unbindOrcIdAfterConfirmation(); - // error is shown - verify(mockSynAlert).handleException(ex); - } - - @Test - public void testApiKeySettingsHidden() { - when( - mockCookieProvider.getCookie(DisplayUtils.SYNAPSE_TEST_WEBSITE_COOKIE_KEY) - ) - .thenReturn(null); - presenter.configure(); - verify(mockView).setApiKeySettingsVisible(false); - } - - @Test - public void testApiKeySettingsShownInExperimentalMode() { - when( - mockCookieProvider.getCookie(DisplayUtils.SYNAPSE_TEST_WEBSITE_COOKIE_KEY) - ) - .thenReturn("true"); - presenter.configure(); - verify(mockView).setApiKeySettingsVisible(true); - } -} diff --git a/src/test/java/org/sagebionetworks/web/unitclient/presenter/TwoFactorAuthPresenterTest.java b/src/test/java/org/sagebionetworks/web/unitclient/presenter/TwoFactorAuthPresenterTest.java deleted file mode 100644 index 81f13eb3a2..0000000000 --- a/src/test/java/org/sagebionetworks/web/unitclient/presenter/TwoFactorAuthPresenterTest.java +++ /dev/null @@ -1,120 +0,0 @@ -package org.sagebionetworks.web.unitclient.presenter; - -import static org.junit.Assert.assertEquals; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.runners.MockitoJUnitRunner; -import org.sagebionetworks.schema.adapter.JSONObjectAdapterException; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.PlaceChanger; -import org.sagebionetworks.web.client.place.Profile; -import org.sagebionetworks.web.client.place.Synapse; -import org.sagebionetworks.web.client.place.TwoFactorAuthPlace; -import org.sagebionetworks.web.client.presenter.TwoFactorAuthPresenter; -import org.sagebionetworks.web.client.view.TwoFactorAuthView; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; - -@RunWith(MockitoJUnitRunner.class) -public class TwoFactorAuthPresenterTest { - - TwoFactorAuthPresenter presenter; - - @Mock - TwoFactorAuthView mockView; - - @Mock - GlobalApplicationState mockGlobalApplicationState; - - @Mock - PlaceChanger mockPlaceChanger; - - @Captor - ArgumentCaptor twoFactorAuthPlaceCaptor; - - @Captor - ArgumentCaptor profilePlaceCaptor; - - @Mock - SynapseAlert mockSynAlert; - - @Before - public void setup() throws JSONObjectAdapterException { - when(mockGlobalApplicationState.getPlaceChanger()) - .thenReturn(mockPlaceChanger); - presenter = - new TwoFactorAuthPresenter( - mockView, - mockGlobalApplicationState, - mockSynAlert - ); - verify(mockView).setPresenter(presenter); - verify(mockView).setSynAlert(mockSynAlert); - } - - @Test - public void testConfigureBeginEnrollment() { - TwoFactorAuthPlace beginEnrollmentPlace = new TwoFactorAuthPlace( - TwoFactorAuthPlace.BEGIN_ENROLLMENT - ); - - presenter.configureView(beginEnrollmentPlace); - - verify(mockView).showTwoFactorEnrollmentForm(); - } - - @Test - public void testConfigureCreateRecoveryCodes() { - TwoFactorAuthPlace createRecoveryCodesPlace = new TwoFactorAuthPlace( - TwoFactorAuthPlace.CREATE_RECOVERY_CODES - ); - - presenter.configureView(createRecoveryCodesPlace); - - verify(mockView).showGenerateRecoveryCodes(false); - } - - @Test - public void testConfigureReplaceRecoveryCodes() { - TwoFactorAuthPlace replaceRecoveryCodesPlace = new TwoFactorAuthPlace( - TwoFactorAuthPlace.REPLACE_RECOVERY_CODES - ); - - presenter.configureView(replaceRecoveryCodesPlace); - - verify(mockView).showGenerateRecoveryCodes(true); - } - - @Test - public void testOnTwoFactorEnrollmentComplete() { - presenter.onTwoFactorEnrollmentComplete(); - - verify(mockPlaceChanger).goTo(twoFactorAuthPlaceCaptor.capture()); - - assertEquals( - twoFactorAuthPlaceCaptor.getValue().toToken(), - TwoFactorAuthPlace.CREATE_RECOVERY_CODES - ); - } - - @Test - public void testOnGenerateRecoveryCodesComplete() { - presenter.onGenerateRecoveryCodesComplete(); - - verify(mockPlaceChanger).goTo(profilePlaceCaptor.capture()); - assertEquals( - profilePlaceCaptor.getValue().getUserId(), - Profile.VIEW_PROFILE_TOKEN - ); - assertEquals( - profilePlaceCaptor.getValue().getArea(), - Synapse.ProfileArea.SETTINGS - ); - } -} From f93b30d8fb4589ca2b64cd941817a0ae18769597 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Tue, 28 May 2024 15:14:28 -0400 Subject: [PATCH 04/10] Remove registration page and redirect users to OneSage --- .../web/client/PortalGinModule.java | 5 - .../users/RegisterAccountPresenter.java | 104 ++-------- .../view/users/RegisterAccountView.java | 21 -- .../view/users/RegisterAccountViewImpl.java | 185 ------------------ .../widget/login/LoginWidgetViewImpl.java | 9 +- .../RegisterAccountPresenterTest.java | 156 --------------- 6 files changed, 21 insertions(+), 459 deletions(-) delete mode 100644 src/main/java/org/sagebionetworks/web/client/view/users/RegisterAccountView.java delete mode 100644 src/main/java/org/sagebionetworks/web/client/view/users/RegisterAccountViewImpl.java delete mode 100644 src/test/java/org/sagebionetworks/web/unitclient/presenter/RegisterAccountPresenterTest.java diff --git a/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java b/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java index c593442c13..a4f2800eb3 100644 --- a/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java +++ b/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java @@ -233,11 +233,6 @@ protected void configure() { // NewAccountView bind(NewAccountView.class).to(NewAccountViewImpl.class).in(Singleton.class); - // RegisterAccountView - bind(RegisterAccountView.class) - .to(RegisterAccountViewImpl.class) - .in(Singleton.class); - bind(RegisterWidgetView.class).to(RegisterWidgetViewImpl.class); // ProfileView diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/users/RegisterAccountPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/users/RegisterAccountPresenter.java index bfda11fc94..2cadb47afd 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/users/RegisterAccountPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/users/RegisterAccountPresenter.java @@ -1,112 +1,36 @@ package org.sagebionetworks.web.client.presenter.users; -import static org.sagebionetworks.web.client.ServiceEntryPointUtils.fixServiceEntryPoint; - import com.google.gwt.activity.shared.AbstractActivity; import com.google.gwt.event.shared.EventBus; -import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.AcceptsOneWidget; import com.google.inject.Inject; -import org.sagebionetworks.repo.model.principal.AliasType; -import org.sagebionetworks.web.client.ClientProperties; -import org.sagebionetworks.web.client.DisplayConstants; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.SynapseClientAsync; -import org.sagebionetworks.web.client.place.Profile; import org.sagebionetworks.web.client.place.users.RegisterAccount; import org.sagebionetworks.web.client.presenter.Presenter; -import org.sagebionetworks.web.client.security.AuthenticationController; -import org.sagebionetworks.web.client.view.users.RegisterAccountView; -import org.sagebionetworks.web.client.view.users.RegisterWidget; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; +import org.sagebionetworks.web.shared.WebConstants; public class RegisterAccountPresenter extends AbstractActivity - implements RegisterAccountView.Presenter, Presenter { - - private RegisterAccount place; - private RegisterAccountView view; - - private RegisterWidget registerWidget; - private AuthenticationController authController; - private GlobalApplicationState globalAppState; - SynapseAlert googleSynAlert; - private SynapseClientAsync synapseClient; + implements Presenter { @Inject - public RegisterAccountPresenter( - RegisterAccountView view, - SynapseClientAsync synapseClient, - RegisterWidget registerWidget, - AuthenticationController authController, - GlobalApplicationState globalAppState, - SynapseAlert googleSynAlert - ) { - this.view = view; - this.registerWidget = registerWidget; - this.authController = authController; - this.globalAppState = globalAppState; - this.synapseClient = synapseClient; - this.googleSynAlert = googleSynAlert; - fixServiceEntryPoint(synapseClient); - view.setRegisterWidget(registerWidget.asWidget()); - view.setGoogleSynAlert(googleSynAlert); - registerWidget.setSentEmailCallback(() -> { - view.showEmailSentUI(true); - }); - } + public RegisterAccountPresenter() {} @Override - public void start(AcceptsOneWidget panel, EventBus eventBus) { - // Install the view - panel.setWidget(view); - } + public void start(AcceptsOneWidget panel, EventBus eventBus) {} @Override public void setPlace(RegisterAccount place) { - this.place = place; String token = place.toToken(); - String email = ""; - if (token != null && !ClientProperties.DEFAULT_PLACE_TOKEN.equals(token)) { - email = token.trim(); + if (token != null && token.contains("@")) { + // is likely an email address + Window.Location.replace( + WebConstants.ONESAGE_PRODUCTION_URL + "/register1?email=" + token + ); + } else { + Window.Location.replace( + WebConstants.ONESAGE_PRODUCTION_URL + "/register1" + ); } - registerWidget.setEmail(email); - view.setPresenter(this); - if (authController.isLoggedIn()) { - // SWC-4363 - globalAppState - .getPlaceChanger() - .goTo(new Profile(Profile.VIEW_PROFILE_TOKEN)); - } - } - - /** - * Check that the username/alias is available - * - * @param username - */ - public void checkUsernameAvailable(String username) { - googleSynAlert.clear(); - synapseClient.isAliasAvailable( - username, - AliasType.USER_NAME.toString(), - new AsyncCallback() { - @Override - public void onSuccess(Boolean isAvailable) { - if (!isAvailable) { - googleSynAlert.showError( - DisplayConstants.ERROR_USERNAME_ALREADY_EXISTS - ); - } else { - view.setGoogleRegisterButtonEnabled(true); - } - } - - @Override - public void onFailure(Throwable e) { - googleSynAlert.handleException(e); - } - } - ); } } diff --git a/src/main/java/org/sagebionetworks/web/client/view/users/RegisterAccountView.java b/src/main/java/org/sagebionetworks/web/client/view/users/RegisterAccountView.java deleted file mode 100644 index bfa39db61f..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/view/users/RegisterAccountView.java +++ /dev/null @@ -1,21 +0,0 @@ -package org.sagebionetworks.web.client.view.users; - -import com.google.gwt.user.client.ui.IsWidget; -import com.google.gwt.user.client.ui.Widget; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; - -public interface RegisterAccountView extends IsWidget { - void setRegisterWidget(Widget w); - - void setPresenter(Presenter p); - - void setGoogleSynAlert(SynapseAlert synAlert); - - void setGoogleRegisterButtonEnabled(boolean enabled); - - void showEmailSentUI(boolean visible); - - public interface Presenter { - void checkUsernameAvailable(String username); - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/view/users/RegisterAccountViewImpl.java b/src/main/java/org/sagebionetworks/web/client/view/users/RegisterAccountViewImpl.java deleted file mode 100644 index 905b185be1..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/view/users/RegisterAccountViewImpl.java +++ /dev/null @@ -1,185 +0,0 @@ -package org.sagebionetworks.web.client.view.users; - -import com.google.gwt.event.dom.client.KeyCodes; -import com.google.gwt.event.dom.client.KeyDownHandler; -import com.google.gwt.http.client.URL; -import com.google.gwt.uibinder.client.UiBinder; -import com.google.gwt.uibinder.client.UiField; -import com.google.gwt.user.client.Window; -import com.google.gwt.user.client.ui.Composite; -import com.google.gwt.user.client.ui.Image; -import com.google.gwt.user.client.ui.Widget; -import com.google.inject.Inject; -import org.gwtbootstrap3.client.ui.Button; -import org.gwtbootstrap3.client.ui.TextBox; -import org.gwtbootstrap3.client.ui.html.Div; -import org.gwtbootstrap3.client.ui.html.Span; -import org.sagebionetworks.web.client.ClientProperties; -import org.sagebionetworks.web.client.DisplayConstants; -import org.sagebionetworks.web.client.GWTTimer; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.SageImageBundle; -import org.sagebionetworks.web.client.ValidationUtils; -import org.sagebionetworks.web.client.place.Home; -import org.sagebionetworks.web.client.utils.Callback; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; -import org.sagebionetworks.web.client.widget.header.Header; -import org.sagebionetworks.web.client.widget.pageprogress.PageProgressWidget; -import org.sagebionetworks.web.client.widget.search.SynapseSuggestBox; -import org.sagebionetworks.web.shared.WebConstants; - -public class RegisterAccountViewImpl - extends Composite - implements RegisterAccountView { - - public interface RegisterAccountViewImplUiBinder - extends UiBinder {} - - @UiField - Div registerWidgetContainer; - - @UiField - TextBox userNameField; - - @UiField - Button googleSignUpButton; - - @UiField - Div googleSynAlertContainer; - - @UiField - Div googleSynapseAccountCreationUI; - - @UiField - Div createSynapseAccountUI; - - @UiField - Div emailSentUI; - - @UiField - Div pageProgressContainer; - - SynapseAlert synAlert; - GWTTimer timer; - Presenter presenter; - private Header headerWidget; - public static final String ROOT_PORTAL_URL = - Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/"; - public static final String OAUTH_CALLBACK_URL = - RegisterAccountViewImpl.ROOT_PORTAL_URL + - "Portal/oauth2callback?oauth2provider="; - public static final String GOOGLE_OAUTH_WITH_STATE_CALLBACK_URL = - OAUTH_CALLBACK_URL + "GOOGLE_OAUTH_2_0&state="; - - @Inject - public RegisterAccountViewImpl( - RegisterAccountViewImplUiBinder binder, - GlobalApplicationState globalAppState, - Header headerWidget, - GWTTimer timer, - SageImageBundle sageImageBundle, - PageProgressWidget pageProgressWidget - ) { - initWidget(binder.createAndBindUi(this)); - this.timer = timer; - this.headerWidget = headerWidget; - timer.configure(() -> { - setGoogleRegisterButtonEnabled(false); - if (checkUsernameFormat()) presenter.checkUsernameAvailable( - userNameField.getValue() - ); - }); - Image googleLogo = new Image(sageImageBundle.logoGoogle()); - googleLogo.addStyleName("whiteBackground left padding-10 rounded"); - googleLogo.setHeight("42px"); - googleLogo.setWidth("42px"); - googleSignUpButton.add(googleLogo); - Span googleText = new Span("Sign up with Google"); - googleText.addStyleName("movedown-9"); - googleSignUpButton.add(googleText); - KeyDownHandler register = event -> { - if (event.getNativeEvent().getKeyCode() == KeyCodes.KEY_ENTER) { - googleSignUpButton.click(); - } else { - timer.cancel(); - timer.schedule(SynapseSuggestBox.DELAY); - } - }; - userNameField.addKeyDownHandler(register); - googleSignUpButton.addClickHandler(event -> { - if (checkUsernameFormat()) { - String encodedUsername = URL.encodeQueryString( - userNameField.getValue() - ); - Window.Location.assign( - RegisterAccountViewImpl.GOOGLE_OAUTH_WITH_STATE_CALLBACK_URL + - encodedUsername - ); - } - }); - - pageProgressContainer.add(pageProgressWidget); - Callback backBtnCallback = () -> { - showEmailSentUI(false); - }; - Callback forwardBtnCallback = () -> { - globalAppState - .getPlaceChanger() - .goTo(new Home(ClientProperties.DEFAULT_PLACE_TOKEN)); - }; - pageProgressWidget.configure( - WebConstants.SYNAPSE_GREEN, - 20, - "Back", - backBtnCallback, - "Go to Home", - forwardBtnCallback, - true - ); - } - - @Override - public void showEmailSentUI(boolean visible) { - emailSentUI.setVisible(visible); - createSynapseAccountUI.setVisible(!visible); - } - - private boolean checkUsernameFormat() { - synAlert.clear(); - if ( - userNameField.getValue().length() > 3 && - ValidationUtils.isValidUsername(userNameField.getValue()) - ) { - return true; - } else { - synAlert.showError(DisplayConstants.USERNAME_FORMAT_ERROR); - return false; - } - } - - @Override - public void setRegisterWidget(Widget w) { - registerWidgetContainer.clear(); - registerWidgetContainer.add(w); - } - - @Override - public void setPresenter(final Presenter presenter) { - this.presenter = presenter; - headerWidget.configure(); - headerWidget.refresh(); - Window.scrollTo(0, 0); // scroll user to top of page - } - - @Override - public void setGoogleRegisterButtonEnabled(boolean enabled) { - googleSignUpButton.setEnabled(enabled); - } - - @Override - public void setGoogleSynAlert(SynapseAlert w) { - googleSynAlertContainer.clear(); - googleSynAlertContainer.add(w); - synAlert = w; - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/widget/login/LoginWidgetViewImpl.java b/src/main/java/org/sagebionetworks/web/client/widget/login/LoginWidgetViewImpl.java index d6517370f5..bd2249645f 100644 --- a/src/main/java/org/sagebionetworks/web/client/widget/login/LoginWidgetViewImpl.java +++ b/src/main/java/org/sagebionetworks/web/client/widget/login/LoginWidgetViewImpl.java @@ -3,6 +3,7 @@ import com.google.gwt.place.shared.Place; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.Widget; import com.google.inject.Inject; @@ -16,11 +17,15 @@ import org.sagebionetworks.web.client.place.Profile; import org.sagebionetworks.web.client.place.Synapse.ProfileArea; import org.sagebionetworks.web.client.security.AuthenticationController; -import org.sagebionetworks.web.client.view.users.RegisterAccountViewImpl; import org.sagebionetworks.web.client.widget.ReactComponentDiv; public class LoginWidgetViewImpl implements LoginWidgetView, IsWidget { + public static final String ROOT_PORTAL_URL = + Window.Location.getProtocol() + "//" + Window.Location.getHost() + "/"; + public static final String OAUTH_CALLBACK_URL = + ROOT_PORTAL_URL + "Portal/oauth2callback?oauth2provider="; + public interface LoginWidgetViewImplUiBinder extends UiBinder {} @@ -49,7 +54,7 @@ public LoginWidgetViewImpl( widget.addAttachHandler(event -> { if (event.isAttached()) { LoginPageProps props = LoginPageProps.create( - RegisterAccountViewImpl.OAUTH_CALLBACK_URL, + OAUTH_CALLBACK_URL, null, () -> this.postLogin() ); diff --git a/src/test/java/org/sagebionetworks/web/unitclient/presenter/RegisterAccountPresenterTest.java b/src/test/java/org/sagebionetworks/web/unitclient/presenter/RegisterAccountPresenterTest.java deleted file mode 100644 index 4fcecfb90a..0000000000 --- a/src/test/java/org/sagebionetworks/web/unitclient/presenter/RegisterAccountPresenterTest.java +++ /dev/null @@ -1,156 +0,0 @@ -package org.sagebionetworks.web.unitclient.presenter; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import com.google.gwt.event.shared.EventBus; -import com.google.gwt.place.shared.Place; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.AcceptsOneWidget; -import com.google.gwt.user.client.ui.Widget; -import org.junit.Before; -import org.junit.Test; -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.sagebionetworks.repo.model.principal.AliasType; -import org.sagebionetworks.web.client.DisplayConstants; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.PlaceChanger; -import org.sagebionetworks.web.client.SynapseClientAsync; -import org.sagebionetworks.web.client.place.Profile; -import org.sagebionetworks.web.client.place.users.RegisterAccount; -import org.sagebionetworks.web.client.presenter.users.RegisterAccountPresenter; -import org.sagebionetworks.web.client.security.AuthenticationController; -import org.sagebionetworks.web.client.view.users.RegisterAccountView; -import org.sagebionetworks.web.client.view.users.RegisterWidget; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; -import org.sagebionetworks.web.test.helper.AsyncMockStubber; - -public class RegisterAccountPresenterTest { - - @Mock - RegisterAccountPresenter registerAccountPresenter; - - @Mock - RegisterAccountView mockView; - - @Mock - RegisterAccount mockPlace; - - String email = "test@test.com"; - - @Mock - RegisterWidget mockRegisterWidget; - - @Mock - AuthenticationController mockAuthController; - - @Mock - GlobalApplicationState mockGlobalAppState; - - @Mock - EventBus mockEventBus; - - @Mock - PlaceChanger mockPlaceChanger; - - @Mock - AcceptsOneWidget mockAcceptsOneWidget; - - @Captor - ArgumentCaptor placeCaptor; - - @Mock - SynapseClientAsync mockSynapseClient; - - @Mock - SynapseAlert mockGoogleSynAlert; - - @Before - public void setup() { - MockitoAnnotations.initMocks(this); - when(mockAuthController.isLoggedIn()).thenReturn(false); - when(mockGlobalAppState.getPlaceChanger()).thenReturn(mockPlaceChanger); - registerAccountPresenter = - new RegisterAccountPresenter( - mockView, - mockSynapseClient, - mockRegisterWidget, - mockAuthController, - mockGlobalAppState, - mockGoogleSynAlert - ); - } - - @Test - public void testStart() { - registerAccountPresenter.start(mockAcceptsOneWidget, mockEventBus); - verify(mockAcceptsOneWidget).setWidget(mockView); - } - - @Test - public void testSetPlace() { - // with email - when(mockPlace.toToken()).thenReturn(email); - registerAccountPresenter.setPlace(mockPlace); - - verify(mockRegisterWidget).setEmail(email); - verify(mockView).setRegisterWidget(any(Widget.class)); - } - - @Test - public void testSetPlaceLoggedIn() { - when(mockAuthController.isLoggedIn()).thenReturn(true); - - registerAccountPresenter.setPlace(mockPlace); - - verify(mockPlaceChanger).goTo(placeCaptor.capture()); - Place wentToPlace = placeCaptor.getValue(); - assertTrue(wentToPlace instanceof Profile); - assertEquals(Profile.VIEW_PROFILE_TOKEN, ((Profile) wentToPlace).toToken()); - } - - @Test - public void testIsUsernameAvailableTrue() { - registerAccountPresenter.checkUsernameAvailable("abcd"); - verify(mockSynapseClient) - .isAliasAvailable( - anyString(), - eq(AliasType.USER_NAME.toString()), - any(AsyncCallback.class) - ); - verify(mockGoogleSynAlert).clear(); - verify(mockGoogleSynAlert, never()).showError(anyString()); - verify(mockGoogleSynAlert, never()).handleException(any(Throwable.class)); - } - - @Test - public void testIsUsernameAvailableFalse() { - AsyncMockStubber - .callSuccessWith(false) - .when(mockSynapseClient) - .isAliasAvailable( - anyString(), - eq(AliasType.USER_NAME.toString()), - any(AsyncCallback.class) - ); - registerAccountPresenter.checkUsernameAvailable("abcd"); - verify(mockSynapseClient) - .isAliasAvailable( - anyString(), - eq(AliasType.USER_NAME.toString()), - any(AsyncCallback.class) - ); - verify(mockGoogleSynAlert).clear(); - verify(mockGoogleSynAlert) - .showError(DisplayConstants.ERROR_USERNAME_ALREADY_EXISTS); - } -} From 0da07670a87c52b008ec92e8421880d366f7d1de Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Tue, 28 May 2024 16:52:38 -0400 Subject: [PATCH 05/10] Remove obsolete e2e test --- e2e/account.spec.ts | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 e2e/account.spec.ts diff --git a/e2e/account.spec.ts b/e2e/account.spec.ts deleted file mode 100644 index 1d42ee7b8f..0000000000 --- a/e2e/account.spec.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { expect } from '@playwright/test' -import { testAuth } from './fixtures/authenticatedUserPages' -import { goToDashboard } from './helpers/testUser' - -testAuth.describe('Account Settings', () => { - testAuth('should show certification status', async ({ userPage }) => { - await goToDashboard(userPage) - - await userPage.getByLabel('Your Account').click() - await userPage.getByRole('link', { name: 'Account Settings' }).click() - await expect( - userPage.getByRole('heading', { name: 'Account Settings' }), - ).toBeVisible() - - await expect( - userPage.getByRole('button', { name: 'Passed Certification Quiz' }), - ).toBeVisible() - }) -}) From 3de84dba4b8f49a725c00fd743ffeb2aa9947a20 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Wed, 29 May 2024 12:30:08 -0400 Subject: [PATCH 06/10] Remove ability to edit profile. Redirect to OneSage --- .../web/client/PortalGinInjector.java | 4 +- .../web/client/PortalGinModule.java | 5 +- .../presenter/EmailInvitationPresenter.java | 4 +- .../client/presenter/ProfilePresenter.java | 30 +- .../web/client/view/ProfileView.java | 2 +- .../web/client/view/ProfileViewImpl.java | 4 +- .../profile/UserProfileEditorWidget.java | 101 ------ .../profile/UserProfileEditorWidgetImpl.java | 337 ------------------ .../profile/UserProfileEditorWidgetView.java | 82 ----- .../widget/profile/UserProfileWidget.java | 14 + .../widget/profile/UserProfileWidgetImpl.java | 130 +++++++ .../widget/profile/UserProfileWidgetView.java | 38 ++ ...pl.java => UserProfileWidgetViewImpl.java} | 232 +----------- ...i.xml => UserProfileWidgetViewImpl.ui.xml} | 89 +---- .../presenter/ProfilePresenterTest.java | 35 +- ...st.java => UserProfileWidgetImplTest.java} | 156 +------- 16 files changed, 233 insertions(+), 1030 deletions(-) delete mode 100755 src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidget.java delete mode 100755 src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetImpl.java delete mode 100755 src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetView.java create mode 100755 src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidget.java create mode 100755 src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetImpl.java create mode 100755 src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetView.java rename src/main/java/org/sagebionetworks/web/client/widget/profile/{UserProfileEditorWidgetViewImpl.java => UserProfileWidgetViewImpl.java} (53%) rename src/main/resources/org/sagebionetworks/web/client/widget/profile/{UserProfileEditorWidgetViewImpl.ui.xml => UserProfileWidgetViewImpl.ui.xml} (61%) rename src/test/java/org/sagebionetworks/web/unitclient/widget/profile/{UserProfileEditorWidgetImplTest.java => UserProfileWidgetImplTest.java} (63%) diff --git a/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java b/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java index 28091f826e..94954447ab 100644 --- a/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java +++ b/src/main/java/org/sagebionetworks/web/client/PortalGinInjector.java @@ -184,7 +184,7 @@ import org.sagebionetworks.web.client.widget.lazyload.LazyLoadWikiWidgetWrapper; import org.sagebionetworks.web.client.widget.login.LoginWidget; import org.sagebionetworks.web.client.widget.profile.ProfileCertifiedValidatedWidget; -import org.sagebionetworks.web.client.widget.profile.UserProfileEditorWidget; +import org.sagebionetworks.web.client.widget.profile.UserProfileWidget; import org.sagebionetworks.web.client.widget.provenance.v2.ProvenanceWidget; import org.sagebionetworks.web.client.widget.refresh.DiscussionThreadCountAlert; import org.sagebionetworks.web.client.widget.refresh.EntityRefreshAlert; @@ -782,7 +782,7 @@ public interface PortalGinInjector extends Ginjector { CopyTextModal getCopyTextModal(); - UserProfileEditorWidget getUserProfileEditorWidget(); + UserProfileWidget getUserProfileWidget(); PromptForValuesModalView getPromptForValuesModal(); diff --git a/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java b/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java index a4f2800eb3..4600b05555 100644 --- a/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java +++ b/src/main/java/org/sagebionetworks/web/client/PortalGinModule.java @@ -418,10 +418,9 @@ protected void configure() { // EntityMetadata bind(EntityMetadataView.class).to(EntityMetadataViewImpl.class); - bind(UserProfileEditorWidget.class).to(UserProfileEditorWidgetImpl.class); + bind(UserProfileWidget.class).to(UserProfileWidgetImpl.class); - bind(UserProfileEditorWidgetView.class) - .to(UserProfileEditorWidgetViewImpl.class); + bind(UserProfileWidgetView.class).to(UserProfileWidgetViewImpl.class); bind(ProfileImageView.class).to(ProfileImageViewImpl.class); bind(ProfileImageWidget.class).to(ProfileImageWidgetImpl.class); diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/EmailInvitationPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/EmailInvitationPresenter.java index 4ee8a71d5d..04f5d2b096 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/EmailInvitationPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/EmailInvitationPresenter.java @@ -150,10 +150,10 @@ public void onFailure(Throwable t) { view.showErrorMessage( "This invitation was sent to an email address not associated to the current user. \"" + membershipInvitation.getInviteeEmail() + - "\" Please add this email to your Synapse account under \"Edit Profile\", or log in with the correct Synapse account before accepting the invitation." + "\" Please add this email to your Synapse account by clicking \"Edit Profile\", or log in with the correct Synapse account before accepting the invitation." ); // SWC-4741: invitation not associated to the current user, send user to the Profile page, where they can - // click 'Edit Profile', then 'Change email' to get to OneSage and add the new email address + // click 'Edit Profile' to get to OneSage and add the new email address // NOTE: We don't send the user directly to OneSage so that they have a chance to read the message first placeChanger.goTo( new Profile( diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/ProfilePresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/ProfilePresenter.java index 1129440c39..f5c0d46150 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/ProfilePresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/ProfilePresenter.java @@ -32,7 +32,7 @@ import org.sagebionetworks.web.client.widget.entity.PromptForValuesModalView; import org.sagebionetworks.web.client.widget.entity.browse.EntityBrowserUtils; import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; -import org.sagebionetworks.web.client.widget.profile.UserProfileEditorWidget; +import org.sagebionetworks.web.client.widget.profile.UserProfileWidget; import org.sagebionetworks.web.client.widget.team.OpenTeamInvitationsWidget; import org.sagebionetworks.web.client.widget.team.TeamListWidget; import org.sagebionetworks.web.shared.exceptions.ConflictException; @@ -58,7 +58,7 @@ public class ProfilePresenter private GlobalApplicationState globalApplicationState; private GWTWrapper gwt; private OpenTeamInvitationsWidget openInvitesWidget; - private UserProfileEditorWidget userProfileEditorWidget; + private UserProfileWidget userProfileWidget; private PortalGinInjector ginInjector; private String currentUserId; private boolean isOwner; @@ -139,12 +139,12 @@ public PromptForValuesModalView getPromptDialog() { return promptDialog; } - public UserProfileEditorWidget getUserProfileEditorWidget() { - if (userProfileEditorWidget == null) { - userProfileEditorWidget = ginInjector.getUserProfileEditorWidget(); - view.setUserProfileEditorWidget(userProfileEditorWidget); + public UserProfileWidget getUserProfileWidget() { + if (userProfileWidget == null) { + userProfileWidget = ginInjector.getUserProfileWidget(); + view.setUserProfileWidget(userProfileWidget); } - return userProfileEditorWidget; + return userProfileWidget; } @Override @@ -174,15 +174,6 @@ public String mayStop() { return null; } - public void editMyProfile() { - if (authenticationController.isLoggedIn()) { - getUserProfileEditorWidget().setIsEditingMode(true); - viewMyProfile(); - } else { - view.showLoginAlert(); - } - } - public void viewMyProfile() { if (authenticationController.isLoggedIn()) { // view the current user profile @@ -255,8 +246,6 @@ private void getUserProfile() { Long currentUserIdLong = currentUserId != null ? Long.parseLong(currentUserId) : null; - // capture current state of user profile editor widget, to restore after reconfiguring with the current user profile. - boolean isEditing = getUserProfileEditorWidget().isEditingMode(); jsClient.getUserBundle( currentUserIdLong, mask, @@ -269,7 +258,7 @@ public void onSuccess(UserBundle bundle) { ginInjector .getSynapseJSNIUtils() .setPageTitle(currentUserBundle.getUserProfile().getUserName()); - getUserProfileEditorWidget() + getUserProfileWidget() .configure( bundle.getUserProfile(), bundle.getORCID(), @@ -277,7 +266,6 @@ public void onSuccess(UserBundle bundle) { profileUpdated(); } ); - getUserProfileEditorWidget().setIsEditingMode(isEditing); } @Override @@ -854,7 +842,7 @@ private void showView(Profile place) { updateProfileView(place.getUserId()); } else { if (Profile.EDIT_PROFILE_TOKEN.equals(token)) { - editMyProfile(); + Window.Location.replace(ONESAGE_ACCOUNT_SETTINGS_URL); } else { // if this is a number, then treat it as a a user id try { diff --git a/src/main/java/org/sagebionetworks/web/client/view/ProfileView.java b/src/main/java/org/sagebionetworks/web/client/view/ProfileView.java index 28a4767f63..ff9b7dd85d 100644 --- a/src/main/java/org/sagebionetworks/web/client/view/ProfileView.java +++ b/src/main/java/org/sagebionetworks/web/client/view/ProfileView.java @@ -62,7 +62,7 @@ public interface ProfileView extends IsWidget, SynapseView { void setFavoritesHelpPanelVisible(boolean isVisible); - void setUserProfileEditorWidget(IsWidget userProfileEditorWidget); + void setUserProfileWidget(IsWidget userProfileWidget); void setSettingsWidget(Widget w); diff --git a/src/main/java/org/sagebionetworks/web/client/view/ProfileViewImpl.java b/src/main/java/org/sagebionetworks/web/client/view/ProfileViewImpl.java index 3a5cd77412..f7d226222c 100644 --- a/src/main/java/org/sagebionetworks/web/client/view/ProfileViewImpl.java +++ b/src/main/java/org/sagebionetworks/web/client/view/ProfileViewImpl.java @@ -670,9 +670,9 @@ private void clearFiltersSelected() { } @Override - public void setUserProfileEditorWidget(IsWidget userProfileEditorWidget) { + public void setUserProfileWidget(IsWidget userProfileWidget) { this.editUserProfilePanel.clear(); - this.editUserProfilePanel.add(userProfileEditorWidget); + this.editUserProfilePanel.add(userProfileWidget); } @Override diff --git a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidget.java b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidget.java deleted file mode 100755 index 6bbe315012..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidget.java +++ /dev/null @@ -1,101 +0,0 @@ -package org.sagebionetworks.web.client.widget.profile; - -import com.google.gwt.event.dom.client.KeyDownHandler; -import com.google.gwt.user.client.ui.IsWidget; -import org.sagebionetworks.repo.model.UserProfile; -import org.sagebionetworks.web.client.utils.Callback; - -public interface UserProfileEditorWidget extends IsWidget { - /** - * Configure this widget before using. - * - * @param profile - */ - void configure(UserProfile profile, String orcIDHref, Callback callback); - - /** - * Are the values in this editor valid? - * - * @return - */ - boolean isValid(); - - /** - * Get the first Name. - * - * @return - */ - String getFirstName(); - - /** - * Get the image FileHandle ID. - * - * @return - */ - String getImageId(); - - /** - * Get the user's last name - * - * @return - */ - String getLastName(); - - /** - * Get the username. - * - * @return - */ - String getUsername(); - - /** - * Current position - * - * @return - */ - String getPosition(); - - /** - * Current affiliation - * - * @return - */ - String getCompany(); - - /** - * Industry/Discipline - * - * @return - */ - String getIndustry(); - - /** - * City, Country - * - * @return - */ - String getLocation(); - - /** - * Link to more info - * - * @return - */ - String getUrl(); - - /** - * Bio - * - * @return - */ - String getSummary(); - - void addKeyDownHandler(KeyDownHandler keyDownHandler); - - void setUploadingCallback(Callback startedUploadingCallback); - - void setUploadingCompleteCallback(Callback uploadCompleteCallback); - - void setIsEditingMode(boolean isEditing); - boolean isEditingMode(); -} diff --git a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetImpl.java b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetImpl.java deleted file mode 100755 index 189186227a..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetImpl.java +++ /dev/null @@ -1,337 +0,0 @@ -package org.sagebionetworks.web.client.widget.profile; - -import com.google.gwt.event.dom.client.KeyDownHandler; -import com.google.gwt.user.client.rpc.AsyncCallback; -import com.google.gwt.user.client.ui.Widget; -import com.google.inject.Inject; -import org.gwtbootstrap3.client.ui.constants.ButtonSize; -import org.gwtbootstrap3.client.ui.constants.ButtonType; -import org.gwtbootstrap3.client.ui.constants.IconType; -import org.sagebionetworks.repo.model.UserProfile; -import org.sagebionetworks.repo.model.principal.NotificationEmail; -import org.sagebionetworks.web.client.GlobalApplicationState; -import org.sagebionetworks.web.client.PopupUtilsView; -import org.sagebionetworks.web.client.PortalGinInjector; -import org.sagebionetworks.web.client.SynapseJavascriptClient; -import org.sagebionetworks.web.client.ValidationUtils; -import org.sagebionetworks.web.client.cache.ClientCache; -import org.sagebionetworks.web.client.place.Profile; -import org.sagebionetworks.web.client.place.Synapse.ProfileArea; -import org.sagebionetworks.web.client.security.AuthenticationController; -import org.sagebionetworks.web.client.utils.Callback; -import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; -import org.sagebionetworks.web.client.widget.upload.ImageUploadWidget; -import org.sagebionetworks.web.shared.WebConstants; - -public class UserProfileEditorWidgetImpl - implements UserProfileEditorWidget, UserProfileEditorWidgetView.Presenter { - - public static final String PLEASE_ENTER_A_VALID_URL = - "Please enter a valid URL"; - public static final String CAN_ONLY_INCLUDE = - "Can only include letters, numbers, dot (.), dash (-), and underscore (_)"; - public static final String MUST_BE_AT_LEAST_3_CHARACTERS = - "Must be at least 3 characters"; - public static final String SEE_ERRORS_ABOVE = "See errors above."; - - UserProfileEditorWidgetView view; - ProfileImageWidget imageWidget; - ImageUploadWidget fileHandleUploadWidget; - String fileHandleId; - Callback uploadCompleteCallback; - UserProfile originalProfile; - SynapseJavascriptClient jsClient; - ClientCache clientCache; - AuthenticationController authController; - GlobalApplicationState globalAppState; - SynapseAlert synAlert; - PopupUtilsView popupUtils; - String orcIdHref; - Callback callback; - boolean isEditing = false; - - @Inject - public UserProfileEditorWidgetImpl( - UserProfileEditorWidgetView view, - ProfileImageWidget imageWidget, - ImageUploadWidget fileHandleUploadWidget, - SynapseJavascriptClient jsClient, - ClientCache clientCache, - AuthenticationController authController, - PortalGinInjector ginInjector, - SynapseAlert synAlert, - PopupUtilsView popupUtils, - GlobalApplicationState globalAppState - ) { - super(); - this.view = view; - this.imageWidget = imageWidget; - this.fileHandleUploadWidget = fileHandleUploadWidget; - this.jsClient = jsClient; - this.clientCache = clientCache; - this.authController = authController; - this.synAlert = synAlert; - this.popupUtils = popupUtils; - this.globalAppState = globalAppState; - fileHandleUploadWidget.setView(ginInjector.getCroppedImageUploadView()); - fileHandleUploadWidget.addStyleName("editProfileImageButton"); - fileHandleUploadWidget.setButtonIcon(IconType.EDIT); - fileHandleUploadWidget.setButtonText(""); - fileHandleUploadWidget.setButtonType(ButtonType.DEFAULT); - fileHandleUploadWidget.setButtonSize(ButtonSize.SMALL); - fileHandleUploadWidget.setVisible(false); - imageWidget.setRemovePictureCommandVisible(false); - this.view.addFileInputWidget(fileHandleUploadWidget); - this.view.addImageWidget(imageWidget); - this.view.setPresenter(this); - this.view.setSynAlert(synAlert); - } - - @Override - public Widget asWidget() { - return this.view.asWidget(); - } - - @Override - public void configure( - UserProfile profile, - String orcIdHref, - Callback callback - ) { - this.callback = callback; - this.orcIdHref = orcIdHref; - originalProfile = profile; - view.hideUsernameError(); - view.hideLinkError(); - synAlert.clear(); - view.clearEmails(); - view.setUsername(profile.getUserName()); - view.setFirstName(profile.getFirstName()); - view.setLastName(profile.getLastName()); - view.setCurrentPosition(profile.getPosition()); - view.setCurrentAffiliation(profile.getCompany()); - view.setBio(profile.getSummary()); - view.setIndustry(profile.getIndustry()); - view.setLocation(profile.getLocation()); - view.setLink(profile.getUrl()); - boolean isCurrentUserProfile = profile - .getOwnerId() - .equals(authController.getCurrentUserPrincipalId()); - boolean isEmailAvailable = - profile.getEmails() != null && profile.getEmails().size() > 0; - view.setEmailsVisible(isEmailAvailable); - if (isEmailAvailable) { - // find out what the primary (notification) email address is - // SWC-5599: the first email is not the notification email address. - if (isCurrentUserProfile) { - jsClient.getNotificationEmail( - new AsyncCallback() { - @Override - public void onFailure(Throwable caught) { - synAlert.handleException(caught); - } - - public void onSuccess(NotificationEmail notificationEmail) { - view.setEmails(profile.getEmails(), notificationEmail.getEmail()); - } - } - ); - } else { - view.setEmails(profile.getEmails(), null); - } - } - view.setOrcIdHref(orcIdHref); - view.setOwnerId(profile.getOwnerId()); - setIsEditingMode(false); - view.setCanEdit(isCurrentUserProfile); - this.fileHandleId = profile.getProfilePicureFileHandleId(); - imageWidget.configure(profile.getOwnerId(), this.fileHandleId); - imageWidget.setRemovePictureCallback( - new Callback() { - @Override - public void invoke() { - setNewFileHandle(null); - } - } - ); - fileHandleUploadWidget.configure(fileUploaded -> { - setNewFileHandle(fileUploaded.getFileHandleId()); - }); - } - - @Override - public boolean isValid() { - view.hideUsernameError(); - view.hideLinkError(); - boolean valid = true; - // username - String username = view.getUsername(); - if (!ValidationUtils.isValidUsername(username)) { - valid = false; - if (username.length() < 3) { - view.showUsernameError(MUST_BE_AT_LEAST_3_CHARACTERS); - } else { - view.showUsernameError(CAN_ONLY_INCLUDE); - } - } - // link - String link = view.getLink(); - if (link != null && !"".equals(link.trim())) { - if (!ValidationUtils.isValidUrl(link, true)) { - valid = false; - view.showLinkError(PLEASE_ENTER_A_VALID_URL); - } - } - return valid; - } - - @Override - public String getFirstName() { - return view.getFirstName(); - } - - @Override - public String getImageId() { - return fileHandleId; - } - - @Override - public String getLastName() { - return view.getLastName(); - } - - @Override - public String getUsername() { - return view.getUsername(); - } - - @Override - public String getPosition() { - return view.getCurrentPosition(); - } - - @Override - public String getCompany() { - return view.getCurrentAffiliation(); - } - - @Override - public String getIndustry() { - return view.getIndustry(); - } - - @Override - public String getLocation() { - return view.getLocation(); - } - - @Override - public String getUrl() { - return view.getLink(); - } - - @Override - public String getSummary() { - return view.getBio(); - } - - public void setNewFileHandle(String fileHandleId) { - this.fileHandleId = fileHandleId; - this.fileHandleUploadWidget.reset(); - this.imageWidget.configure(this.fileHandleId); - if (uploadCompleteCallback != null) { - uploadCompleteCallback.invoke(); - } - } - - @Override - public void addKeyDownHandler(KeyDownHandler keyDownHandler) { - view.addKeyDownHandlerToFields(keyDownHandler); - } - - @Override - public void setUploadingCallback(Callback startedUploadingCallback) { - fileHandleUploadWidget.setUploadingCallback(startedUploadingCallback); - } - - @Override - public void setUploadingCompleteCallback(Callback uploadCompleteCallback) { - this.uploadCompleteCallback = uploadCompleteCallback; - } - - @Override - public void onCancel() { - // revert changes - configure(originalProfile, orcIdHref, callback); - } - - @Override - public void onSave() { - synAlert.clear(); - // First validate the view - if (!isValid()) { - synAlert.showError(SEE_ERRORS_ABOVE); - return; - } - // Update the profile from the editor - updateProfileFromEditor(); - // update the profile - jsClient.updateMyUserProfile( - originalProfile, - new AsyncCallback() { - @Override - public void onSuccess(UserProfile updateProfile) { - // clear entry from the client cache - clientCache.remove( - originalProfile.getOwnerId() + WebConstants.USER_PROFILE_SUFFIX - ); - // update the profile in the user session data - authController.updateCachedProfile(originalProfile); - setIsEditingMode(false); - callback.invoke(); - } - - @Override - public void onFailure(Throwable caught) { - synAlert.handleException(caught); - view.resetSaveButtonState(); - } - } - ); - } - - @Override - public void setIsEditingMode(boolean isEditing) { - this.isEditing = isEditing; - globalAppState.setIsEditing(isEditing); - fileHandleUploadWidget.setVisible(isEditing); - view.setEditMode(isEditing); - } - - @Override - public boolean isEditingMode() { - return isEditing; - } - - /** - * Update the profile from the view. - * - * @return - */ - public UserProfile updateProfileFromEditor() { - originalProfile.setProfilePicureFileHandleId(getImageId()); - originalProfile.setUserName(getUsername()); - originalProfile.setFirstName(getFirstName()); - originalProfile.setLastName(getLastName()); - originalProfile.setPosition(getPosition()); - originalProfile.setCompany(getCompany()); - originalProfile.setIndustry(getIndustry()); - originalProfile.setLocation(getLocation()); - originalProfile.setUrl(getUrl()); - originalProfile.setSummary(getSummary()); - originalProfile.setDisplayName( - originalProfile.getFirstName() + " " + originalProfile.getLastName() - ); - return originalProfile; - } -} diff --git a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetView.java b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetView.java deleted file mode 100755 index 40afdeb257..0000000000 --- a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetView.java +++ /dev/null @@ -1,82 +0,0 @@ -package org.sagebionetworks.web.client.widget.profile; - -import com.google.gwt.event.dom.client.KeyDownHandler; -import com.google.gwt.user.client.ui.IsWidget; -import java.util.List; - -public interface UserProfileEditorWidgetView extends IsWidget { - public interface Presenter { - // inform presenter that the user wants to save the edits to their profile - void onSave(); - void onCancel(); - // inform presenter that the user is editing their profile info - void setIsEditingMode(boolean isEditing); - } - - void setUsername(String userName); - - void setFirstName(String firstName); - - String getFirstName(); - - String getLastName(); - - String getUsername(); - - void setLastName(String lastName); - - void setBio(String summary); - - String getBio(); - - void showUsernameError(String error); - - void hideUsernameError(); - - void addImageWidget(IsWidget image); - - void addFileInputWidget(IsWidget fileInputWidget); - - public void setPresenter(Presenter presenter); - - String getLink(); - - void showLinkError(String string); - - void hideLinkError(); - - String getCurrentPosition(); - - void setCurrentPosition(String position); - - void setCurrentAffiliation(String company); - - String getCurrentAffiliation(); - - void setIndustry(String industry); - - String getIndustry(); - - void setLocation(String location); - - String getLocation(); - - void setLink(String url); - - void setSynAlert(IsWidget w); - - void addKeyDownHandlerToFields(KeyDownHandler keyDownHandler); - - // if in edit mode, then editable text fields will be available. If not, their static values will be shown (but still in a form). - void setEditMode(boolean isEditing); - - void setOwnerId(String userId); - void clearEmails(); - void setEmails(List emails, String notificationEmail); - void resetSaveButtonState(); - void setCanEdit(boolean canEdit); - - void setOrcIdHref(String orcIdHref); - - void setEmailsVisible(boolean visible); -} diff --git a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidget.java b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidget.java new file mode 100755 index 0000000000..e7611b2237 --- /dev/null +++ b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidget.java @@ -0,0 +1,14 @@ +package org.sagebionetworks.web.client.widget.profile; + +import com.google.gwt.user.client.ui.IsWidget; +import org.sagebionetworks.repo.model.UserProfile; +import org.sagebionetworks.web.client.utils.Callback; + +public interface UserProfileWidget extends IsWidget { + /** + * Configure this widget before using. + * + * @param profile + */ + void configure(UserProfile profile, String orcIDHref, Callback callback); +} diff --git a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetImpl.java b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetImpl.java new file mode 100755 index 0000000000..fe3b86d53b --- /dev/null +++ b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetImpl.java @@ -0,0 +1,130 @@ +package org.sagebionetworks.web.client.widget.profile; + +import com.google.gwt.user.client.rpc.AsyncCallback; +import com.google.gwt.user.client.ui.Widget; +import com.google.inject.Inject; +import org.gwtbootstrap3.client.ui.constants.ButtonSize; +import org.gwtbootstrap3.client.ui.constants.ButtonType; +import org.gwtbootstrap3.client.ui.constants.IconType; +import org.sagebionetworks.repo.model.UserProfile; +import org.sagebionetworks.repo.model.principal.NotificationEmail; +import org.sagebionetworks.web.client.GlobalApplicationState; +import org.sagebionetworks.web.client.PopupUtilsView; +import org.sagebionetworks.web.client.PortalGinInjector; +import org.sagebionetworks.web.client.SynapseJavascriptClient; +import org.sagebionetworks.web.client.cache.ClientCache; +import org.sagebionetworks.web.client.security.AuthenticationController; +import org.sagebionetworks.web.client.utils.Callback; +import org.sagebionetworks.web.client.widget.entity.controller.SynapseAlert; +import org.sagebionetworks.web.client.widget.upload.ImageUploadWidget; + +public class UserProfileWidgetImpl implements UserProfileWidget { + + UserProfileWidgetView view; + ProfileImageWidget imageWidget; + ImageUploadWidget fileHandleUploadWidget; + String fileHandleId; + UserProfile originalProfile; + SynapseJavascriptClient jsClient; + ClientCache clientCache; + AuthenticationController authController; + GlobalApplicationState globalAppState; + SynapseAlert synAlert; + PopupUtilsView popupUtils; + String orcIdHref; + Callback callback; + + @Inject + public UserProfileWidgetImpl( + UserProfileWidgetView view, + ProfileImageWidget imageWidget, + ImageUploadWidget fileHandleUploadWidget, + SynapseJavascriptClient jsClient, + ClientCache clientCache, + AuthenticationController authController, + PortalGinInjector ginInjector, + SynapseAlert synAlert, + PopupUtilsView popupUtils, + GlobalApplicationState globalAppState + ) { + super(); + this.view = view; + this.imageWidget = imageWidget; + this.fileHandleUploadWidget = fileHandleUploadWidget; + this.jsClient = jsClient; + this.clientCache = clientCache; + this.authController = authController; + this.synAlert = synAlert; + this.popupUtils = popupUtils; + this.globalAppState = globalAppState; + fileHandleUploadWidget.setView(ginInjector.getCroppedImageUploadView()); + fileHandleUploadWidget.addStyleName("editProfileImageButton"); + fileHandleUploadWidget.setButtonIcon(IconType.EDIT); + fileHandleUploadWidget.setButtonText(""); + fileHandleUploadWidget.setButtonType(ButtonType.DEFAULT); + fileHandleUploadWidget.setButtonSize(ButtonSize.SMALL); + fileHandleUploadWidget.setVisible(false); + imageWidget.setRemovePictureCommandVisible(false); + this.view.addFileInputWidget(fileHandleUploadWidget); + this.view.addImageWidget(imageWidget); + this.view.setSynAlert(synAlert); + } + + @Override + public Widget asWidget() { + return this.view.asWidget(); + } + + @Override + public void configure( + UserProfile profile, + String orcIdHref, + Callback callback + ) { + this.callback = callback; + this.orcIdHref = orcIdHref; + originalProfile = profile; + synAlert.clear(); + view.clearEmails(); + view.setUsername(profile.getUserName()); + view.setFirstName(profile.getFirstName()); + view.setLastName(profile.getLastName()); + view.setCurrentPosition(profile.getPosition()); + view.setCurrentAffiliation(profile.getCompany()); + view.setBio(profile.getSummary()); + view.setIndustry(profile.getIndustry()); + view.setLocation(profile.getLocation()); + view.setLink(profile.getUrl()); + boolean isCurrentUserProfile = profile + .getOwnerId() + .equals(authController.getCurrentUserPrincipalId()); + boolean isEmailAvailable = + profile.getEmails() != null && profile.getEmails().size() > 0; + view.setEmailsVisible(isEmailAvailable); + if (isEmailAvailable) { + // find out what the primary (notification) email address is + // SWC-5599: the first email is not the notification email address. + if (isCurrentUserProfile) { + jsClient.getNotificationEmail( + new AsyncCallback() { + @Override + public void onFailure(Throwable caught) { + synAlert.handleException(caught); + } + + public void onSuccess(NotificationEmail notificationEmail) { + view.setEmails(profile.getEmails(), notificationEmail.getEmail()); + } + } + ); + } else { + view.setEmails(profile.getEmails(), null); + } + } + view.setOrcIdHref(orcIdHref); + view.setOwnerId(profile.getOwnerId()); + view.setCanEdit(isCurrentUserProfile); + this.fileHandleId = profile.getProfilePicureFileHandleId(); + imageWidget.configure(profile.getOwnerId(), this.fileHandleId); + } +} diff --git a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetView.java b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetView.java new file mode 100755 index 0000000000..40aca09113 --- /dev/null +++ b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetView.java @@ -0,0 +1,38 @@ +package org.sagebionetworks.web.client.widget.profile; + +import com.google.gwt.user.client.ui.IsWidget; +import java.util.List; + +public interface UserProfileWidgetView extends IsWidget { + void setUsername(String userName); + + void setFirstName(String firstName); + + void setLastName(String lastName); + + void setBio(String summary); + + void addImageWidget(IsWidget image); + + void addFileInputWidget(IsWidget fileInputWidget); + + void setCurrentPosition(String position); + + void setCurrentAffiliation(String company); + + void setIndustry(String industry); + + void setLocation(String location); + + void setLink(String url); + + void setSynAlert(IsWidget w); + + void setOwnerId(String userId); + void clearEmails(); + void setEmails(List emails, String notificationEmail); + void setCanEdit(boolean canEdit); + void setOrcIdHref(String orcIdHref); + + void setEmailsVisible(boolean visible); +} diff --git a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.java b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetViewImpl.java similarity index 53% rename from src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.java rename to src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetViewImpl.java index 4bec06a601..cc46015e38 100755 --- a/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.java +++ b/src/main/java/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetViewImpl.java @@ -3,13 +3,12 @@ import static org.sagebionetworks.web.client.presenter.ProfilePresenter.IS_CERTIFIED; import static org.sagebionetworks.web.client.presenter.ProfilePresenter.IS_VERIFIED; -import com.google.gwt.event.dom.client.KeyDownHandler; import com.google.gwt.uibinder.client.UiBinder; import com.google.gwt.uibinder.client.UiField; +import com.google.gwt.user.client.Window; import com.google.gwt.user.client.rpc.AsyncCallback; import com.google.gwt.user.client.ui.IsWidget; import com.google.gwt.user.client.ui.SimplePanel; -import com.google.gwt.user.client.ui.SuggestBox; import com.google.gwt.user.client.ui.Widget; import com.google.inject.Inject; import java.util.List; @@ -18,16 +17,11 @@ import org.gwtbootstrap3.client.ui.Column; import org.gwtbootstrap3.client.ui.FormGroup; import org.gwtbootstrap3.client.ui.HelpBlock; -import org.gwtbootstrap3.client.ui.Row; -import org.gwtbootstrap3.client.ui.TextArea; -import org.gwtbootstrap3.client.ui.TextBox; import org.gwtbootstrap3.client.ui.Tooltip; -import org.gwtbootstrap3.client.ui.constants.ValidationState; import org.gwtbootstrap3.client.ui.html.Div; import org.gwtbootstrap3.client.ui.html.Paragraph; import org.sagebionetworks.repo.model.UserBundle; import org.sagebionetworks.web.client.DisplayUtils; -import org.sagebionetworks.web.client.GlobalApplicationState; import org.sagebionetworks.web.client.SynapseJSNIUtils; import org.sagebionetworks.web.client.SynapseJavascriptClient; import org.sagebionetworks.web.client.context.SynapseReactClientFullContextPropsProvider; @@ -37,16 +31,12 @@ import org.sagebionetworks.web.client.jsinterop.ReactNode; import org.sagebionetworks.web.client.jsinterop.SRC; import org.sagebionetworks.web.client.jsinterop.UserProfileLinksProps; -import org.sagebionetworks.web.client.security.AuthenticationController; import org.sagebionetworks.web.client.widget.ReactComponentDiv; -import org.sagebionetworks.web.client.widget.search.GooglePlacesSuggestOracle; +import org.sagebionetworks.web.shared.WebConstants; -// Want to add enter handler... What is the best way to go about this? -public class UserProfileEditorWidgetViewImpl - implements UserProfileEditorWidgetView { +public class UserProfileWidgetViewImpl implements UserProfileWidgetView { - public interface Binder - extends UiBinder {} + public interface Binder extends UiBinder {} @UiField SimplePanel imagePanel; @@ -60,57 +50,33 @@ public interface Binder @UiField HelpBlock usernameHelpBlock; - @UiField - TextBox username; - @UiField Paragraph usernameRenderer; - @UiField - TextBox firstName; - @UiField Paragraph firstNameRenderer; - @UiField - TextBox lastName; - @UiField Paragraph lastNameRenderer; - @UiField - TextBox currentPosition; - @UiField Paragraph currentPositionRenderer; - @UiField - TextBox currentAffiliation; - @UiField Paragraph currentAffiliationRenderer; - @UiField - TextBox industry; - @UiField Paragraph industryRenderer; @UiField Div emailDiv; - @UiField - Div locationSuggestBoxContainer; - @UiField Paragraph locationRenderer; @UiField FormGroup linkFormGroup; - @UiField - TextBox link; - @UiField Anchor linkRenderer; @@ -120,24 +86,12 @@ public interface Binder @UiField Paragraph bioRenderer; - @UiField - TextArea bioEditor; - @UiField Div synAlertContainer; @UiField Button editProfileButton; - @UiField - Button saveProfileButton; - - @UiField - Button cancelButton; - - @UiField - Anchor changeEmailLink; - @UiField Anchor changePasswordLink; @@ -159,33 +113,22 @@ public interface Binder @UiField ReactComponentDiv userProfileLinksReactComponentContainer; - @UiField - Row passwordContainer; - @UiField Column emailAddressContainer; @UiField Div commandsContainer; - SuggestBox locationSuggestBox; private Widget widget; - com.google.gwt.user.client.ui.TextBoxBase locationTextBox; - boolean isEditing = false; SynapseJSNIUtils jsniUtils; SynapseReactClientFullContextPropsProvider propsProvider; - Presenter presenter; - String originalButtonText; CookieProvider cookies; SynapseJavascriptClient jsClient; @Inject - public UserProfileEditorWidgetViewImpl( + public UserProfileWidgetViewImpl( Binder binder, - GooglePlacesSuggestOracle locationOracle, - GlobalApplicationState globalAppState, - AuthenticationController authController, SynapseJSNIUtils jsniUtils, SynapseReactClientFullContextPropsProvider propsProvider, CookieProvider cookies, @@ -196,23 +139,10 @@ public UserProfileEditorWidgetViewImpl( this.propsProvider = propsProvider; this.cookies = cookies; this.jsClient = jsClient; - locationSuggestBox = new SuggestBox(locationOracle); - locationSuggestBox.setWidth("100%"); - locationTextBox = locationSuggestBox.getTextBox(); - locationTextBox.addStyleName("form-control"); - locationSuggestBoxContainer.add(locationSuggestBox); editProfileButton.addClickHandler(event -> { - presenter.setIsEditingMode(true); - }); - saveProfileButton.addClickHandler(event -> { - DisplayUtils.showLoading(saveProfileButton, true, originalButtonText); - presenter.onSave(); - }); - cancelButton.addClickHandler(event -> { - presenter.onCancel(); + Window.open(WebConstants.ONESAGE_ACCOUNT_SETTINGS_URL, "_blank", ""); }); linkRenderer.getElement().setAttribute("rel", "noreferrer noopener"); - originalButtonText = saveProfileButton.getText(); } @Override @@ -222,7 +152,6 @@ public Widget asWidget() { @Override public void setUsername(String username) { - this.username.setText(username); usernameRenderer.setText(username); } @@ -263,54 +192,19 @@ private IsWidget getEmailElement(String email, String paragraphStyles) { @Override public void setFirstName(String firstName) { - this.firstName.setText(firstName); firstNameRenderer.setText(firstName); } - @Override - public String getFirstName() { - return this.firstName.getText(); - } - - @Override - public String getLastName() { - return this.lastName.getText(); - } - - @Override - public String getUsername() { - return username.getText(); - } - @Override public void setLastName(String lastName) { - this.lastName.setText(lastName); lastNameRenderer.setText(lastName); } @Override public void setBio(String summary) { - this.bioEditor.setText(summary); this.bioRenderer.setText(summary); } - @Override - public String getBio() { - return this.bioEditor.getText(); - } - - @Override - public void showUsernameError(String error) { - usernameFormGroup.setValidationState(ValidationState.ERROR); - usernameHelpBlock.setText(error); - } - - @Override - public void hideUsernameError() { - usernameFormGroup.setValidationState(ValidationState.NONE); - usernameHelpBlock.setText(""); - } - @Override public void addImageWidget(IsWidget image) { imagePanel.add(image); @@ -321,140 +215,32 @@ public void addFileInputWidget(IsWidget fileInputWidget) { fileInputWidgetPanel.add(fileInputWidget); } - @Override - public void setPresenter(Presenter presenter) { - this.presenter = presenter; - } - - @Override - public String getLink() { - return link.getText(); - } - - @Override - public void showLinkError(String string) { - linkFormGroup.setValidationState(ValidationState.ERROR); - linkHelpBlock.setText(string); - } - - @Override - public void hideLinkError() { - linkFormGroup.setValidationState(ValidationState.NONE); - linkHelpBlock.setText(""); - } - - @Override - public String getCurrentPosition() { - return currentPosition.getText(); - } - @Override public void setCurrentPosition(String position) { - currentPosition.setText(position); currentPositionRenderer.setText(position); } @Override public void setCurrentAffiliation(String company) { - currentAffiliation.setText(company); currentAffiliationRenderer.setText(company); } - @Override - public String getCurrentAffiliation() { - return currentAffiliation.getText(); - } - @Override public void setIndustry(String industry) { - this.industry.setText(industry); industryRenderer.setText(industry); } - @Override - public String getIndustry() { - return this.industry.getText(); - } - @Override public void setLocation(String location) { - this.locationSuggestBox.setText(location); locationRenderer.setText(location); } - @Override - public String getLocation() { - return this.locationSuggestBox.getText(); - } - @Override public void setLink(String url) { - this.link.setText(url); this.linkRenderer.setHref(url); this.linkRenderer.setText(url); } - @Override - public void addKeyDownHandlerToFields(KeyDownHandler keyDownHandler) { - username.addKeyDownHandler(keyDownHandler); - firstName.addKeyDownHandler(keyDownHandler); - lastName.addKeyDownHandler(keyDownHandler); - currentPosition.addKeyDownHandler(keyDownHandler); - currentAffiliation.addKeyDownHandler(keyDownHandler); - industry.addKeyDownHandler(keyDownHandler); - locationSuggestBox.addKeyDownHandler(keyDownHandler); - link.addKeyDownHandler(keyDownHandler); - bioEditor.addKeyDownHandler(keyDownHandler); - } - - @Override - public void setEditMode(boolean isEditing) { - this.isEditing = isEditing; - - bioEditor.setVisible(isEditing); - bioRenderer.setVisible(!isEditing); - locationTextBox.setReadOnly(!isEditing); - firstName.setVisible(isEditing); - firstNameRenderer.setVisible(!isEditing); - firstName.setPlaceholder(isEditing ? "Enter first name" : ""); - lastName.setVisible(isEditing); - lastNameRenderer.setVisible(!isEditing); - lastName.setPlaceholder(isEditing ? "Enter last name" : ""); - currentAffiliation.setVisible(isEditing); - currentAffiliationRenderer.setVisible(!isEditing); - currentAffiliation.setPlaceholder( - isEditing ? "Enter current affiliation" : "" - ); - - bioEditor.setPlaceholder("Enter bio"); - link.setVisible(isEditing); - linkRenderer.setVisible(!isEditing); - link.setPlaceholder(isEditing ? "Enter link to more info" : ""); - locationSuggestBoxContainer.setVisible(isEditing); - locationRenderer.setVisible(!isEditing); - locationTextBox - .getElement() - .setAttribute("placeholder", isEditing ? "Enter City, Country" : ""); - currentPosition.setVisible(isEditing); - currentPositionRenderer.setVisible(!isEditing); - currentPosition.setPlaceholder(isEditing ? "Enter current position" : ""); - industry.setVisible(isEditing); - industryRenderer.setVisible(!isEditing); - industry.setPlaceholder(isEditing ? "Enter industry/discipline" : ""); - - editProfileButton.setVisible(!isEditing); - saveProfileButton.setVisible(isEditing); - cancelButton.setVisible(isEditing); - changeEmailLink.setVisible(isEditing); - changePasswordLink.setVisible(isEditing); - username.setVisible(isEditing); - usernameRenderer.setVisible(!isEditing); - - if (!isEditing) { - DisplayUtils.showLoading(saveProfileButton, false, originalButtonText); - } - } - @Override public void setSynAlert(IsWidget w) { synAlertContainer.clear(); @@ -501,14 +287,8 @@ public void onFailure(Throwable caught) {} ); } - @Override - public void resetSaveButtonState() { - DisplayUtils.showLoading(saveProfileButton, false, originalButtonText); - } - @Override public void setCanEdit(boolean canEdit) { - passwordContainer.setVisible(canEdit); commandsContainer.setVisible(canEdit); } diff --git a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.ui.xml b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetViewImpl.ui.xml similarity index 61% rename from src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.ui.xml rename to src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetViewImpl.ui.xml index f2165deeda..099949be7f 100755 --- a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileEditorWidgetViewImpl.ui.xml +++ b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetViewImpl.ui.xml @@ -29,15 +29,13 @@ First Name - - + Last Name - - + @@ -45,11 +43,7 @@ Current Position - - + @@ -57,14 +51,7 @@ Current Affiliation - - + @@ -72,11 +59,9 @@ Bio - @@ -85,8 +70,7 @@ Username - - + @@ -96,7 +80,6 @@ - @@ -105,15 +88,13 @@ Industry/Discipline - - + City, Country - - + @@ -126,15 +107,6 @@ marginBottom="10" addStyleNames="truncate" /> - - Change email - @@ -146,30 +118,6 @@ - - - - Password - - NotThePassword - - - - Change password - - - - @@ -184,21 +132,18 @@ - - Cancel - - - Save Changes - - + Edit Profile + + Change password + Date: Tue, 4 Jun 2024 10:37:41 -0400 Subject: [PATCH 07/10] Add appId to OneSage links --- .../presenter/PersonalAccessTokensPresenter.java | 3 ++- .../presenter/users/RegisterAccountPresenter.java | 10 ++++++++-- .../org/sagebionetworks/web/shared/WebConstants.java | 6 +++++- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenter.java index c719ce6eee..c0ee14cbec 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/PersonalAccessTokensPresenter.java @@ -30,7 +30,8 @@ public void setPlace(PersonalAccessTokenPlace place) {} public void start(AcceptsOneWidget panel, EventBus eventBus) { Window.Location.replace( WebConstants.ONESAGE_PRODUCTION_URL + - "/authenticated/personalaccesstokens" + "/authenticated/personalaccesstokens?" + + WebConstants.ONESAGE_SYNAPSE_APPID_QUERY_PARAM ); } diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/users/RegisterAccountPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/users/RegisterAccountPresenter.java index 2cadb47afd..925d834b18 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/users/RegisterAccountPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/users/RegisterAccountPresenter.java @@ -25,11 +25,17 @@ public void setPlace(RegisterAccount place) { if (token != null && token.contains("@")) { // is likely an email address Window.Location.replace( - WebConstants.ONESAGE_PRODUCTION_URL + "/register1?email=" + token + WebConstants.ONESAGE_PRODUCTION_URL + + "/register1?email=" + + token + + "&" + + WebConstants.ONESAGE_SYNAPSE_APPID_QUERY_PARAM ); } else { Window.Location.replace( - WebConstants.ONESAGE_PRODUCTION_URL + "/register1" + WebConstants.ONESAGE_PRODUCTION_URL + + "/register1?" + + WebConstants.ONESAGE_SYNAPSE_APPID_QUERY_PARAM ); } } diff --git a/src/main/java/org/sagebionetworks/web/shared/WebConstants.java b/src/main/java/org/sagebionetworks/web/shared/WebConstants.java index 39f9f02a63..94c2560884 100644 --- a/src/main/java/org/sagebionetworks/web/shared/WebConstants.java +++ b/src/main/java/org/sagebionetworks/web/shared/WebConstants.java @@ -27,8 +27,12 @@ public class WebConstants { public static final String ONESAGE_PRODUCTION_URL = "https://accounts.sagebionetworks.synapse.org"; + public static final String ONESAGE_SYNAPSE_APPID_QUERY_PARAM = + "appId=synapse.org"; public static final String ONESAGE_ACCOUNT_SETTINGS_URL = - ONESAGE_PRODUCTION_URL + "/authenticated/myaccount"; + ONESAGE_PRODUCTION_URL + + "/authenticated/myaccount?" + + ONESAGE_SYNAPSE_APPID_QUERY_PARAM; public static final String DOCS_BASE_URL = "https://help.synapse.org/"; public static final String DOCS_URL = DOCS_BASE_URL + "docs/"; From f394f54bca4055e715b6e3dfb904da12f7475ece Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Tue, 4 Jun 2024 10:44:16 -0400 Subject: [PATCH 08/10] Use new endpoint, add appId to a few missed places --- .../users/PasswordResetPresenter.java | 5 +++- .../web/shared/WebConstants.java | 2 +- .../profile/UserProfileModalViewImpl.ui.xml | 2 +- .../profile/UserProfileWidgetViewImpl.ui.xml | 2 +- .../web/unitserver/filter/CORSFilterTest.java | 26 ++++++++++++++++++- 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java b/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java index 9080e74bab..58849ed87c 100644 --- a/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java +++ b/src/main/java/org/sagebionetworks/web/client/presenter/users/PasswordResetPresenter.java @@ -7,13 +7,16 @@ import com.google.inject.Inject; import org.sagebionetworks.web.client.place.users.PasswordReset; import org.sagebionetworks.web.client.presenter.Presenter; +import org.sagebionetworks.web.shared.WebConstants; public class PasswordResetPresenter extends AbstractActivity implements Presenter { private static final String ONE_SAGE_RESET_PASSWORD_URL = - "https://accounts.sagebionetworks.synapse.org/resetPassword"; + WebConstants.ONESAGE_PRODUCTION_URL + + "/resetPassword?" + + WebConstants.ONESAGE_SYNAPSE_APPID_QUERY_PARAM; @Inject public PasswordResetPresenter() {} diff --git a/src/main/java/org/sagebionetworks/web/shared/WebConstants.java b/src/main/java/org/sagebionetworks/web/shared/WebConstants.java index 94c2560884..347ddfa8ff 100644 --- a/src/main/java/org/sagebionetworks/web/shared/WebConstants.java +++ b/src/main/java/org/sagebionetworks/web/shared/WebConstants.java @@ -26,7 +26,7 @@ public class WebConstants { public static final String INVALID_EMAIL_MESSAGE = "Invalid email address"; public static final String ONESAGE_PRODUCTION_URL = - "https://accounts.sagebionetworks.synapse.org"; + "https://accounts.synapse.org"; public static final String ONESAGE_SYNAPSE_APPID_QUERY_PARAM = "appId=synapse.org"; public static final String ONESAGE_ACCOUNT_SETTINGS_URL = diff --git a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileModalViewImpl.ui.xml b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileModalViewImpl.ui.xml index e0acb0e6f6..25222d2fb0 100755 --- a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileModalViewImpl.ui.xml +++ b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileModalViewImpl.ui.xml @@ -29,7 +29,7 @@ diff --git a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetViewImpl.ui.xml b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetViewImpl.ui.xml index 099949be7f..8da82c0ec1 100755 --- a/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetViewImpl.ui.xml +++ b/src/main/resources/org/sagebionetworks/web/client/widget/profile/UserProfileWidgetViewImpl.ui.xml @@ -140,7 +140,7 @@ marginTop="10" ui:field="changePasswordLink" target="_blank" - href="https://accounts.sagebionetworks.synapse.org/authenticated/myaccount#ChangePassword" + href="https://accounts.synapse.org/authenticated/myaccount?appId=synapse.org#ChangePassword" > Change password diff --git a/src/test/java/org/sagebionetworks/web/unitserver/filter/CORSFilterTest.java b/src/test/java/org/sagebionetworks/web/unitserver/filter/CORSFilterTest.java index fa3bccb501..5775adbadc 100644 --- a/src/test/java/org/sagebionetworks/web/unitserver/filter/CORSFilterTest.java +++ b/src/test/java/org/sagebionetworks/web/unitserver/filter/CORSFilterTest.java @@ -68,7 +68,31 @@ public void testSynapseOrg() throws ServletException, IOException { } @Test - public void testStagingSynapseOrg() throws ServletException, IOException { + public void testStagingAccountsSynapseOrg() + throws ServletException, IOException { + when(mockRequest.getHeader(ORIGIN_HEADER)) + .thenReturn("https://staging.accounts" + SYNAPSE_ORG_SUFFIX); // SWC-6399: explicitly test https://staging.accounts.synapse.org + filter.testFilter(mockRequest, mockResponse, mockFilterChain); + + // verify allow origin header set to the specific origin + verify(mockResponse) + .addHeader( + eq(ACCESS_CONTROL_ALLOW_ORIGIN_HEADER), + stringCaptor.capture() + ); + String allowOriginHeaderValue = stringCaptor.getValue(); + assertEquals( + "https://staging.accounts.synapse.org", + allowOriginHeaderValue + ); + // and Access-Control-Allow-Credentials is set to true + verify(mockResponse) + .addHeader(ACCESS_CONTROL_ALLOW_CREDENTIALS_HEADER, "true"); + } + + @Test + public void testStagingAccountsSageBioSynapseOrg() + throws ServletException, IOException { when(mockRequest.getHeader(ORIGIN_HEADER)) .thenReturn( "https://staging.accounts.sagebionetworks" + SYNAPSE_ORG_SUFFIX From 684899ee5d3743d95bac45fae24830db1c881318 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Mon, 10 Jun 2024 17:11:22 -0400 Subject: [PATCH 09/10] Bump synapse-react-client to v3.2.20 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index b8cdeee0b9..397ac10d09 100644 --- a/package.json +++ b/package.json @@ -34,7 +34,7 @@ "react-transition-group": "2.6.0", "sass": "^1.63.6", "spark-md5": "^3.0.2", - "synapse-react-client": "3.2.19", + "synapse-react-client": "3.2.20", "universal-cookie": "^4.0.4", "xss": "^1.0.15" }, diff --git a/yarn.lock b/yarn.lock index 93ceb4334c..7f11efbb37 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5017,10 +5017,10 @@ svg-path-sdf@^1.1.3: parse-svg-path "^0.1.2" svg-path-bounds "^1.0.1" -synapse-react-client@3.2.19: - version "3.2.19" - resolved "https://registry.yarnpkg.com/synapse-react-client/-/synapse-react-client-3.2.19.tgz#399c7c429f0f96e58feb4b16b17a57dba8a00c40" - integrity sha512-YV+TiqAWxv/eIG1ZzUVBvmyh8HELP1KElCbCzqiDs9mP/Ja8TSJ7zHOhzioVthdz2sFDLctzxfzrN6EArZM4cw== +synapse-react-client@3.2.20: + version "3.2.20" + resolved "https://registry.yarnpkg.com/synapse-react-client/-/synapse-react-client-3.2.20.tgz#1b17bd60417ffa6c701bcdab2792e021380c2aa5" + integrity sha512-sCZYWd4gTTmakgBzpCyP9WIN/do5zVhKUGeinmAy9195HhqG6IDfUM/jhPn6BjrxUA6KTFC9urAKfy3O91FXMQ== dependencies: "@apidevtools/json-schema-ref-parser" "^9.1.2" "@brainhubeu/react-carousel" "1.19.26" From f18b344ee60be379fee3584558f49c2907d58058 Mon Sep 17 00:00:00 2001 From: Nick Grosenbacher Date: Mon, 10 Jun 2024 17:45:54 -0400 Subject: [PATCH 10/10] Remove account registration e2e test --- e2e/create_account.spec.ts | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 e2e/create_account.spec.ts diff --git a/e2e/create_account.spec.ts b/e2e/create_account.spec.ts deleted file mode 100644 index 9c076a1d6d..0000000000 --- a/e2e/create_account.spec.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { expect, test } from '@playwright/test' -import { waitForInitialPageLoad } from './helpers/utils' - -test.describe('Create Account', () => { - test('should show an alert when an invalid email address is used', async ({ - page, - }) => { - await page.goto('/') - await waitForInitialPageLoad(page) - - await page.getByRole('link', { name: 'Register Now' }).first().click() - await page.getByRole('textbox').first().fill('test123') - await page.getByPlaceholder('Your email address').fill('test123') - await page.getByRole('button', { name: 'Send registration info' }).click() - await expect(page.locator('#rootPanel').getByRole('alert')).toHaveText( - 'Email address is not valid.', - ) - }) -})