Project

General

Profile

Revision ab81561c

IDab81561c4d5f4cd5a53db6b0068d43d820f0f653
Parent 8f7bda11
Child 144153b3

Added by Patrick Plitzner over 5 years ago

Add menu entry for password dialog to main menu #3102

View differences:

eu.etaxonomy.taxeditor.store/plugin.xml
430 430
            </visibleWhen>
431 431
         </command>
432 432
         <command
433
               commandId="eu.etaxonomy.taxeditor.store.openPasswordWizzard"
434
               label="Change password"
435
               style="push">
436
            <visibleWhen
437
                  checkEnabled="true">
438
               <reference
439
                     definitionId="isUserLoggedIn">
440
               </reference>
441
            </visibleWhen>
442
         </command>
443
         <command
433 444
               commandId="eu.etaxonomy.taxeditor.store.operations.reconnect"
434 445
               label="%command.label.RE_CONNECT"
435 446
               style="push">
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizard.java
43 43
	public PasswordWizard(User user, ConversationHolder conversation){
44 44
		this.conversation = conversation;
45 45
		this.user = user;
46
		setWindowTitle("Change password");
46 47
	}
47 48

  
48 49
	@Override
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/password/PasswordWizardPage.java
14 14
import org.eclipse.swt.SWT;
15 15
import org.eclipse.swt.events.ModifyEvent;
16 16
import org.eclipse.swt.events.ModifyListener;
17
import org.eclipse.swt.graphics.Color;
17 18
import org.eclipse.swt.widgets.Composite;
18 19
import org.eclipse.swt.widgets.Text;
19 20

  
20 21
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
21
import eu.etaxonomy.cdm.api.service.IUserService;
22 22
import eu.etaxonomy.cdm.model.common.User;
23 23
import eu.etaxonomy.taxeditor.store.CdmStore;
24 24
import eu.etaxonomy.taxeditor.ui.element.AbstractCdmEntityWizardPage;
......
42 42
	private TextWithLabelElement text_passwordRepeat;
43 43
	private final PasswordValidator passwordValidator;
44 44

  
45
	private final UniqueUserNameValidator uniqueUsernameValidator;
46

  
47 45
	protected PasswordWizardPage(CdmFormFactory formFactory,
48 46
			ConversationHolder conversation, User entity) {
49 47
		super(formFactory, conversation, entity);
50 48

  
51 49
		passwordValidator = new PasswordValidator();
52
		uniqueUsernameValidator = new UniqueUserNameValidator();
50

  
51
		setTitle("Change password");
52
		setDescription("Change password and confirm with current password");
53 53
	}
54 54

  
55 55
	@Override
......
70 70

  
71 71
		((Text)text_passwordRepeat.getMainControl()).addModifyListener(this);
72 72

  
73
		Color bgColor = getShell().getBackground();
74
		rootElement.setBackground(bgColor);
75
		control.setBackground(bgColor);
73 76
		setControl(control);
74 77
	}
75 78

  
......
104 107
		setErrorMessage(message);
105 108
	}
106 109

  
107
	private class UniqueUserNameValidator implements IInputValidator{
108

  
109
		private static final String USER_EXISTS = "Username already exists";
110
		private static final String NAME_TO_SHORT = "Username is empty";
111

  
112
		@Override
113
        public String isValid(String newText) {
114
			// query for username
115
			if(newText.length() < 1){
116
				setPageComplete(false);
117
				return NAME_TO_SHORT;
118
			}
119
			if(CdmStore.getService(IUserService.class).userExists(newText)){
120
				setPageComplete(false);
121
				return USER_EXISTS;
122
			}
123

  
124
			setPageComplete(true);
125
			return null;
126
		}
127
	}
128

  
129 110
	private class PasswordValidator implements IInputValidator{
130 111

  
131 112
		private static final int PW_MIN_LENGTH = 5;

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)