summaryrefslogtreecommitdiff
path: root/actions/profilesettings.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/profilesettings.php
parent5d1a6f0fef3b99167babfa304ceda9b67720f399 (diff)
call validate before saving objects
darcs-hash:20080520191032-84dde-64197121c93cd4cf3cbc614badff0bd44547f9f9.gz
Diffstat (limited to 'actions/profilesettings.php')
-rw-r--r--actions/profilesettings.php14
1 files changed, 14 insertions, 0 deletions
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;