r2983 - in trunk: pollen-ui/src/main/java/org/chorem/pollen/ui/base pollen-ui/src/main/java/org/chorem/pollen/ui/components pollen-ui/src/main/java/org/chorem/pollen/ui/data pollen-ui/src/main/java/org/chorem/pollen/ui/pages pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user pollen-ui/src/main/java/org/chorem/pollen/ui/services pollen-ui/src/main/resources/i18n pollen-ui/src/main/resources/org/chorem/pollen/ui/components pollen-u
Author: fdesbois Date: 2010-05-04 12:11:20 +0200 (Tue, 04 May 2010) New Revision: 2983 Url: http://chorem.org/repositories/revision/pollen/2983 Log: - Add license descriptor - Evo #191 : use AuthenticationFilter and ServiceAuthentication to manage connected user authorizations - need Javadoc + these classes can be put into nuiton-tapestry-extra (AbstratMappedGridDataSource, ServiceAuthentication, ServiceAuthenticationAbstract, AbstractAuthenticationFilter) Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/RequiresAuthentication.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Connexion.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AbstractAuthenticationFilter.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AuthenticationFilter.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthentication.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthenticationAbstract.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthenticationImpl.java trunk/pollen-ui/src/main/webapp/Connexion.tml trunk/src/license/ trunk/src/license/project.xml Removed: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent.tml trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent_en.properties trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent_fr.properties trunk/pollen-ui/src/main/webapp/css/loginComponent.css Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/ErrorPage.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml trunk/pollen-ui/src/main/webapp/ErrorPage.tml trunk/pollen-ui/src/main/webapp/css/main.css Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/AbstractPollenPage.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -1,10 +1,10 @@ package org.chorem.pollen.ui.base; -import org.apache.tapestry5.annotations.Property; -import org.apache.tapestry5.annotations.SessionState; +import org.apache.tapestry5.ioc.annotations.Inject; import org.chorem.pollen.entity.UserAccount; import org.chorem.pollen.ui.components.Border; +import org.chorem.pollen.ui.services.ServiceAuthentication; /** * AbstractPollenPage @@ -16,13 +16,9 @@ public abstract class AbstractPollenPage implements PollenPage { /** Connected UserAccount from Session **/ - @SessionState - @Property - private UserAccount user; + @Inject + private ServiceAuthentication<UserAccount> serviceAuthentication; - @Property - private boolean userExists; - /** * Retrieve the border layout of the page. * @@ -31,38 +27,13 @@ public abstract Border getBorder(); /** - * Default value set to false for needAuthentification. - * - * @return false - * @see PollenPage#isNeedAuthentification() - */ - @Override - public boolean isNeedAuthentification() { - return false; - } - - /** - * Default value set to true for canDisplayPage. - * - * @return true - * @see PollenPage#canDisplayPage() - */ - @Override - public boolean canDisplayPage() { - return true; - } - - /** * Retrieve the connected user from Session. * * @return the UserAccount corresponding to connected user */ @Override public UserAccount getUserConnected() { - if (isUserConnected()) { - return user; - } - return null; + return serviceAuthentication.getUserConnected(); } /** @@ -71,7 +42,7 @@ * @param user to set in session. */ public void setUserConnected(UserAccount user) { - this.user = user; + serviceAuthentication.setUserConnected(user); } /** @@ -81,7 +52,7 @@ */ @Override public boolean isUserConnected() { - return userExists; + return serviceAuthentication.isUserConnected(); } /** @@ -91,7 +62,7 @@ */ @Override public boolean isAdminConnected() { - return isUserConnected() && user.getAdmin(); + return isUserConnected() && getUserConnected().getAdmin(); } /** Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/base/PollenPage.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -13,20 +13,6 @@ public interface PollenPage { /** - * Return true if the page need an authentification to be displayed. - * - * @return true for authentification needed - */ - boolean isNeedAuthentification(); - - /** - * Return true if the page can be displayed, depends on user rights. - * - * @return true for display allowed - */ - boolean canDisplayPage(); - - /** * Retrieve connected user from session. * * @return the user currently connected. @@ -52,7 +38,7 @@ * * @param message to display */ - public void addInfo(String message) ; + public void addInfo(String message); /** * Add a fatal {@code message} to display. Only the fatal {@code message} Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/Border.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -23,14 +23,11 @@ import java.util.Locale; import org.apache.tapestry5.BindingConstants; -import org.apache.tapestry5.Block; import org.apache.tapestry5.annotations.Component; import org.apache.tapestry5.annotations.InjectComponent; -import org.apache.tapestry5.annotations.InjectContainer; import org.apache.tapestry5.annotations.Log; import org.apache.tapestry5.annotations.Parameter; import org.apache.tapestry5.annotations.Property; -import org.apache.tapestry5.annotations.SessionState; import org.apache.tapestry5.ioc.Messages; import org.apache.tapestry5.ioc.annotations.Inject; import org.apache.tapestry5.services.PersistentLocale; @@ -41,10 +38,10 @@ import org.chorem.pollen.ui.data.AddressBarItem; import org.chorem.pollen.PollenBusinessException; import org.chorem.pollen.service.ServiceUser; -import org.chorem.pollen.ui.base.PollenPage; import org.chorem.pollen.ui.data.AddressBar; import org.chorem.pollen.ui.pages.Index; import org.chorem.pollen.ui.services.PollenManager; +import org.chorem.pollen.ui.services.ServiceAuthentication; import org.slf4j.Logger; /** @@ -127,20 +124,7 @@ @Property private String password; - /** - * Objet de session représentant l'utilisateur identifié - */ - @SessionState - @Property - private UserAccount user; - /** - * vrai si l'utilisateur s'est identifié, faux sinon - */ - @SuppressWarnings("unused") - @Property - private boolean userExists; - /** Locale courante */ @Inject private Locale currentLocale; @@ -151,11 +135,14 @@ @Inject private PersistentLocale localeService; + /** Injection des services */ @Inject private PollenManager manager; - /** Injection des services */ @Inject + private ServiceAuthentication<UserAccount> serviceAuthentication; + + @Inject private ServiceUser serviceUser; /** @@ -173,19 +160,8 @@ @InjectComponent private ContextLink feedContext; - @InjectContainer - private PollenPage page; - - @Inject - private Block loginBlock; - - @Inject - private Block pageBlock; - private boolean fatal; - private boolean needAuthentification; - private String serverPath; /** @@ -201,19 +177,12 @@ } else { logo = "pollen" + pageLogo + "_en.png"; } - - // Error messages for display authorization - if (isNeedAuthentification()) { - addError(messages.get("pollen.ui.user.display.notConnected")); - } else if (!page.canDisplayPage()) { - addError(messages.get("pollen.ui.user.display.notAllowed")); - } } boolean afterRender() { - if (needAuthentification) { - return false; - } +// if (needAuthentification) { +// return false; +// } // Check if fatal errors has been added to the border // Reload the page if feedBack hasn't been reloaded yet to display @@ -231,14 +200,14 @@ return true; } - public Object getActiveBlock() { - if (isNeedAuthentification()) { - return loginBlock; - } else if (canDisplayBody()) { - return pageBlock; - } - return null; - } +// public Object getActiveBlock() { +// if (isNeedAuthentification()) { +// return loginBlock; +// } else if (canDisplayBody()) { +// return pageBlock; +// } +// return null; +// } public String getServerPath() { if (serverPath == null) { @@ -264,12 +233,12 @@ fatal = true; } - public boolean isNeedAuthentification() { - return !userExists && page.isNeedAuthentification(); - } +// public boolean isNeedAuthentification() { +// return !userExists && page.isNeedAuthentification(); +// } public boolean canDisplayBody() { - return !fatal && page.canDisplayPage(); + return !fatal/* && page.canDisplayPage()*/; } public DateFormat getDateFormat() { @@ -281,6 +250,14 @@ return feedContext; } + public boolean isUserExists() { + return serviceAuthentication.isUserConnected(); + } + + public UserAccount getUser() { + return serviceAuthentication.getUserConnected(); + } + /** * User connection. Call business to check user existence. * @@ -289,10 +266,10 @@ @Log Object onSuccessFromConnection() { // No need to connect if user exists - if (!userExists) { + if (!serviceAuthentication.isUserConnected()) { try { UserAccount current = serviceUser.connect(login, password); - user = current; + serviceAuthentication.setUserConnected(current); // Change locale for user //localeService.set(new Locale(user.getLanguage())); feedback.addInfo(messages.get("loginOk")); @@ -311,7 +288,7 @@ * @return la zone à mettre à jour */ Object onActionFromLogout() { - user = null; + serviceAuthentication.setUserConnected(null); request.getSession(false).invalidate(); return Index.class; } Deleted: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/components/LoginComponent.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -1,97 +0,0 @@ -/* *##% Pollen - * Copyright (C) 2009 CodeLutin - * - * 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. - * - * 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. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. ##%*/ - -package org.chorem.pollen.ui.components; - -import org.apache.tapestry5.annotations.Component; -import org.apache.tapestry5.annotations.IncludeStylesheet; -import org.apache.tapestry5.annotations.Property; -import org.apache.tapestry5.annotations.SessionState; -import org.apache.tapestry5.ioc.Messages; -import org.apache.tapestry5.ioc.annotations.Inject; -import org.chorem.pollen.PollenBusinessException; -import org.chorem.pollen.entity.UserAccount; -import org.chorem.pollen.service.ServiceUser; -import org.chorem.pollen.ui.services.PollenManager; - -/** - * Formulaire d'identification. Formulaire que l'utilisateur doit remplir pour - * se connecter quand il veut accéder à une page qui demande à être identifié. - * - * @author kmorin - * @version $Id$ - */ -@IncludeStylesheet("context:css/loginComponent.css") -public class LoginComponent { - - /** Affichage des messages pour l'utilisateur */ - @Component(id = "loginCompFeedback") - private FeedBack feedback; - - /** - * Objet de session représentant l'utilisateur identifié. - */ - @SuppressWarnings("unused") - @SessionState - private UserAccount user; - @SuppressWarnings("unused") - @Property - private boolean userExists; - - /** - * Champ login du formulaire d'identification - */ - @Property - private String connectionLogin; - - /** - * Champ password du formulaire d'identification - */ - @Property - private String connectionPassword; - - @Inject - private Messages messages; - - /** Injection des services */ - @Inject - private ServiceUser serviceUser; - - @Inject - private PollenManager manager; - - /** - * Methode appelée lorsque l'utilisateur s'identifie - * - * @return la zone à mettre à jour - */ - Object onSuccessFromLoginCompForm() { - // Récupération de l'utilisateur identifié - UserAccount current; - try { - current = serviceUser.connect(connectionLogin, connectionPassword); - if (current != null) { - user = current; - } else { - feedback.addError(messages.get("loginFailed")); - } - } catch (PollenBusinessException eee) { - // TODO - feedback.addError(messages.get("loginFailed")); - } - return this; - } -} Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/AbstractMappedGridDataSource.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -16,18 +16,19 @@ import org.slf4j.LoggerFactory; /** - * ContactDataSource + * AbstractMappedGridDataSource * + * TODO : javadoc + * * Created: 18 janv. 2010 * * @param <K> Type of the map key * @param <E> Type of the map value * @author fdesbois <fdesbois@codelutin.com> */ -public abstract class AbstractMappedGridDataSource<K, E extends TopiaEntity> +public abstract class AbstractMappedGridDataSource<K, E> implements GridDataSource { - private Logger log = LoggerFactory.getLogger(AbstractMappedGridDataSource.class); @@ -40,15 +41,19 @@ private int nbRowsPerPage; @Override + public abstract Class<?> getRowType(); + + protected abstract int count(); + + protected abstract Map<K, E> execute(int startIndex, int endIndex, + SortConstraint orderBy); + + @Override public int getAvailableRows() { if (nbRows < 0) { - try { - nbRows = count(); - if (log.isDebugEnabled()) { - log.debug("Count : " + nbRows); - } - } catch (PollenException eee) { - throw new TapestryException("", eee); + nbRows = count(); + if (log.isDebugEnabled()) { + log.debug("Count : " + nbRows); } } return nbRows; @@ -61,24 +66,39 @@ log.debug("Prepare results : " + startIndex + ", " + endIndex); } nbRowsPerPage = endIndex - startIndex + 1; - try { - mapResults = execute(startIndex, endIndex, getSortConstraint(sortConstraints)); - listResults = new ArrayList<E>(mapResults.values()); - } catch (PollenException eee) { - throw new TapestryException("", eee); + mapResults = execute(startIndex, endIndex, + getSortConstraint(sortConstraints)); + listResults = new ArrayList<E>(mapResults.values()); + } + + @Override + public Object getRowValue(int index) { + index = index % nbRowsPerPage; + if (index >= listResults.size()) { + if (log.isErrorEnabled()) { + log.error("Size error : " + index + " / " + listResults.size()); + } + return null; } + return CollectionUtils.get(listResults, index); } - protected abstract Map<K, E> execute(int startIndex, int endIndex, - SortConstraint orderBy) throws PollenException; + public E get(K key) { + return mapResults.get(key); + } - protected abstract int count() throws PollenException; + public List<E> values() { + return listResults; + } - protected SortConstraint getSortConstraint(List<SortConstraint> sortConstraints) { - for (SortConstraint constraint : sortConstraints) - { - final ColumnSort sort = constraint.getColumnSort(); + public boolean contains(K key) { + return mapResults.containsKey(key); + } + protected SortConstraint getSortConstraint( + List<SortConstraint> sortConstraints) { + for (SortConstraint constraint : sortConstraints) { + final ColumnSort sort = constraint.getColumnSort(); if (sort != ColumnSort.UNSORTED) { return constraint; } @@ -104,31 +124,4 @@ return filterOrder; } - @Override - public Object getRowValue(int index) { - index = index % nbRowsPerPage; - if (index >= listResults.size()) { - if (log.isErrorEnabled()) { - log.error("Size error : " + index + " / " + listResults.size()); - } - return null; - } - return CollectionUtils.get(listResults, index); - } - - @Override - public abstract Class<?> getRowType(); - - public E get(K key) { - return mapResults.get(key); - } - - public List<E> values() { - return listResults; - } - - public boolean contains(K key) { - return mapResults.containsKey(key); - } - } Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/RequiresAuthentication.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/RequiresAuthentication.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/RequiresAuthentication.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -0,0 +1,25 @@ + +package org.chorem.pollen.ui.data; + +import java.lang.annotation.Documented; +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * This annotation is used on pages and components that need authentication + * to be rendered. + * + * Created: 3 mai 2010 + * + * @author fdesbois + * $Id$ + */ +@Target( { ElementType.TYPE }) +@Retention(RetentionPolicy.RUNTIME) +@Documented +public @interface RequiresAuthentication { + + boolean adminOnly() default false; +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/data/RequiresAuthentication.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Connexion.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Connexion.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Connexion.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -0,0 +1,127 @@ + +package org.chorem.pollen.ui.pages; + +import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.annotations.Log; +import org.apache.tapestry5.annotations.Property; +import org.apache.tapestry5.corelib.components.Form; +import org.apache.tapestry5.ioc.Messages; +import org.apache.tapestry5.ioc.annotations.Inject; +import org.apache.tapestry5.services.PageRenderLinkSource; +import org.chorem.pollen.PollenBusinessException; +import org.chorem.pollen.entity.UserAccount; +import org.chorem.pollen.service.ServiceUser; +import org.chorem.pollen.ui.base.AbstractPollenPage; +import org.chorem.pollen.ui.components.Border; +import org.chorem.pollen.ui.data.AddressBar; +import org.chorem.pollen.ui.services.PollenManager; +import org.chorem.pollen.ui.services.ServiceAuthentication; +import org.slf4j.Logger; + +/** + * Connexion + * + * Created: 4 mai 2010 + * + * @author fdesbois + * $Id$ + */ +public class Connexion extends AbstractPollenPage { + + @InjectComponent + private Border border; + + @Override + public Border getBorder() { + return border; + } + + public AddressBar getAddressBar() { + return AddressBar.newBar(); + } + + @InjectComponent + private Form loginForm; + + /** + * Champ login du formulaire d'identification + */ + @Property + private String connectionLogin; + + /** + * Champ password du formulaire d'identification + */ + @Property + private String connectionPassword; + + /** Injection des services */ + @Inject + private Logger logger; + + @Inject + private Messages messages; + + @Inject + private ServiceAuthentication<UserAccount> serviceAuthentication; + + @Inject + private ServiceUser serviceUser; + + @Inject + private PollenManager manager; + + @Inject + private PageRenderLinkSource pageRender; + + private String pageName; + + void onActivate(String pageName) { + this.pageName = pageName; + } + + String onPassivate() { + return pageName; + } + + void setupRender() { + addError(messages.format("pollen.ui.user.display.notConnected", + pageName)); + } + + void onValidateFormFromLoginForm() { + UserAccount current; + try { + current = serviceUser.connect(connectionLogin, connectionPassword); + if (current != null) { + serviceAuthentication.setUserConnected(current); + } else { + loginForm.recordError(messages.get("loginFailed")); + } + } catch (PollenBusinessException eee) { + // TODO two different errors, on password or on login + //addError(messages.get("loginFailed")); + String message = manager.getErrorMessage(eee, messages, logger); + loginForm.recordError(message); + } + } + + /** + * Methode appelée lorsque l'utilisateur s'identifie + * + * @return la zone à mettre à jour + */ + @Log + Object onSuccessFromLoginForm() { + if (pageName == null) { + pageName = "index"; + } + return pageRender.createPageRenderLink(pageName); + } + + @Log + void onFailureFromLoginForm() { + + } + +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/Connexion.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/ErrorPage.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/ErrorPage.java 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/ErrorPage.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -2,6 +2,8 @@ package org.chorem.pollen.ui.pages; import org.apache.tapestry5.annotations.InjectComponent; +import org.apache.tapestry5.ioc.Messages; +import org.apache.tapestry5.ioc.annotations.Inject; import org.chorem.pollen.ui.base.AbstractPollenPage; import org.chorem.pollen.ui.components.Border; import org.chorem.pollen.ui.data.AddressBar; @@ -23,13 +25,33 @@ @InjectComponent private Border border; + @Inject + private Messages messages; + + private String pageName; + @Override public Border getBorder() { return border; } - public AddressBarItem[] getAddress() { - return AddressBar.newBar().getItems(); + public AddressBar getAddressBar() { + return AddressBar.newBar(); } + + void onActivate(String pageName) { + this.pageName = pageName; + } + + String onPassivate() { + return pageName; + } + + void setupRender() { + if (pageName != null) { + addError(messages.format("pollen.ui.user.display.notAllowed", + pageName)); + } + } } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/admin/AdminUsers.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -39,6 +39,7 @@ import org.chorem.pollen.ui.base.AbstractPollenPage; import org.chorem.pollen.ui.components.Border; import org.chorem.pollen.ui.data.AddressBar; +import org.chorem.pollen.ui.data.RequiresAuthentication; import org.chorem.pollen.ui.data.UserAccountDataSource; import org.chorem.pollen.ui.services.PollenManager; import org.slf4j.Logger; @@ -49,6 +50,7 @@ * @author fdesbois <fdesbois@codelutin.com> * @version $Id$ */ +@RequiresAuthentication(adminOnly = true) @IncludeStylesheet("context:css/usersAdmin.css") public class AdminUsers extends AbstractPollenPage { @@ -66,16 +68,6 @@ return border; } - @Override - public boolean isNeedAuthentification() { - return true; - } - - @Override - public boolean canDisplayPage() { - return isAdminConnected(); - } - public AddressBar getAddressBar() { return AddressBar.newBar().appendCurrent(title); } Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserLists.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -29,6 +29,7 @@ import org.chorem.pollen.ui.base.AbstractPollenPage; import org.chorem.pollen.ui.components.Border; import org.chorem.pollen.ui.data.AddressBar; +import org.chorem.pollen.ui.data.RequiresAuthentication; /** * Classe de la page d'affichage des listes de votants favorites de @@ -39,6 +40,7 @@ * @author fdesbois <fdesbois@codelutin.com> * @version $Id$ */ +@RequiresAuthentication @IncludeStylesheet("context:css/lists.css") public class UserLists extends AbstractPollenPage { @@ -60,16 +62,6 @@ public Border getBorder() { return border; } - - @Override - public boolean isNeedAuthentification() { - return true; - } - - @Override - public boolean canDisplayPage() { - return isUserConnected(); - } public AddressBar getAddressBar() { return AddressBar.newBar().appendCurrent(title); Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserProfile.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -38,6 +38,7 @@ import org.chorem.pollen.ui.base.AbstractPollenPage; import org.chorem.pollen.ui.components.Border; import org.chorem.pollen.ui.data.AddressBar; +import org.chorem.pollen.ui.data.RequiresAuthentication; import org.chorem.pollen.ui.services.PollenManager; import org.slf4j.Logger; @@ -48,6 +49,7 @@ * @author rannou * @version $Id$ */ +@RequiresAuthentication @IncludeStylesheet("context:css/account.css") public class UserProfile extends AbstractPollenPage { @@ -59,16 +61,6 @@ return border; } - @Override - public boolean isNeedAuthentification() { - return true; - } - - @Override - public boolean canDisplayPage() { - return isUserConnected(); - } - @Inject private Logger logger; Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/pages/user/UserRegister.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -16,8 +16,6 @@ package org.chorem.pollen.ui.pages.user; - -import java.util.Locale; import org.apache.commons.lang.StringUtils; import org.apache.tapestry5.BindingConstants; import org.apache.tapestry5.annotations.Component; @@ -61,18 +59,13 @@ public Border getBorder() { return border; } +// +// @Override +// public boolean canDisplayPage() { +// addInfo("Vous devez vous déconnecter pour créer un compte"); +// return !isUserConnected(); +// } - @Override - public boolean isNeedAuthentification() { - return false; - } - - @Override - public boolean canDisplayPage() { - addInfo("Vous devez vous déconnecter pour créer un compte"); - return !isUserConnected(); - } - @Inject private Logger logger; Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AbstractAuthenticationFilter.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AbstractAuthenticationFilter.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AbstractAuthenticationFilter.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -0,0 +1,151 @@ +package org.chorem.pollen.ui.services; + +import java.io.IOException; +import java.lang.annotation.Annotation; +import org.apache.tapestry5.Link; +import org.apache.tapestry5.runtime.Component; +import org.apache.tapestry5.services.ComponentEventRequestParameters; +import org.apache.tapestry5.services.ComponentRequestFilter; +import org.apache.tapestry5.services.ComponentRequestHandler; +import org.apache.tapestry5.services.ComponentSource; +import org.apache.tapestry5.services.PageRenderLinkSource; +import org.apache.tapestry5.services.PageRenderRequestParameters; +import org.apache.tapestry5.services.Response; +import org.chorem.pollen.entity.UserAccount; +import org.chorem.pollen.ui.data.RequiresAuthentication; +import org.chorem.pollen.ui.pages.Connexion; +import org.chorem.pollen.ui.pages.ErrorPage; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * RequiresAuthenticationFilter + * + * Created: 3 mai 2010 + * + * @param <U> type of User + * @param <A> type of Annotation that manage authentication on pages/components + * @author fdesbois + * $Id$ + */ +public abstract class AbstractAuthenticationFilter<U, A extends Annotation> + implements ComponentRequestFilter { + + private static final Logger logger = + LoggerFactory.getLogger(AbstractAuthenticationFilter.class); + + private final PageRenderLinkSource pageRender; + + private final ComponentSource componentSource; + + private final Response response; + + private final ServiceAuthentication<U> serviceAuthentication; + + protected Class<A> annotationClass; + + public AbstractAuthenticationFilter(PageRenderLinkSource renderLinkSource, + ComponentSource componentSource, Response response, + ServiceAuthentication<U> serviceAuthentication, + Class<A> annotationClass) { + this.pageRender = renderLinkSource; + this.componentSource = componentSource; + this.response = response; + this.serviceAuthentication = serviceAuthentication; + this.annotationClass = annotationClass; + + if (logger.isTraceEnabled()) { + logger.trace("Construct"); + } + } + + @Override + public void handleComponentEvent( + ComponentEventRequestParameters parameters, + ComponentRequestHandler handler) throws IOException { + + if (logger.isTraceEnabled()) { + logger.trace("handleComponentEvent"); + } + + if (dispatchedToLoginPage(parameters.getActivePageName())) { + return; + } + + handler.handleComponentEvent(parameters); + + } + + @Override + public void handlePageRender(PageRenderRequestParameters parameters, + ComponentRequestHandler handler) throws IOException { + + if (logger.isTraceEnabled()) { + logger.trace("handlePageRender"); + } + + if (dispatchedToLoginPage(parameters.getLogicalPageName())) { + return; + } + + handler.handlePageRender(parameters); + } + + private boolean dispatchedToLoginPage(String pageName) throws IOException { + + Component page = componentSource.getPage(pageName); + + if (logger.isTraceEnabled()) { + logger.trace("Page name : " + pageName); + logger.trace("Page class : " + page.getClass()); + logger.trace("RequiresLogin annotation : " + + page.getClass().isAnnotationPresent(annotationClass)); + logger.trace("User in session : " + + serviceAuthentication.isUserConnected()); + } + + if (!page.getClass().isAnnotationPresent(annotationClass)) { + return false; + } + +// Class<?> redirectPage = Connexion.class; + AuthenticationRedirect redirectType = AuthenticationRedirect.CONNEXION; + + if (serviceAuthentication.isUserConnected()) { + U user = serviceAuthentication.getUserConnected(); + if (logger.isTraceEnabled()) { + logger.trace("User connected : " + user); + logger.trace("User allowed : " + + serviceAuthentication.isAllowed(page.getClass())); + } + + if (serviceAuthentication.isAllowed(page.getClass())) { + return false; + } + +// redirectPage = ErrorPage.class; + redirectType = AuthenticationRedirect.NOT_ALLOWED; + } + + Class<?> redirectPage = getRedirectPage(redirectType); + Link link = pageRender.createPageRenderLinkWithContext(redirectPage, + pageName); + + if (logger.isTraceEnabled()) { + logger.trace("Redirection to " + redirectPage.getSimpleName() + + " page..."); + } + + response.sendRedirect(link); + + return true; + } + + protected enum AuthenticationRedirect { + CONNEXION, NOT_ALLOWED; + } + + protected abstract Class<?> getRedirectPage( + AuthenticationRedirect redirectType); +} + Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AbstractAuthenticationFilter.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AppModule.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -27,8 +27,10 @@ import org.apache.tapestry5.ioc.services.SymbolProvider; import org.apache.tapestry5.services.ApplicationStateContribution; import org.apache.tapestry5.services.ApplicationStateCreator; +import org.apache.tapestry5.services.ApplicationStateManager; import org.apache.tapestry5.services.BindingFactory; import org.apache.tapestry5.services.BindingSource; +import org.apache.tapestry5.services.ComponentRequestFilter; import org.apache.tapestry5.upload.services.UploadSymbols; import org.chorem.pollen.PollenContextImpl; import org.chorem.pollen.entity.UserAccount; @@ -88,6 +90,13 @@ return new ServiceImageImpl(manager.getContext()); } + public ServiceAuthentication<UserAccount> buildServiceAuthentication( + ApplicationStateManager stateManager) { + ServiceAuthentication<UserAccount> instance = + new ServiceAuthenticationImpl(stateManager); + return instance; + } + /** * Execute PollenManager when registry startup. * The manager will be instantiated using @@ -207,10 +216,11 @@ * Used to instanciate SessionState UserAccount when session expires. * * @param configuration to add the ApplicationStateCreator. - * @param serviceUser to instantiate user + * @param serviceAuthentication to instantiate user */ - public void contributeApplicationStateManager(MappedConfiguration<Class<?>, ApplicationStateContribution> configuration, - final ServiceUser serviceUser) { + public void contributeApplicationStateManager(MappedConfiguration<Class<?>, + ApplicationStateContribution> configuration, + final ServiceAuthentication<UserAccount> serviceAuthentication) { if (logger.isInfoEnabled()) { logger.info("Execute contributeApplicationStateManager"); } @@ -220,7 +230,7 @@ @Override public UserAccount create() { - return serviceUser.getNewUser(); + return serviceAuthentication.getNewUserInstance(); } }; @@ -228,6 +238,22 @@ new ApplicationStateContribution("session", creator)); } + /** + * Contribution to ComponentRequestHandler service. The + * {@link AuthenticationFilter} is added to the configuration of + * the service to provide authentication managment on user connected. + * + * @param configuration of ComponentRequestHandler + * @see ServiceAuthentication + * @see AuthenticationFilter + * @see ComponentRequestFilter + */ + public static void contributeComponentRequestHandler( + OrderedConfiguration<ComponentRequestFilter> configuration) { + configuration.addInstance("RequiresAuthentication", + AuthenticationFilter.class); + } + public static void contributeBindingSource( MappedConfiguration<String, BindingFactory> configuration, BindingSource bindingSource) { Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AuthenticationFilter.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AuthenticationFilter.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AuthenticationFilter.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -0,0 +1,42 @@ + +package org.chorem.pollen.ui.services; + +import org.apache.tapestry5.services.ComponentSource; +import org.apache.tapestry5.services.PageRenderLinkSource; +import org.apache.tapestry5.services.Response; +import org.chorem.pollen.entity.UserAccount; +import org.chorem.pollen.ui.data.RequiresAuthentication; +import org.chorem.pollen.ui.pages.Connexion; +import org.chorem.pollen.ui.pages.ErrorPage; +import org.chorem.pollen.ui.services.AbstractAuthenticationFilter.AuthenticationRedirect; + +/** + * AuthenticationFilter + * + * Created: 4 mai 2010 + * + * @author fdesbois + * $Id$ + */ +public class AuthenticationFilter extends + AbstractAuthenticationFilter<UserAccount, RequiresAuthentication>{ + + public AuthenticationFilter(PageRenderLinkSource renderLinkSource, + ComponentSource componentSource, Response response, + ServiceAuthentication<UserAccount> serviceAuthentication) { + super(renderLinkSource, componentSource, response, + serviceAuthentication, RequiresAuthentication.class); + } + + @Override + protected Class<?> getRedirectPage(AuthenticationRedirect redirectType) { + switch (redirectType) { + case CONNEXION: + return Connexion.class; + case NOT_ALLOWED: + return ErrorPage.class; + } + return null; + } + +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/AuthenticationFilter.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthentication.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthentication.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthentication.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -0,0 +1,27 @@ + +package org.chorem.pollen.ui.services; + +import org.chorem.pollen.entity.UserAccount; + +/** + * ServiceAuthentication + * + * Created: 3 mai 2010 + * + * @param <U> user type + * @author fdesbois + * $Id$ + */ +public interface ServiceAuthentication<U> { + + boolean isUserConnected(); + + U getUserConnected(); + + void setUserConnected(U user); + + boolean isAllowed(Class<?> page); + + U getNewUserInstance(); + +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthentication.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthenticationAbstract.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthenticationAbstract.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthenticationAbstract.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -0,0 +1,71 @@ + +package org.chorem.pollen.ui.services; + +import java.lang.annotation.Annotation; +import org.apache.tapestry5.services.ApplicationStateManager; + +/** + * ServiceAuthenticationImpl + * + * Created: 3 mai 2010 + * + * @param <U> + * @param <A> + * @author fdesbois + * $Id$ + */ +public abstract class ServiceAuthenticationAbstract<U, A extends Annotation> + implements ServiceAuthentication<U> { + + private final ApplicationStateManager stateManager; + + private Class<U> userClass; + + private Class<A> annotationClass; + + public ServiceAuthenticationAbstract(ApplicationStateManager stateManager, + Class<U> userClass, Class<A> annotationClass) { + this.stateManager = stateManager; + this.userClass = userClass; + this.annotationClass = annotationClass; + } + + @Override + public boolean isUserConnected() { + return stateManager.exists(userClass); + } + + @Override + public U getUserConnected() { + return stateManager.getIfExists(userClass); + } + + @Override + public void setUserConnected(U user) { + stateManager.set(userClass, user); + } + + @Override + public boolean isAllowed(Class<?> page) { + if (page.isAnnotationPresent(annotationClass) && + isUserConnected()) { + + A check = page.getAnnotation(annotationClass); + + U user = getUserConnected(); + + return checkAuthorizations(user, check); + + // Check if user not admin is allowed +// if (!user.getAdmin() && check.adminOnly()) { +// return false; +// } +// return false; + } + // No restriction if annotation is not present + return true; + } + + protected abstract boolean checkAuthorizations(U user, A annotation); + +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthenticationAbstract.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Added: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthenticationImpl.java =================================================================== --- trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthenticationImpl.java (rev 0) +++ trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthenticationImpl.java 2010-05-04 10:11:20 UTC (rev 2983) @@ -0,0 +1,36 @@ + +package org.chorem.pollen.ui.services; + +import org.apache.tapestry5.services.ApplicationStateManager; +import org.chorem.pollen.entity.UserAccount; +import org.chorem.pollen.entity.UserAccountImpl; +import org.chorem.pollen.ui.data.RequiresAuthentication; + +/** + * ServiceAuthenticationImpl + * + * Created: 4 mai 2010 + * + * @author fdesbois + * $Id$ + */ +public class ServiceAuthenticationImpl extends + ServiceAuthenticationAbstract<UserAccount, RequiresAuthentication> { + + public ServiceAuthenticationImpl(ApplicationStateManager stateManager) { + super(stateManager, UserAccount.class, RequiresAuthentication.class); + } + + @Override + protected boolean checkAuthorizations(UserAccount user, + RequiresAuthentication annotation) { + // No problem for an admin or if the annotation has no limitation + return user.getAdmin() || !annotation.adminOnly(); + } + + @Override + public UserAccount getNewUserInstance() { + return new UserAccountImpl(); + } + +} Property changes on: trunk/pollen-ui/src/main/java/org/chorem/pollen/ui/services/ServiceAuthenticationImpl.java ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties =================================================================== --- trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/resources/i18n/pollen-ui-fr_FR.properties 2010-05-04 10:11:20 UTC (rev 2983) @@ -17,8 +17,8 @@ pollen.ui.user.register.sendEmail=Un email vous a \u00E9t\u00E9 envoy\u00E9 \u00E0 l'adresse %1$s. pollen.ui.user.validate.passwords=Les deux mots de passe ne correspondent pas. pollen.ui.user.update.success=Modification enregistr\u00E9e avec succ\u00E8s. -pollen.ui.user.display.notConnected=Vous devez vous connecter pour acc\u00E9der \u00E0 cette page. -pollen.ui.user.display.notAllowed=Vous n'avez pas les droits n\u00E9cessaires pour acc\u00E9der \u00E0 cette page. +pollen.ui.user.display.notConnected=Vous devez vous connecter pour acc\u00E9der \u00E0 la page %1$s. +pollen.ui.user.display.notAllowed=Vous n'avez pas les droits n\u00E9cessaires pour acc\u00E9der \u00E0 la page %1$s. pollen.ui.user.create.title=Cr\u00E9er un nouvel utilisateur pollen.ui.user.create.passwordGenerated=Le mot de passe du nouvel utilisateur a \u00E9t\u00E9 g\u00E9n\u00E9r\u00E9. pollen.ui.user.create.passwordSameAsLogin=Le mot de passe du nouvel utilisateur est le m\u00EAme que son identifiant. @@ -38,6 +38,15 @@ pollen.ui.list.update.emptyList=Liste vide. Ajoutez des votants en saisissant leur nom et email. pollen.ui.list.update.addParticipant=Ajouter un nouvel utilisateur \u00E0 la liste +# OLD LOGIN_COMPONENT +connectionLegend=Connexion +loginSubmit=Me connecter +loginComp-label=Identifiant +loginComp-required-message=Vous devez entrer votre identifiant. +passwordComp-label=Mot de passe +passwordComp-required-message=Vous devez entrer votre mot de passe. +loginFailed=Mauvais identifiant ou mot de passe. + # FORM:: user firstName-label=Pr\u00E9nom lastName-label=Nom Modified: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/Border.tml 2010-05-04 10:11:20 UTC (rev 2983) @@ -159,21 +159,7 @@ <t:feedback t:id="errorJs" /> </noscript> <t:feedback t:id="borderFeedback" t:autoClear="false"/> - <t:delegate t:to="activeBlock" /> - <t:block t:id="loginBlock"> - <t:LoginComponent /> - </t:block> - <t:block t:id="pageBlock"> - <t:body /> - </t:block> - <!--<t:if t:test="needAuthentification"> - <t:LoginComponent /> - <p:else> - <t:if t:test="canDisplayBody()"> - <t:body /> - </t:if> - </p:else> - </t:if>--> + <t:body /> </div> </div> Deleted: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent.tml =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent.tml 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent.tml 2010-05-04 10:11:20 UTC (rev 2983) @@ -1,18 +0,0 @@ - -<t:form t:id="loginCompForm" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> - <FieldSet> - <legend>${message:connectionLegend}</legend> - <t:feedback t:id="loginCompFeedback" /> - <div> - <t:label for="connectionLogin" /> - <input t:type="TextField" t:id="connectionLogin" validate="required" /> - </div> - <div> - <t:label for="connectionPassword" /> - <input t:type="PasswordField" t:id="connectionPassword" validate="required" /> - </div> - <div class="buttons"> - <input t:id="submitLoginCompForm" t:type="Submit" t:value="${message:loginSubmit}" /> - </div> - </FieldSet> -</t:form> Deleted: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent_en.properties =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent_en.properties 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent_en.properties 2010-05-04 10:11:20 UTC (rev 2983) @@ -1,7 +0,0 @@ -connectionLegend=LogIn -loginSubmit=Log me in -loginComp-label=Login -loginComp-required-message=You must enter your login. -passwordComp-label=Password -passwordComp-required-message=You must enter your password. -loginFailed=Login or password invalid. \ No newline at end of file Deleted: trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent_fr.properties =================================================================== --- trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent_fr.properties 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/resources/org/chorem/pollen/ui/components/LoginComponent_fr.properties 2010-05-04 10:11:20 UTC (rev 2983) @@ -1,7 +0,0 @@ -connectionLegend=Connexion -loginSubmit=Me connecter -loginComp-label=Identifiant -loginComp-required-message=Vous devez entrer votre identifiant. -passwordComp-label=Mot de passe -passwordComp-required-message=Vous devez entrer votre mot de passe. -loginFailed=Mauvais identifiant ou mot de passe. \ No newline at end of file Added: trunk/pollen-ui/src/main/webapp/Connexion.tml =================================================================== --- trunk/pollen-ui/src/main/webapp/Connexion.tml (rev 0) +++ trunk/pollen-ui/src/main/webapp/Connexion.tml 2010-05-04 10:11:20 UTC (rev 2983) @@ -0,0 +1,23 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<t:border t:addressBar="addressBar" t:pageLogo="literal:Index" + xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> + + <t:form t:id="loginForm"> + <fieldset> + <legend>${message:connectionLegend}</legend> + <t:errors /> + <div> + <t:label for="connectionLogin" /> + <input t:type="TextField" t:id="connectionLogin" validate="required" /> + </div> + <div> + <t:label for="connectionPassword" /> + <input t:type="PasswordField" t:id="connectionPassword" validate="required" /> + </div> + <div class="buttons"> + <input t:id="submitLoginCompForm" t:type="Submit" t:value="${message:loginSubmit}" /> + </div> + </fieldset> + </t:form> + +</t:border> \ No newline at end of file Property changes on: trunk/pollen-ui/src/main/webapp/Connexion.tml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL Modified: trunk/pollen-ui/src/main/webapp/ErrorPage.tml =================================================================== --- trunk/pollen-ui/src/main/webapp/ErrorPage.tml 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/webapp/ErrorPage.tml 2010-05-04 10:11:20 UTC (rev 2983) @@ -1,4 +1,4 @@ -<t:border t:address="address" t:pageLogo="literal:Index" +<t:border t:addressBar="addressBar" t:pageLogo="literal:Index" xmlns:t="http://tapestry.apache.org/schema/tapestry_5_1_0.xsd" xmlns:p="tapestry:parameter"> </t:border> Deleted: trunk/pollen-ui/src/main/webapp/css/loginComponent.css =================================================================== --- trunk/pollen-ui/src/main/webapp/css/loginComponent.css 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/webapp/css/loginComponent.css 2010-05-04 10:11:20 UTC (rev 2983) @@ -1,35 +0,0 @@ -#loginCompForm fieldset { - border: 1px solid #aab; - padding: 15px; - padding-bottom: 10px; - width: 280px; - margin: auto; - margin-top: 20px; - vertical-align: top; - text-align: left; -} - -#loginCompForm div { - margin-bottom: 10px; -} - -#loginCompForm label { - display: block; - width: 100px; - float: left; -} - -.buttons { - text-align: center; - margin-top: 20px; - padding-left: 0px; -} - -.fb-error { - width: 270px; - margin: auto; - text-align: center; - color: #f00; - font-weight: bold; - border: 0; -} \ No newline at end of file Modified: trunk/pollen-ui/src/main/webapp/css/main.css =================================================================== --- trunk/pollen-ui/src/main/webapp/css/main.css 2010-04-30 09:40:14 UTC (rev 2982) +++ trunk/pollen-ui/src/main/webapp/css/main.css 2010-05-04 10:11:20 UTC (rev 2983) @@ -392,4 +392,32 @@ #po-footer a, #po-footer span { color:#727a7e; +} + +/** old LoginComponent > Connexion page **/ +#loginCompForm fieldset { + border: 1px solid #aab; + padding: 15px; + padding-bottom: 10px; + width: 280px; + margin: auto; + margin-top: 20px; + vertical-align: top; + text-align: left; +} + +#loginCompForm div { + margin-bottom: 10px; +} + +#loginCompForm label { + display: block; + width: 100px; + float: left; +} + +#loginCompForm .buttons { + text-align: center; + margin-top: 20px; + padding-left: 0px; } \ No newline at end of file Added: trunk/src/license/project.xml =================================================================== --- trunk/src/license/project.xml (rev 0) +++ trunk/src/license/project.xml 2010-05-04 10:11:20 UTC (rev 2983) @@ -0,0 +1,105 @@ +<?xml version='1.0' encoding='UTF-8'?> +<project xmlns="http://maven-site.nuiton.org/maven-license-plugin/1.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven-site.nuiton.org/maven-license-plugin/1.0.0 http://maven-site.nuiton.org/maven-license-plugin/licenseProjectDescriptor-1.0.0.xsd"> + <mainLicense>gpl_v3</mainLicense> + + <headers> + + <header> + <commentStyle>java</commentStyle> + <fileSets> + <fileSet> + <basedir>src/main/java</basedir> + <include>**/*.java</include> + </fileSet> + <fileSet> + <!-- assets for tapestry --> + <basedir>src/main/webapp</basedir> + <includes> + <include>**/*.css</include> + <include>**/*.js</include> + </includes> + </fileSet> + <fileSet> + <!-- tests --> + <basedir>src/test/java</basedir> + <include>**/*.java</include> + </fileSet> + <fileSet> + <!-- generated sources with EUGene --> + <basedir>target/generated-sources/java</basedir> + <include>**/*.java</include> + </fileSet> + </fileSets> + </header> + + <header> + <commentStyle>rst</commentStyle> + <fileSet> + <!-- maven-site --> + <basedir>src/site</basedir> + <include>**/*.rst</include> + </fileSet> + </header> + + <header> + <commentStyle>xml</commentStyle> + <fileSets> + <fileSet> + <!-- tapestry templates for pages --> + <basedir>src/main/webapp</basedir> + <includes> + <include>**/*.tml</include> + <include>**/*.xml</include> + </includes> + </fileSet> + <fileSet> + <!-- tapestry templates for components --> + <basedir>src/main/resources</basedir> + <includes> + <include>**/*.tml</include> + <include>**/*.xml</include> + </includes> + </fileSet> + <fileSet> + <!-- test pages for components --> + <basedir>src/test/java</basedir> + <include>**/*.tml</include> + </fileSet> + <fileSet> + <!-- maven-site --> + <basedir>src/site</basedir> + <include>**/*.xml</include> + </fileSet> + <fileSet> + <!-- generated sources with EUGene (hibernate mappings) --> + <basedir>target/generated-sources/java</basedir> + <include>**/*.xml</include> + </fileSet> + </fileSets> + </header> + + <header> + <commentStyle>properties</commentStyle> + <fileSets> + <fileSet> + <!-- i18n --> + <basedir>src/main/resources</basedir> + <include>**/*.properties</include> + </fileSet> + <fileSet> + <!-- i18n for tapestry --> + <basedir>src/main/webapp</basedir> + <include>**/*.properties</include> + </fileSet> + <fileSet> + <!-- maven filtered properties --> + <basedir>src/main/filters</basedir> + <include>**/*.properties</include> + </fileSet> + </fileSets> + </header> + </headers> + +</project> Property changes on: trunk/src/license/project.xml ___________________________________________________________________ Added: svn:keywords + Author Date Id Revision HeadURL
participants (1)
-
fdesbois@users.chorem.org