Project

General

Profile

« Previous | Next » 

Revision a650c2c1

Added by Andreas Kohlbecker 8 months ago

ref #9498 providing feedback to users in case an unknown email has been entered

View differences:

src/main/java/eu/etaxonomy/cdm/vaadin/view/LoginPresenter.java
40 40

  
41 41
import eu.etaxonomy.cdm.api.application.ICdmRepository;
42 42
import eu.etaxonomy.cdm.api.service.security.AccountSelfManagementException;
43
import eu.etaxonomy.cdm.api.service.security.EmailAddressNotFoundException;
43 44
import eu.etaxonomy.cdm.vaadin.event.AuthenticationAttemptEvent;
44 45
import eu.etaxonomy.cdm.vaadin.event.AuthenticationSuccessEvent;
45 46
import eu.etaxonomy.cdm.vaadin.event.UserAccountEvent;
......
198 199
            result = futureResult.get();
199 200
        } catch (InterruptedException e) {
200 201
            asyncTimeout = true;
202
        } catch (Exception e) {
203
            // in case executing getUserNameOrEmail() causes an exeption faster
204
            // than futureResult.addCallback( can be processed, the execption
205
            // can not be caught asynchronously
206
            // so we are adding all these exceptions here
207
            asyncException.add(e);
201 208
        }
202 209
        if(!asyncException.isEmpty()) {
203
            getView().getLoginDialog().getMessageSendRecoveryEmailLabel()
204
            .setValue("Sending the password reset email to you has failed. Please try again later or contect the support in case this error persists.");
210
            String messageText = "An unknown error has occurred.";
211
            if(asyncException.get(0) instanceof MailException) {
212
                messageText = "Sending the password reset email to you has failed. Please try again later or contect the support in case this error persists.";
213
            }
214
            if(asyncException.get(0) instanceof EmailAddressNotFoundException) {
215
                messageText = "There is no user accout for this email address.";
216
            }
217
            getView().getLoginDialog().getMessageSendRecoveryEmailLabel().setValue(messageText);
205 218
            getView().getLoginDialog().getMessageSendRecoveryEmailLabel().setStyleName(ValoTheme.LABEL_FAILURE);
206 219
        } else {
207 220
            if(!asyncTimeout && result) {

Also available in: Unified diff