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/profilesettings.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'actions/profilesettings.php') diff --git a/actions/profilesettings.php b/actions/profilesettings.php index ab8175901..a0c9527a2 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -70,6 +70,13 @@ class ProfilesettingsAction extends SettingsAction { $user->nickname = $this->arg('nickname'); $user->email = $this->arg('email'); + $val = $user->validate(); + if ($val !== TRUE) { + # XXX: better validation + $this->show_form(_t('Error saving user; invalid.')); + return; + } + if (!$user->update($original)) { common_server_error(_t('Couldnt update user.')); return; @@ -86,6 +93,13 @@ class ProfilesettingsAction extends SettingsAction { $profile->location = $this->arg('location'); $profile->profileurl = common_profile_url($nickname); + $val = $profile->validate(); + if ($val !== TRUE) { + # XXX: some feedback here, please! + $this->show_form(_t('Error saving profile; invalid.')); + return; + } + if (!$profile->update($orig_profile)) { common_server_error(_t('Couldnt save profile.')); return; -- cgit v1.2.3-54-g00ecf