From 3f5ededc01d8eedac2a9a75917849fbe78a3e701 Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Tue, 20 May 2008 15:10:32 -0400 Subject: call validate before saving objects darcs-hash:20080520191032-84dde-64197121c93cd4cf3cbc614badff0bd44547f9f9.gz --- actions/register.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'actions/register.php') 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... -- cgit v1.2.3-54-g00ecf