summaryrefslogtreecommitdiff
path: root/actions/register.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-05-20 15:10:32 -0400
committerEvan Prodromou <evan@prodromou.name>2008-05-20 15:10:32 -0400
commit3f5ededc01d8eedac2a9a75917849fbe78a3e701 (patch)
tree50627d9a90854d51f52fa398b044046b382fe3c8 /actions/register.php
parent5d1a6f0fef3b99167babfa304ceda9b67720f399 (diff)
call validate before saving objects
darcs-hash:20080520191032-84dde-64197121c93cd4cf3cbc614badff0bd44547f9f9.gz
Diffstat (limited to 'actions/register.php')
-rw-r--r--actions/register.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/actions/register.php b/actions/register.php
index f9402b98f..2fa663389 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -83,6 +83,12 @@ class RegisterAction extends Action {
$profile->nickname = $nickname;
$profile->profileurl = common_profile_url($nickname);
$profile->created = DB_DataObject_Cast::dateTime(); # current time
+
+ $val = $profile->validate();
+ if ($val !== TRUE) {
+ # XXX: some feedback here, please!
+ return FALSE;
+ }
$id = $profile->insert();
if (!$id) {
return FALSE;
@@ -93,6 +99,15 @@ class RegisterAction extends Action {
$user->password = common_munge_password($password, $id);
$user->email = $email;
$user->created = DB_DataObject_Cast::dateTime(); # current time
+
+ $val = $user->validate();
+ if ($val !== TRUE) {
+ # XXX: some feedback here, please!
+ # Try to clean up...
+ $profile->delete();
+ return FALSE;
+ }
+
$result = $user->insert();
if (!$result) {
# Try to clean up...