* Copyright (C) 2016 Roland Haeder
*
* This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * GNU Affero General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
+ * You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.mxchange.addressbook.beans.email_address;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
-import org.mxchange.addressbook.beans.login.UserLoginWebSessionController;
+import org.mxchange.addressbook.beans.login.AddressbookUserLoginWebSessionController;
import org.mxchange.jcontacts.contact.Contact;
import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
import org.mxchange.jusercore.model.email_address.ChangeableEmailAddress;
/**
* Email address 1 (changing)
*/
- private String emailAddress1;
+ private String emailAddress;
/**
* Email address 2 (repeat in changing)
*/
- private String emailAddress2;
+ private String emailAddressRepeat;
/**
* Local list of already queued email addresses
* Login bean (controller)
*/
@Inject
- private UserLoginWebSessionController loginController;
+ private AddressbookUserLoginWebSessionController loginController;
/**
* Default constructor
Context context = new InitialContext();
// Try to lookup
- this.emailBean = (EmailChangeSessionBeanRemote) context.lookup("ejb/stateless-addressbook-email-change"); //NOI18N
+ this.emailBean = (EmailChangeSessionBeanRemote) context.lookup("java:global/addressbook-ejb/email-change!org.mxchange.jusercore.model.email_address.EmailChangeSessionBeanRemote"); //NOI18N
// Init list
this.emailAddresses = this.emailBean.allQueuedAddressesAsList();
} else if (!this.isRequiredChangeEmailAddressSet()) {
// Not all required fields are set
throw new FaceletException("Not all required fields are set."); //NOI18N
- } else if (!Objects.equals(this.getEmailAddress1(), this.getEmailAddress2())) {
+ } else if (!Objects.equals(this.getEmailAddress(), this.getEmailAddressRepeat())) {
// Email address 1+2 mismatch
throw new FaceletException("Email address 1/2 are mismatching."); //NOI18N
} else if (!this.loginController.ifCurrentPasswordMatches()) {
assert (user.getUserContact().getContactId() > 0) : MessageFormat.format("Instance loginController.userContact.contactId={0} is invalid", user.getUserContact().getContactId()); //NOI18N
// Get dummy email address
- String dummyEmail = this.getEmailAddress1();
+ String dummyEmail = this.getEmailAddress();
// Unset all so the user is forced to re-enter it
this.clear();
}
@Override
- public String getEmailAddress1 () {
- return this.emailAddress1;
+ public String getEmailAddress () {
+ return this.emailAddress;
}
@Override
- public void setEmailAddress1 (final String emailAddress1) {
- this.emailAddress1 = emailAddress1;
+ public void setEmailAddress (final String emailAddress) {
+ this.emailAddress = emailAddress;
}
@Override
- public String getEmailAddress2 () {
- return this.emailAddress2;
+ public String getEmailAddressRepeat () {
+ return this.emailAddressRepeat;
}
@Override
- public void setEmailAddress2 (final String emailAddress2) {
- this.emailAddress2 = emailAddress2;
+ public void setEmailAddressRepeat (final String emailAddressRepeat) {
+ this.emailAddressRepeat = emailAddressRepeat;
}
@Override
public boolean isRequiredChangeEmailAddressSet () {
- return ((this.getEmailAddress1() != null) &&
- (this.getEmailAddress2() != null));
+ return ((this.getEmailAddress() != null) &&
+ (this.getEmailAddressRepeat() != null));
}
/**
*/
private void clear () {
// Clear fields
- this.setEmailAddress1(null);
- this.setEmailAddress2(null);
+ this.setEmailAddress(null);
+ this.setEmailAddressRepeat(null);
}
/**
* <p>
* @param emailAddress Email address to verify
* <p>
- * @return Whether the email address in field emailAddress1 is already queued
+ * @return Whether the email address in field emailAddress is already queued
*/
private boolean isEmailAddressQueued (final String emailAddress) {
// It should be there