From d98ba1df3e29f54f58ed5a6d5de2199ba568a4a4 Mon Sep 17 00:00:00 2001 From: randomdan Date: Sun, 11 Jul 2010 23:35:41 +0000 Subject: Add signup and email confirmation --- gentoobrowse/emails/signup.xslt | 23 ++++++++++++++++++ gentoobrowse/emails/welcome.xml | 16 +++++++++++++ gentoobrowse/present/confirm.xml | 13 +++++++++++ gentoobrowse/request/doconfirm.xml | 35 +++++++++++++++++++++++++++ gentoobrowse/request/dologin.xml | 12 ++++++++++ gentoobrowse/request/dosignup.xml | 48 ++++++++++++++++++++++++++++++++++++++ 6 files changed, 147 insertions(+) create mode 100644 gentoobrowse/emails/signup.xslt create mode 100644 gentoobrowse/emails/welcome.xml create mode 100644 gentoobrowse/present/confirm.xml create mode 100644 gentoobrowse/request/doconfirm.xml create mode 100644 gentoobrowse/request/dosignup.xml diff --git a/gentoobrowse/emails/signup.xslt b/gentoobrowse/emails/signup.xslt new file mode 100644 index 0000000..914784d --- /dev/null +++ b/gentoobrowse/emails/signup.xslt @@ -0,0 +1,23 @@ + + + + + + + Welcome to Gentoo Browse + + +

Welcome to Gentoo Browse!

+

+ Click http:///confirm?verifyguid= + this link to confirm your account. +

+

Or alternatively, copy and paste this code into the confirmation page:

+ + +
+
+ diff --git a/gentoobrowse/emails/welcome.xml b/gentoobrowse/emails/welcome.xml new file mode 100644 index 0000000..09d2c3d --- /dev/null +++ b/gentoobrowse/emails/welcome.xml @@ -0,0 +1,16 @@ + + + + + + SELECT userid, CAST(verifyguid AS TEXT) AS guid + FROM users u + WHERE useremail = ? + AND verifyguid IS NOT NULL + + + + + + diff --git a/gentoobrowse/present/confirm.xml b/gentoobrowse/present/confirm.xml new file mode 100644 index 0000000..5784bdf --- /dev/null +++ b/gentoobrowse/present/confirm.xml @@ -0,0 +1,13 @@ + + + + Please enter the confirmation code from your welcome email. +
+ +
+
+
+ + diff --git a/gentoobrowse/request/doconfirm.xml b/gentoobrowse/request/doconfirm.xml new file mode 100644 index 0000000..70a1128 --- /dev/null +++ b/gentoobrowse/request/doconfirm.xml @@ -0,0 +1,35 @@ + + + + + Invalid username or password + + SELECT COUNT(*) + FROM users + WHERE verifyguid = ? + + + + + + + + SELECT userid + FROM users + WHERE verifyguid = ? + + + + + + + + + + UPDATE users SET verifyguid = NULL WHERE verifyguid = ? + + + + + diff --git a/gentoobrowse/request/dologin.xml b/gentoobrowse/request/dologin.xml index 0eda6bc..dde399f 100644 --- a/gentoobrowse/request/dologin.xml +++ b/gentoobrowse/request/dologin.xml @@ -23,6 +23,18 @@ + + Confirmation code required + + SELECT COUNT(*) + FROM users + WHERE username = ? + AND verifyguid IS NULL + + + + + SELECT userid diff --git a/gentoobrowse/request/dosignup.xml b/gentoobrowse/request/dosignup.xml new file mode 100644 index 0000000..158853d --- /dev/null +++ b/gentoobrowse/request/dosignup.xml @@ -0,0 +1,48 @@ + + + + + .+ + User name required + + + .{6,} + Password too short + + + Username already used + + SELECT COUNT(*) + FROM users + WHERE username = ? + + + + + + + Email address already used + + SELECT COUNT(*) + FROM users + WHERE useremail = ? + + + + + + + INSERT INTO users(username, userrealname, userpassword, useremail, verifyguid) + VALUES(?, ?, ?, ?, uuid_generate_v4()) + + + + + + + + + + -- cgit v1.2.3