-// $Id$
/**
* Copyright (C) 2007 EDIT
* European Distributed Institute of Taxonomy
import eu.etaxonomy.cdm.api.service.IUserService;
import eu.etaxonomy.cdm.model.common.User;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
+import eu.etaxonomy.taxeditor.l10n.Messages;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.store.CdmStore;
import eu.etaxonomy.taxeditor.ui.element.CdmFormFactory;
public PasswordWizard(User user, ConversationHolder conversation){
this.conversation = conversation;
this.user = user;
+ setWindowTitle(Messages.PasswordWizardPage_CHANGE_PASSWORD);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#addPages()
- */
@Override
public void addPages() {
CdmFormFactory formFactory = new CdmFormFactory(Display.getDefault());
addPage(passwordPage);
}
- /* (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#performFinish()
- */
@Override
public boolean performFinish() {
ConversationHolder internalConversation = CdmStore.getCurrentApplicationConfiguration().NewConversation();
internalConversation.bind();
internalConversation.startTransaction();
- try{
+ String warningTitle = Messages.PasswordWizard_COULD_NOT_CHANGE_PWD;
+ String warningMessage = Messages.PasswordWizard_OLD_PWD_INCORRECT;
+ try{
if(passwordPage.isChangingOwnPassword()){
// change own password with validating of old one
CdmStore.getService(IUserService.class).changePassword(passwordPage.getOldPassword(), passwordPage.getNewPassword());
// change others passwords
CdmStore.getService(IUserService.class).changePasswordForUser(user.getUsername(), passwordPage.getNewPassword());
}
+ CdmStore.getService(IUserService.class).loadWithUpdate(user.getUuid());
+ CdmStore.getLoginManager().authenticate(user.getUsername(), passwordPage.getNewPassword());
internalConversation.commit(false);
internalConversation.unbind();
internalConversation.close();
return true;
}catch(AccessDeniedException e){
- MessagingUtils.warningDialog("Could not change password", this, "The old password is not correct.");
+ MessagingUtils.warningDialog(warningTitle, this, warningMessage);
return false;
}catch (AuthenticationException e){
- MessagingUtils.warningDialog("Could not change password", this, "The old password is not correct.");
-
+ MessagingUtils.warningDialog(warningTitle, this, warningMessage);
+
return false;
}catch(Exception e){
- MessagingUtils.warningDialog("Problem with changing password", this, "The password could not be changed. " + e.getMessage());
+ MessagingUtils.warningDialog(Messages.PasswordWizard_PROBLEM_WITH_CHANGING_PWD, this, Messages.PasswordWizard_PWD_COULD_NOT_BE_CHANGED + e.getMessage());
return false;
}finally{
if(conversation != null){
}
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.persistence.hibernate.ICdmPostDataChangeObserver#update(eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap)
- */
@Override
public void update(CdmDataChangeMap arg0) {
- // TODO Auto-generated method stub
-
}
- /* (non-Javadoc)
- * @see eu.etaxonomy.cdm.api.conversation.IConversationEnabled#getConversationHolder()
- */
@Override
public ConversationHolder getConversationHolder() {
return conversation;