[richfaces-svn-commits] JBoss Rich Faces SVN: r13644 - in trunk/test-applications/realworld2/web/src/main: webapp and 3 other directories.

richfaces-svn-commits at lists.jboss.org richfaces-svn-commits at lists.jboss.org
Fri Apr 17 11:59:05 EDT 2009


Author: amarkhel
Date: 2009-04-17 11:59:04 -0400 (Fri, 17 Apr 2009)
New Revision: 13644

Added:
   trunk/test-applications/realworld2/web/src/main/webapp/includes/register.xhtml
Removed:
   trunk/test-applications/realworld2/web/src/main/webapp/register.xhtml
Modified:
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
   trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/NavigationEnum.java
   trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/index/header.xhtml
   trunk/test-applications/realworld2/web/src/main/webapp/includes/index/login.xhtml
Log:


Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java	2009-04-17 15:58:55 UTC (rev 13643)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Authenticator.java	2009-04-17 15:59:04 UTC (rev 13644)
@@ -107,10 +107,9 @@
 		}
 	}
 
-	@End
-    public String register(User user){
+    public void register(User user){
     	if(checkPassword(user) || checkUserExist(user)){
-    		return "";
+    		return;
     	}
     	user.setPasswordHash(hash(user.getPassword()));
     	user.setPreDefined(false);
@@ -118,21 +117,19 @@
     		userAction.register(user);
     	}
     	catch(Exception e){
-    		return "";
+    		return;
     	}
-    	return Constants.INDEX_OUTCOME;
+    	credentials.setPassword(user.getPassword());
+    	credentials.setUsername(user.getLogin());
+    	login();
+
     }
 	
-	@End
-	public String goToIndex(){
-		return Constants.INDEX_OUTCOME;
-	}
-	
-	public String goToRegister(){
-    	identity.unAuthenticate();
-    	Contexts.getSessionContext().set("user", new User());
+	public void goToRegister(){
+		Contexts.getSessionContext().set("user", new User());
+    	Contexts.getConversationContext().set("avatarUpload", null);
     	setLoginFailed(false);
-    	return Constants.REGISTER_OUTCOME;
+    	Events.instance().raiseEvent(Constants.START_REGISTER_EVENT);
     }
 	
 	private boolean checkUserExist(User user) {

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java	2009-04-17 15:58:55 UTC (rev 13643)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/Controller.java	2009-04-17 15:59:04 UTC (rev 13644)
@@ -239,6 +239,15 @@
 		pushEvent(Constants.ADD_ERROR_EVENT, error);
 	}
 	
+	@Observer(Constants.START_REGISTER_EVENT)
+	public void startRegistration(){
+		model.resetModel(NavigationEnum.REGISTER, user, null, null, null, null);
+	}
+	
+	public void cancelRegistration(){
+		model.resetModel(NavigationEnum.ANONYM, user, null, null, null, null);
+	}
+	
 	public Integer getPage(){
 		Integer index = model.getSelectedAlbum().getIndex(model.getSelectedImage());
 		return index/5 + 1;

Modified: trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/NavigationEnum.java
===================================================================
--- trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/NavigationEnum.java	2009-04-17 15:58:55 UTC (rev 13643)
+++ trunk/test-applications/realworld2/web/src/main/java/org/richfaces/realworld/manager/NavigationEnum.java	2009-04-17 15:59:04 UTC (rev 13644)
@@ -24,6 +24,7 @@
 	ANONYM("includes/publicShelves.xhtml"),
 	FILE_UPLOAD("includes/fileUpload.xhtml"),
 	USER_PREFS("includes/userPrefs.xhtml"),
+	REGISTER("includes/register.xhtml"),
 	SEARCH("includes/search.xhtml"),
 	ALBUM_PREVIEW("includes/album.xhtml"),
 	ALBUM_IMAGE_PREVIEW("/includes/image.xhtml"),

Modified: trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml
===================================================================
--- trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml	2009-04-17 15:58:55 UTC (rev 13643)
+++ trunk/test-applications/realworld2/web/src/main/webapp/WEB-INF/pages.xml	2009-04-17 15:59:04 UTC (rev 13644)
@@ -2,17 +2,6 @@
 <pages xmlns="http://jboss.com/products/seam/pages"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.1.xsd">
-
-    <page view-id="*">
-        <navigation>
-			<rule if-outcome="register">
-                <redirect view-id="/register.xhtml"/>
-            </rule>
-            <rule if-outcome="index">
-                <redirect view-id="/index.html"/>
-            </rule>
-            </navigation>
-    </page>
    
    <page view-id="/index.xhtml">
    <begin-conversation if="#{!identity.isLoggedIn()}"/>

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/index/header.xhtml
===================================================================
(Binary files differ)

Modified: trunk/test-applications/realworld2/web/src/main/webapp/includes/index/login.xhtml
===================================================================
(Binary files differ)

Added: trunk/test-applications/realworld2/web/src/main/webapp/includes/register.xhtml
===================================================================
(Binary files differ)


Property changes on: trunk/test-applications/realworld2/web/src/main/webapp/includes/register.xhtml
___________________________________________________________________
Name: svn:mime-type
   + application/xhtml+xml

Deleted: trunk/test-applications/realworld2/web/src/main/webapp/register.xhtml
===================================================================
(Binary files differ)




More information about the richfaces-svn-commits mailing list