diff options
author | Henri Herscher <henri@oreka.org> | 2005-12-02 16:40:53 +0000 |
---|---|---|
committer | Henri Herscher <henri@oreka.org> | 2005-12-02 16:40:53 +0000 |
commit | 47c4702591be9938a1ea0bb81575db628e9acfbd (patch) | |
tree | c7f805029fdd0112dfc392980eb377cd5e2feaaa /orkweb | |
parent | c851c21a303403f24f19572ba09905473c55a8b9 (diff) |
Added account page where user can change password
git-svn-id: https://oreka.svn.sourceforge.net/svnroot/oreka/trunk@85 09dcff7a-b715-0410-9601-b79a96267cd0
Diffstat (limited to 'orkweb')
-rw-r--r-- | orkweb/context/WEB-INF/Account.html | 44 | ||||
-rw-r--r-- | orkweb/context/WEB-INF/Account.page | 8 | ||||
-rw-r--r-- | orkweb/src/net/sf/oreka/pages/AccountPage.java | 36 | ||||
-rw-r--r-- | orkweb/src/net/sf/oreka/tapestry/MainMenu.html | 5 | ||||
-rw-r--r-- | orkweb/src/net/sf/oreka/tapestry/MainMenu.properties | 3 |
5 files changed, 95 insertions, 1 deletions
diff --git a/orkweb/context/WEB-INF/Account.html b/orkweb/context/WEB-INF/Account.html new file mode 100644 index 0000000..8062e25 --- /dev/null +++ b/orkweb/context/WEB-INF/Account.html @@ -0,0 +1,44 @@ +<html jwcid="@Shell" stylesheet="asset:globalStylesheet" title="OrkWeb" > +<link jwcid="@If" condition="false" href="orekastyle.css" rel="stylesheet" type="text/css"/> + +<body> +<table width="99%" border="0" align="center" cellpadding="0" cellspacing="0"> + <tr> + <td colspan="2"><span jwcid="@my:MainMenu" pageName="Home">Here goes the main menu</span></td> + </tr> + <tr> + <td class="criteria"> + <form jwcid="@Form"> + <table class="inputform"> + <tr> + <td> </td> + </tr> + <tr> + <td> + <font color="red"> + <span jwcid="@Insert" value="ognl:errorMessage">Error Message</span> + </font> + </td> + </tr> + <tr> + <td>password</td> + <td><input jwcid="@TextField" value="ognl:password" translator="translator:string" hidden="true"/></td> + </tr> + <tr> + <td>New Password</td> + <td><input jwcid="@TextField" value="ognl:newPassword1" translator="translator:string" hidden="true"/></td> + </tr> + <tr> + <td>Retype new Password</td> + <td><input jwcid="@TextField" value="ognl:newPassword2" translator="translator:string" hidden="true"/></td> + </tr> + <tr> + <td><input type="submit" id="submitbutton" jwcid="@Submit" action="ognl:listeners.formSubmit" value="Change Password"/></td> + </tr> + </table> + </form> + </td> + </tr> +</table> +</body> +</html>
\ No newline at end of file diff --git a/orkweb/context/WEB-INF/Account.page b/orkweb/context/WEB-INF/Account.page new file mode 100644 index 0000000..b4d977b --- /dev/null +++ b/orkweb/context/WEB-INF/Account.page @@ -0,0 +1,8 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE page-specification + PUBLIC "-//Apache Software Foundation//Tapestry Specification 4.0//EN" + "http://jakarta.apache.org/tapestry/dtd/Tapestry_4_0.dtd"> + +<page-specification class="net.sf.oreka.pages.AccountPage"> + <description><![CDATA[ add a description ]]></description> + </page-specification>
\ No newline at end of file diff --git a/orkweb/src/net/sf/oreka/pages/AccountPage.java b/orkweb/src/net/sf/oreka/pages/AccountPage.java new file mode 100644 index 0000000..c64349e --- /dev/null +++ b/orkweb/src/net/sf/oreka/pages/AccountPage.java @@ -0,0 +1,36 @@ +package net.sf.oreka.pages; + +import net.sf.oreka.services.UserServiceHbn; + +import org.apache.tapestry.IRequestCycle; +import org.apache.tapestry.annotations.Persist; + +public abstract class AccountPage extends ProtectedPage { + + static UserServiceHbn srv = new UserServiceHbn(); + + public abstract String getNewPassword1(); + public abstract void setNewPassword1(String password); + + public abstract String getNewPassword2(); + public abstract void setNewPassword2(String password); + + public abstract String getPassword(); + public abstract void setPassword(String password); + + @Persist + public abstract String getErrorMessage(); + public abstract void setErrorMessage(String msg); + + public void formSubmit(IRequestCycle cycle) { + + setErrorMessage("Password Incorrect, please try again"); + + if(getNewPassword1().equals(getNewPassword2())) { + if (srv.changePassword(getSessionStateObject().getUser().getId(), getPassword(), getNewPassword1())) { + setErrorMessage(null); + cycle.activate("RecSegments"); + } + } + } +} diff --git a/orkweb/src/net/sf/oreka/tapestry/MainMenu.html b/orkweb/src/net/sf/oreka/tapestry/MainMenu.html index 99a31f0..836fbb2 100644 --- a/orkweb/src/net/sf/oreka/tapestry/MainMenu.html +++ b/orkweb/src/net/sf/oreka/tapestry/MainMenu.html @@ -23,6 +23,11 @@ <table class="menubuttons"> <tr> <td> + <a jwcid="@PageLink" page="Account"> + <span key="Account">Account</span> + </a> + </td> + <td> <span jwcid="@ServiceLink" service="ognl:@org.apache.tapestry.Tapestry@RESTART_SERVICE">Logout</span> </td> </tr> diff --git a/orkweb/src/net/sf/oreka/tapestry/MainMenu.properties b/orkweb/src/net/sf/oreka/tapestry/MainMenu.properties index 22b8416..8649162 100644 --- a/orkweb/src/net/sf/oreka/tapestry/MainMenu.properties +++ b/orkweb/src/net/sf/oreka/tapestry/MainMenu.properties @@ -1,2 +1,3 @@ RecSegments=Browse -Home=Welcome
\ No newline at end of file +Home=Welcome +Account=Account
\ No newline at end of file |