Commit 58953dce by Tuomas Riihimäki

Merge branch 'asm-layoutfix' into 'master'

Asm layoutfix

Käyttäjän syöttöä muokattu sekä leiskasta oikea palkki poies.

See merge request !135
2 parents c918e798 b55391b1
......@@ -425,6 +425,11 @@ public class UserBean implements UserBeanLocal {
user.getUser().resetPassword(password);
user.setEvent(eventBean.getCurrentEvent());
if(user.getLogin() == null || user.getLogin().trim().isEmpty()) {
user.setLogin(user.getEmail());
}
// Tallennetaan olio kantaan...
eventUserFacade.create(user);
......
......@@ -325,6 +325,7 @@ public class LanEvent extends GenericEntity {
}
public String getTheme() {
return theme;
}
......
......@@ -57,7 +57,7 @@
<p:outputLabel for="themeSwitcher" value="#{i18n['event.theme']}:" />
<p:themeSwitcher value="#{eventorgView.event.theme}" id="themeSwitcher" var="t" style="width: 200px;" >
<f:selectItem itemLabel="Choose Theme" itemValue="Aristo" />
<f:selectItem itemLabel="Choose Theme" itemValue="" />
<f:selectItems value="#{themeSwitcherView.themes}" />
</p:themeSwitcher>
<p:message for="themeSwitcher" />
......
......@@ -53,9 +53,7 @@
<h:panelGroup>
<table>
<tr>
<td colspan="2"><h:outputLabel value="#{i18n['user.nick']}" for="nick" /> <br /> <p:inputText size="45" id="nick" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.nick}" /></td>
</tr>
<tr>
<td><h:outputLabel value="#{i18n['user.firstNames']}" for="firstnames" /><br /> <p:inputText size="22" id="firstnames" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.firstnames}" /></td>
<td><h:outputLabel value="#{i18n['user.lastName']}" for="lastname" /><br /> <p:inputText size="30" id="lastname" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.lastname}" /></td>
......@@ -70,45 +68,68 @@
</tr>
</table>
<table>
<table >
<tr>
<td colspan="2">
<p:outputLabel value="#{i18n['user.address']}" for="address" /><br />
<p:inputTextarea rows="2" cols="45" id="address" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.address}" />
</td>
</tr>
<tr>
<td>
<p:outputLabel value="#{i18n['user.zipCode']}" for="zip" /><br />
<p:inputText styleClass="ui-input" size="7" id="zip" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.zip}" /> <p:message for="zip" />
</td>
<td>
<p:outputLabel value="#{i18n['user.town']}" for="town" /><br />
<p:inputText styleClass="ui-input" size="25" id="town" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.town}" />
<p:message for="town" />
</td>
</tr>
<tr>
<td colspan="2"><p:outputLabel value="#{i18n['user.address']}" for="address" /><br /> <p:inputText size="45" id="address" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.address}" /></td>
<td colspan="2">
<p:outputLabel value="#{i18n['user.emailAndUsername']}" for="email" />
<br />
<p:inputText validator="#{userValidator.validateEmail}" size="45" id="email" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.email}" required="true" requiredMessage="#{i18n['required']}" />
<p:message for="email" />
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td><p:outputLabel value="#{i18n['user.zipCode']}" for="zip" /><br /> <p:inputText styleClass="ui-input" size="7" id="zip" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.zip}" /> <p:message for="zip" /></td>
<td><p:outputLabel value="#{i18n['user.town']}" for="town" /><br /> <p:inputText styleClass="ui-input" size="25" id="town" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.town}" /> <p:message for="town" /></td>
<td colspan="2">
<p:outputLabel value="#{i18n['user.emailAgain']}" for="email2" />
<br />
<p:inputText validator="#{userValidator.validateEmail}" size="45" id="email2" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.emailCheck}" required="true" requiredMessage="#{i18n['required']}" />
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td colspan="2"><h:outputLabel value="#{i18n['user.email']}" for="email" /> <br /> <p:inputText validator="#{userValidator.validateEmail}" size="45" id="email" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.email}" /></td>
<td colspan="2">
<p:outputLabel value="#{i18n['user.phone']}" for="phone" />
<br />
<p:inputMask size="45" id="phone" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.phone}" mask="+99?9 9999999999999999999" required="true" requiredMessage="#{i18n['required']}" />
<p:message for="phone" />
</td>
</tr>
<tr>
<td><p:outputLabel value="#{i18n['user.phone']}" for="phone" /><br /> <p:inputText size="9" id="phone" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.phone}" /> <p:message for="phone" /></td>
<td colspan="2"><h:outputLabel value="#{i18n['user.nick']}" for="nick" /> <br /> <p:inputText size="45" id="nick" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.nick}" /></td>
</tr>
</table>
<br />
<ui:fragment rendered="#{cc.attrs.creating}">
<h:outputLabel value="#{i18n['user.login']}" for="login" />
<br />
<p:inputText size="25" id="login" validator="#{userValidator.login}" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.login}" />
<p:message for="login" />
<br />
</ui:fragment>
<br />
<p:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.password']}" for="password" />
<h:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.password']}" for="password" />
<br />
<p:password validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="password" value="#{userView.password}" />
<p:password validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="password" value="#{userView.password}" feedback="true" required="true" requiredMessage="#{i18n['required']}" />
<p:message for="password" />
<br />
<p:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.passwordcheck']}" for="passwordcheck" />
<br />
<p:password validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="passwordcheck" value="#{userView.passwordcheck}" />
<p:password validator="#{userValidator.password}" rendered="#{cc.attrs.creating}" id="passwordcheck" value="#{userView.passwordcheck}" required="true" requiredMessage="#{i18n['required']}" />
<br />
......
......@@ -112,7 +112,7 @@
<h:message for="birthday" />
<p:outputLabel value="#{i18n['user.address']}" />
<p:inputText size="25" id="address" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.address}" />
<p:inputTextarea cols="25" rows="3" id="address" disabled="#{!cc.attrs.creating and !userView.canSave}" value="#{userView.selectedUser.address}" />
<p:message for="address" />
<p:outputLabel value="#{i18n['user.zipCode']}" for="zip" />
......
......@@ -98,6 +98,14 @@
</div>
<div id="header_center">
<h:form rendered="#{menuView.renderTopmenuChanger}">
<p:button outcome="/index" value="#{i18n['mode.user']}" />
<p:button outcome="/useradmin/list" value="#{i18n['mode.admin']}" />
</h:form>
<ui:fragment rendered="#{layoutView.canManageContent}">
<div>
<h:form>
......@@ -115,13 +123,44 @@
</p:layoutUnit>
<p:layoutUnit header="#{i18n['menu']}" collapsible="true" id="leftpanel" position="west" resizable="true" size="200" minSize="100" >
<p:layoutUnit header="#{i18n['menu']}" collapsible="true" id="leftpanel" position="west" resizable="true" size="225" minSize="100" >
<p:fieldset rendered="#{sessionHandler.loggedIn}">
<h:outputText value="#{i18n['template.loggedInAs']}" />
<br />
<b><h:outputText value="#{sessionHandler.currentUser.nick}" /></b>
<br />
<h:link outcome="/auth/logout">
<h:outputText value="#{i18n['login.logout']}" />
</h:link>
</p:fieldset>
<br />
<nav>
<h:form id="mainMenu">
<p:panelMenu id="panelmenu" model="#{primeMenuView.menuModel}" />
</h:form>
<h:link style="font-size: 10px;" rendered="#{readerView.shopToOthers}" outcome="/shop/showReaderEvents" value="Readers" />
</nav>
<br />
<p:fieldset rendered="#{!sessionHandler.loggedIn}">
<div style="text-align: left; padding: 0.7em;">
<h:form>
<p:inputText styleClass="form" id="linelogin" value="#{authView.login}" />
<br />
<p:password styleClass="form" id="linepwd" value="#{authView.password}" />
<br />
<p:commandButton styleClass="button" id="onelinesubmit" action="#{authView.executeLoginAction}" ajax="false" value="#{i18n['login.submit']}" />
</h:form>
<ui:fragment rendered="#{authView.canCreateUser}">
<h:link value="#{i18n['submenu.user.create']}" outcome="/user/create" />
<br />
</ui:fragment>
<h:link value="#{i18n['submenu.auth.sendResetMail']}" outcome="/auth/sendResetMail" />
</div>
</p:fieldset>
</p:layoutUnit>
<p:layoutUnit position="center">
......@@ -169,47 +208,6 @@
</p:layoutUnit>
<p:layoutUnit header="#{i18n['user.info']}" resizable="true" collapsible="true" id="rightpanel" position="east">
<p:fieldset rendered="#{sessionHandler.loggedIn}">
<h:outputText value="#{i18n['template.loggedInAs']}" />
<br />
<b><h:outputText value="#{sessionHandler.currentUser.nick}" /></b>
<br />
<h:link outcome="/auth/logout">
<h:outputText value="#{i18n['login.logout']}" />
</h:link>
</p:fieldset>
<p:fieldset rendered="#{!sessionHandler.loggedIn}">
<div style="text-align: left; padding: 0.7em;">
<h:form>
<p:inputText styleClass="form" id="linelogin" value="#{authView.login}" />
<br />
<p:password styleClass="form" id="linepwd" value="#{authView.password}" />
<br />
<p:commandButton styleClass="button" id="onelinesubmit" action="#{authView.executeLoginAction}" ajax="false" value="#{i18n['login.submit']}" />
</h:form>
<ui:fragment rendered="#{authView.canCreateUser}">
<h:link value="#{i18n['submenu.user.create']}" outcome="/user/create" />
<br />
</ui:fragment>
<h:link value="#{i18n['submenu.auth.sendResetMail']}" outcome="/auth/sendResetMail" />
</div>
</p:fieldset>
<br />
<p:fieldset legend="#{i18n['mode.title']}" rendered="#{menuView.renderTopmenuChanger}">
<h:form>
<p:button outcome="/index" value="#{i18n['mode.user']}" />
<br />
<p:button outcome="/useradmin/list" value="#{i18n['mode.admin']}" />
</h:form>
</p:fieldset>
</p:layoutUnit>
</p:layout>
<h:form>
......
......@@ -92,7 +92,7 @@ public class SessionHandler {
if(theme == null) {
theme = eventbean.getCurrentEvent().getTheme();
}
if (theme == null) {
if (theme == null || theme.trim().isEmpty()) {
// primefaces default theme
theme = "aristo";
}
......@@ -124,7 +124,7 @@ public class SessionHandler {
template = eventbean.getPropertyString(LanEventPropertyKey.EVENT_LAYOUT);
}
if (template == null) {
template = "insomnia2";
template = "primelayout";
}
return template;
......
......@@ -41,11 +41,14 @@ import fi.codecrew.moya.utilities.I18n;
public class UserValidator implements Serializable {
private String firstpwd;
private String firstemail;
/**
*
*/
private static final long serialVersionUID = 8081093389856720678L;
private static final Integer PASSWORD_MIN_LENGTH = 8;
private static final Integer EMAIL_MIN_LENGTH = 6; // a@a.fi
@EJB
private transient UserBeanLocal userbean;
@EJB
......@@ -54,11 +57,23 @@ public class UserValidator implements Serializable {
private static final Logger logger = LoggerFactory.getLogger(UserValidator.class);
public void validateEmail(FacesContext context, UIComponent ui, Object value) {
String email = (String) value;
// I think that a@a.fi is shortest form of possible email?
if(email.trim().length() < EMAIL_MIN_LENGTH ) {
message(context, ui, "user.emailtooshortmessage", EMAIL_MIN_LENGTH);
}
if (!permbean.hasPermission(UserPermission.MODIFY) && (email == null || email.indexOf('@') == -1)) {
message(context, ui, "userview.invalidEmail");
}
if(firstemail == null || firstemail.trim().isEmpty()) {
firstemail = email;
} else if(!firstemail.equals(email)) {
message(context, ui, "user.emailsunmatch");
}
}
public void login(FacesContext context, UIComponent ui, Object object) {
......@@ -72,8 +87,9 @@ public class UserValidator implements Serializable {
}
public void password(FacesContext context, UIComponent ui, Object object) {
logger.info("Executing pwd, firstpwd {}", firstpwd);
if (!permbean.hasPermission(UserPermission.MODIFY))
{
......
......@@ -81,6 +81,8 @@ public class UserView extends GenericCDIView {
@EJB
private transient UserBeanLocal userbean;
@EJB
private transient ReaderBeanLocal readerbean;
......@@ -108,6 +110,9 @@ public class UserView extends GenericCDIView {
private boolean canSave = false;
private String username;
private String password;
private String emailCheck;
private String passwordcheck;
@EJB
......@@ -429,6 +434,14 @@ public class UserView extends GenericCDIView {
public String createUser() {
userbean.createNewUser(user, getPassword());
if(!permbean.isLoggedIn()) {
authView.setLogin(user.getLogin());
authView.setPassword(getPassword());
navihandler.saveNavigation("/user/created");
authView.executeLogin();
}
return "/user/created";
}
......@@ -618,4 +631,13 @@ public class UserView extends GenericCDIView {
return "";
}
public String getEmailCheck() {
return emailCheck;
}
public void setEmailCheck(String emailCheck) {
this.emailCheck = emailCheck;
}
}
......@@ -416,3 +416,12 @@ usercart.showoverview = Vie tarkastusn\u00E4kym\u00E4\u00E4n
viewlectures.title = Kurssit ja luennot
yes = Kyll\u00E4
user.emailAndUsername=Email (toimii k\u00E4ytt\u00E4j\u00E4tunnuksena)
user.emailtooshortmessage=
user.emailsunmatch=
user.emailAgain=S\u00E4hk\u00F6posti (uudelleen)
user.email=S\u00E4hk\u00F6postiosoite
required=Arvo vaaditaan
user.createdmessage=K\u00E4ytt\u00E4j\u00E4tunnus on luotu onnistuneesti.
product.vat=ALV-%
productFlag.CREATE_NEW_PLACE_WHEN_BOUGHT=Luo uusi paikka ostettaessa
......@@ -325,7 +325,7 @@ discount.details = Details
discount.edit = Edit
discount.maxNum = Max nr of discounts
discount.perUser = Discounts per user
discount.percentage = Discount percent
discount.percentage = Discount multiplier
discount.products = Products
discount.role = Role discount
discount.save = Save
......@@ -967,7 +967,7 @@ product.shopInstant = Create automatic cashpayment
product.sort = Sort nr
product.totalPrice = Total
product.unitName = Unit name
product.vat = VAT-% (0.0 - 0.99)
product.vat = VAT-%
productFlag.CREATE_NEW_PLACE_WHEN_BOUGHT = Create new place bought
productFlag.HIDE_FROM_INFOSHOP = Hide from info shop
......@@ -1425,7 +1425,7 @@ user.accountBalance = Account balance
user.accountEventHeader = Account events
user.accountevents = Account events
user.addToEvent = Associate user to event
user.address = Address
user.address = Street address
user.age = Age
user.bank = Bank
user.bankaccount = Bank number
......@@ -1436,7 +1436,7 @@ user.changepassword.forUser = For user
user.changepassword.title = Change password
user.confirmUserToEventAdding = Are you sure you want to associate this user to this event?
user.create = Create user
user.createdmessage = User has been created successfully. You can now login.
user.createdmessage = User has been created successfully.
user.cropImage = Crop image
user.cropUserImage = Crop image
user.defaultImage = Default picture
......@@ -1499,7 +1499,7 @@ user.sendPicture = Send image
user.sex = Sex
user.sex.FEMALE = Female
user.sex.MALE = Male
user.sex.UNDEFINED = Undefined
user.sex.UNDEFINED = Prefer not to say
user.shirt.L = Unisex L
user.shirt.LadyL = Ladyfit L
user.shirt.LadyM = Ladyfit M
......@@ -1561,10 +1561,10 @@ userview.header = Users
userview.invalidEmail = Invalid email address
userview.loginstringFaulty = Username has to be atleast 2 characters long!
userview.oldPasswordError = Invalid password!
userview.passwordTooShort = Password has to be atleast 5 characters long!
userview.passwordTooShort = Password has to be atleast {0} characters long\!
userview.passwordsChanged = Password changed
userview.passwordsDontMatch = Passwords do not match! Please try again!
userview.userExists = Username already exists! You may already have an account.
userview.userExists = Username already exists\! You may already have an account.
viewexpired.body = Please login again.
viewexpired.title = Login expired. Please login again.
......@@ -1616,3 +1616,9 @@ voting.create.voteStart = Voting start
yes = Yes
shop.unitdiscount=Discount
shop.customPrice=new price
user.emailAndUsername=Email (works also as username)
user.emailtooshortmessage=Email must be atleast {0} characters long.
user.emailsunmatch=Email addresses does not match.
user.emailAgain=Email (again)
required=Required
usercart.showoverview=
......@@ -326,7 +326,7 @@ discount.details = Tiedot
discount.edit = Muokkaa
discount.maxNum = Alennusten enimm\u00E4islkm
discount.perUser = Alennuksia per k\u00E4ytt\u00E4j\u00E4
discount.percentage = Alennusprosentti
discount.percentage = Alennuskerroin
discount.products = Tuotteet
discount.role = Roolialennus
discount.save = Tallenna
......@@ -950,7 +950,7 @@ product.shopInstant = Luo k\u00E4teismaksu tuotteille
product.sort = J\u00E4rjestys luku
product.totalPrice = Summa
product.unitName = Tuoteyksikk\u00F6
product.vat = ALV-% (0.0 - 0.99)
product.vat = ALV-%
productFlag.CREATE_NEW_PLACE_WHEN_BOUGHT = Luo uusi paikka ostettaessa
productFlag.HIDE_FROM_INFOSHOP = Piilota infon kaupasta
......@@ -1408,7 +1408,7 @@ user.accountBalance = Tilin saldo
user.accountEventHeader = Tilitapahtumat
user.accountevents = Tilitapahtumat
user.addToEvent = Liit\u00E4 k\u00E4ytt\u00E4j\u00E4 tapahtumaan
user.address = Osoite
user.address = l\u00E4hiosoite
user.age = Ik\u00E4
user.bank = Pankki
user.bankaccount = Pankkitili
......@@ -1419,7 +1419,7 @@ user.changepassword.forUser = K\u00E4ytt\u00E4j\u00E4lle
user.changepassword.title = Vaihda salasana
user.confirmUserToEventAdding = Oletko varma ett\u00E4 haluat liitt\u00E4\u00E4 t\u00E4m\u00E4n k\u00E4ytt\u00E4j\u00E4n t\u00E4h\u00E4n tapahtumaan?
user.create = Luo k\u00E4ytt\u00E4j\u00E4
user.createdmessage = K\u00E4ytt\u00E4j\u00E4tunnus on luotu onnistuneesti. Voit nyt kirjautua sis\u00E4\u00E4n.
user.createdmessage = K\u00E4ytt\u00E4j\u00E4tunnus on luotu onnistuneesti.
user.cropImage = Rajaa
user.cropUserImage = Crop image
user.defaultImage = Oletukuva
......@@ -1482,7 +1482,7 @@ user.sendPicture = Kuvan l\u00E4hetys
user.sex = Sukupuoli
user.sex.FEMALE = Nainen
user.sex.MALE = Mies
user.sex.UNDEFINED = M\u00E4\u00E4rittelem\u00E4tt\u00E4
user.sex.UNDEFINED = En halua kertoa
user.shirt.L = Unisex L
user.shirt.LadyL = Ladyfit L
user.shirt.LadyM = Ladyfit M
......@@ -1598,3 +1598,8 @@ voting.create.voteStart = \u00C4\u00E4nestys auki
yes = Kyll\u00E4
shop.unitdiscount=Alennus
shop.customPrice=Uusi hinta
user.emailAndUsername=S\u00E4hk\u00F6posti (toimii my\u00F6s k\u00E4ytt\u00E4j\u00E4tunnuksena)
user.emailtooshortmessage=S\u00E4hk\u00F6postin tarvitsee olla v\u00E4hint\u00E4\u00E4n {0} merkki\u00E4 pitk\u00E4.
user.emailsunmatch=S\u00E4hk\u00F6postiosoitteet eiv\u00E4t t\u00E4sm\u00E4\u00E4.
user.emailAgain=S\u00E4hk\u00F6posti (uudelleen)
required=Vaaditaan
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!