diff options
-rw-r--r-- | gentoobrowse/checks/loggedIn.xml | 9 | ||||
-rw-r--r-- | gentoobrowse/console/changelogs.xml | 14 | ||||
-rw-r--r-- | gentoobrowse/present/search.xml | 6 | ||||
-rw-r--r-- | gentoobrowse/request/doconfirm.xml | 17 | ||||
-rw-r--r-- | gentoobrowse/request/dologin.xml | 58 | ||||
-rw-r--r-- | gentoobrowse/request/dosignup.xml | 53 | ||||
-rw-r--r-- | gentoobrowse/request/track.xml | 20 |
7 files changed, 97 insertions, 80 deletions
diff --git a/gentoobrowse/checks/loggedIn.xml b/gentoobrowse/checks/loggedIn.xml index 1f81797..49893c3 100644 --- a/gentoobrowse/checks/loggedIn.xml +++ b/gentoobrowse/checks/loggedIn.xml @@ -1,6 +1,7 @@ <?xml version="1.0"?> -<project2:regexcheck xmlns:project2="http://project2.randomdan.homeip.net" present="login" name="loggedIn" regex="[1-9][0-9]*"> - <apply-to source="session" name="loggedInUserID"><default value="" /></apply-to> - <message>Not logged in</message> -</project2:regexcheck> +<project2:check xmlns:project2="http://project2.randomdan.homeip.net" present="login" name="loggedIn" message="Not logged in"> + <project2:regextest regex="[1-9][0-9]*"> + <apply-to source="session" name="loggedInUserID"><default value="" /></apply-to> + </project2:regextest> +</project2:check> diff --git a/gentoobrowse/console/changelogs.xml b/gentoobrowse/console/changelogs.xml index 1c1c73e..4d15568 100644 --- a/gentoobrowse/console/changelogs.xml +++ b/gentoobrowse/console/changelogs.xml @@ -44,12 +44,14 @@ <project2:iterate name="seelog" source="logcontent"> <project2:iterate name="seeentries" source="logentries"> <project2:if> - <project2:validdatecheck format="%d %b %Y"> - <apply-to source="parent" name="date" depth="1" warn="no" /> - </project2:validdatecheck> - <project2:regexcheck regex=".+@.+"> - <apply-to source="parent" name="email" depth="1" /> - </project2:regexcheck> + <project2:and> + <project2:validdatetest format="%d %b %Y"> + <apply-to source="parent" name="date" depth="1" warn="no" /> + </project2:validdatetest> + <project2:regextest regex=".+@.+"> + <apply-to source="parent" name="email" depth="1" /> + </project2:regextest> + </project2:and> <project2:sqlmergeinsert> <parameters> <packageid source="parent" name="packageid" depth="3" /> diff --git a/gentoobrowse/present/search.xml b/gentoobrowse/present/search.xml index 9f2f0df..3bcb9cb 100644 --- a/gentoobrowse/present/search.xml +++ b/gentoobrowse/present/search.xml @@ -4,10 +4,10 @@ <xi:include href="../views/search.xml" /> <xi:include href="../views/webcommon.xml" /> - <project2:if name="haveCriteria" mode="and"> - <project2:regexcheck name="criteriaLength" regex=".+"> + <project2:if name="haveCriteria"> + <project2:regextest name="criteriaLength" regex=".+"> <apply-to source="param" name="criteria" default="" /> - </project2:regexcheck> + </project2:regextest> <project2:view name="searchResults" source="packageSearch" rootname="searchResults" recordname="package" filter="freeText"> <parameters> <criteria source="param" name="criteria" default="" /> diff --git a/gentoobrowse/request/doconfirm.xml b/gentoobrowse/request/doconfirm.xml index dd7b036..2e73a08 100644 --- a/gentoobrowse/request/doconfirm.xml +++ b/gentoobrowse/request/doconfirm.xml @@ -2,14 +2,15 @@ <view name="doconfirm" present="accountHome" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../views/user.xml" /> - <project2:sqlcheck datasource="postgres-web" testOp="=" testValue="1" present="login" name="checkUserAuth"> - <message>No such pending account</message> - <sql> - SELECT COUNT(*) - FROM users - WHERE verifyguid = <param source="param" name="verifyguid" /> - </sql> - </project2:sqlcheck> + <project2:check present="login" name="checkUserAuth" message="No such pending account"> + <project2:sqltest datasource="postgres-web" testOp="=" testValue="1"> + <sql> + SELECT COUNT(*) + FROM users + WHERE verifyguid = <param source="param" name="verifyguid" /> + </sql> + </project2:sqltest> + </project2:check> <project2:iterate datasource="postgres-web" name="getUidFromDatabase" source="users" filter="verifyguid"> <parameters> <verifyguid source="param" name="verifyguid" /> diff --git a/gentoobrowse/request/dologin.xml b/gentoobrowse/request/dologin.xml index 23d2c5e..efab51a 100644 --- a/gentoobrowse/request/dologin.xml +++ b/gentoobrowse/request/dologin.xml @@ -2,32 +2,38 @@ <view name="dologin" present="accountHome" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> <xi:include href="../views/user.xml" /> - <project2:regexcheck present="login" name="usernameEntered" regex=".+"> - <apply-to source="param" name="username" /> - <message>User name required</message> - </project2:regexcheck> - <project2:regexcheck present="login" name="passwordLength" regex=".{6,}"> - <apply-to source="param" name="password" /> - <message>Password too short</message> - </project2:regexcheck> - <project2:sqlcheck datasource="postgres-web" testOp="=" testValue="1" present="login" name="checkUserAuth"> - <message>Invalid username or password</message> - <sql> - SELECT COUNT(*) - FROM users - WHERE username = <param source="param" name="username" /> - AND userpassword = <param source="param" name="password" /> - </sql> - </project2:sqlcheck> - <project2:sqlcheck datasource="postgres-web" testOp="=" testValue="1" present="confirm" name="checkConfirmed"> - <message>Confirmation code required</message> - <sql> - SELECT COUNT(*) - FROM users - WHERE username = <param source="param" name="username" /> - AND verifyguid IS NULL - </sql> - </project2:sqlcheck> + + <project2:check present="login" name="usernameEntered" message="User name required"> + <project2:regextest regex=".+"> + <apply-to source="param" name="username" /> + </project2:regextest> + </project2:check> + <project2:check present="login" name="passwordLength" message="Password too short"> + <project2:regextest regex=".{6,}"> + <apply-to source="param" name="password" /> + </project2:regextest> + </project2:check> + <project2:check present="login" name="checkUserAuth" message="Invalid username or password"> + <project2:sqltest datasource="postgres-web" testOp="=" testValue="1"> + <sql> + SELECT COUNT(*) + FROM users + WHERE username = <param source="param" name="username" /> + AND userpassword = <param source="param" name="password" /> + </sql> + </project2:sqltest> + </project2:check> + <project2:check present="confirm" name="checkConfirmed" message="Confirmation code required"> + <project2:sqltest datasource="postgres-web" testOp="=" testValue="1"> + <sql> + SELECT COUNT(*) + FROM users + WHERE username = <param source="param" name="username" /> + AND verifyguid IS NULL + </sql> + </project2:sqltest> + </project2:check> + <project2:iterate datasource="postgres-web" name="getUidFromDatabase" source="users" filter="username"> <parameters> <username source="param" name="username" /> diff --git a/gentoobrowse/request/dosignup.xml b/gentoobrowse/request/dosignup.xml index e59304a..5082fe0 100644 --- a/gentoobrowse/request/dosignup.xml +++ b/gentoobrowse/request/dosignup.xml @@ -1,30 +1,35 @@ <?xml version="1.0"?> <view name="dosignup" present="confirm" xmlns:xi="http://www.w3.org/2001/XInclude" xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:regexcheck present="signup" name="usernameEntered" regex=".+"> - <apply-to source="param" name="username" /> - <message>User name required</message> - </project2:regexcheck> - <project2:regexcheck present="signup" name="passwordLength" regex=".{6,}"> - <apply-to source="param" name="password" /> - <message>Password too short</message> - </project2:regexcheck> - <project2:sqlcheck datasource="postgres-web" testOp="=" testValue="0" present="signup" name="freeUsername"> - <message>Username already used</message> - <sql> - SELECT COUNT(*) - FROM users - WHERE username = <param source="param" name="username" /> - </sql> - </project2:sqlcheck> - <project2:sqlcheck datasource="postgres-web" testOp="=" testValue="0" present="signup" name="freeEmail"> - <message>Email address already used</message> - <sql> - SELECT COUNT(*) - FROM users - WHERE useremail = <param source="param" name="email" /> - </sql> - </project2:sqlcheck> + <project2:check present="signup" name="usernameEntered" message="User name required"> + <project2:regextest regex=".+"> + <apply-to source="param" name="username" /> + </project2:regextest> + </project2:check> + <project2:check present="signup" name="passwordLength" message="Password too short"> + <project2:regextest regex=".{6,}"> + <apply-to source="param" name="password" /> + </project2:regextest> + </project2:check> + <project2:check present="signup" name="freeUsername" message="Username already used"> + <project2:sqltest datasource="postgres-web" testOp="=" testValue="0"> + <sql> + SELECT COUNT(*) + FROM users + WHERE username = <param source="param" name="username" /> + </sql> + </project2:sqltest> + </project2:check> + <project2:check present="signup" name="freeEmail" message="Email address already used"> + <project2:sqltest datasource="postgres-web" testOp="=" testValue="0"> + <sql> + SELECT COUNT(*) + FROM users + WHERE useremail = <param source="param" name="email" /> + </sql> + </project2:sqltest> + </project2:check> + <project2:sqltask datasource="postgres-web" name="insertUser"> <sql>INSERT INTO users(username, userrealname, userpassword, useremail, verifyguid) VALUES(<param source="param" name="username" />, <param source="param" name="realname" />, diff --git a/gentoobrowse/request/track.xml b/gentoobrowse/request/track.xml index 204bc03..5bd9ae4 100644 --- a/gentoobrowse/request/track.xml +++ b/gentoobrowse/request/track.xml @@ -1,14 +1,16 @@ <?xml version="1.0"?> <request name="track" xmlns:project2="http://project2.randomdan.homeip.net"> - <project2:sqlcheck datasource="postgres-web" testOp="=" testValue="0" present="ok" name="checkNotTracked"> - <message>Package already tracked</message> - <sql> - SELECT COUNT(*) - FROM user_packages - WHERE packageid = <param source="param" name="packageid" /> - AND userid = <param source="session" name="loggedInUserID" /> - </sql> - </project2:sqlcheck> + <project2:check present="ok" name="checkNotTracked" message="Package already tracked"> + <project2:sqltest datasource="postgres-web" testOp="=" testValue="0"> + <sql> + SELECT COUNT(*) + FROM user_packages + WHERE packageid = <param source="param" name="packageid" /> + AND userid = <param source="session" name="loggedInUserID" /> + </sql> + </project2:sqltest> + </project2:check> + <project2:sqltask datasource="postgres-web" name="addTrack"> <sql>INSERT INTO user_packages(packageid, userid, trackedsince) VALUES( <param source="param" name="packageid" />, <param source="session" name="loggedInUserID" />, NOW())</sql> |