remove email settings from profile settings ahead of having its own tab

darcs-hash:20080715220144-84dde-9b4c8338b8acf0c1268947cb4a9b8cbdb9751a7f.gz
This commit is contained in:
Evan Prodromou 2008-07-15 18:01:44 -04:00
parent 38b215805e
commit 12615c8e36
1 changed files with 3 additions and 52 deletions

View File

@ -43,9 +43,6 @@ class ProfilesettingsAction extends SettingsAction {
_('1-64 lowercase letters or numbers, no punctuation or spaces'));
common_input('fullname', _('Full name'),
($this->arg('fullname')) ? $this->arg('fullname') : $profile->fullname);
common_input('email', _('Email address'),
($this->arg('email')) ? $this->arg('email') : $user->email,
_('Used only for updates, announcements, and password recovery'));
common_input('homepage', _('Homepage'),
($this->arg('homepage')) ? $this->arg('homepage') : $profile->homepage,
_('URL of your homepage, blog, or profile on another site'));
@ -64,19 +61,15 @@ class ProfilesettingsAction extends SettingsAction {
$nickname = $this->trimmed('nickname');
$fullname = $this->trimmed('fullname');
$email = $this->trimmed('email');
$homepage = $this->trimmed('homepage');
$bio = $this->trimmed('bio');
$location = $this->trimmed('location');
# Some validation
if ($email && !Validate::email($email, true)) {
$this->show_form(_('Not a valid email address.'));
return;
} else if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,
'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
if (!Validate::string($nickname, array('min_length' => 1,
'max_length' => 64,
'format' => VALIDATE_NUM . VALIDATE_ALPHA_LOWER))) {
$this->show_form(_('Nickname must have only lowercase letters and numbers and no spaces.'));
return;
} else if (!User::allowed_nickname($nickname)) {
@ -98,9 +91,6 @@ class ProfilesettingsAction extends SettingsAction {
} else if ($this->nickname_exists($nickname)) {
$this->show_form(_('Nickname already in use. Try another one.'));
return;
} else if ($this->email_exists($email)) {
$this->show_form(_('Email address already exists.'));
return;
}
$user = common_current_user();
@ -125,35 +115,6 @@ class ProfilesettingsAction extends SettingsAction {
}
}
if ($user->email != $email) {
common_debug('Updating user email from ' . $user->email . ' to ' . $email,
__FILE__);
# We don't update email directly; it gets done by confirmemail
$confirm = new Confirm_address();
$confirm->code = common_confirmation_code(128);
$confirm->user_id = $user->id;
$confirm->address = $email;
$confirm->address_type = 'email';
$result = $confirm->insert();
if (!$result) {
common_log_db_error($confirm, 'INSERT', __FILE__);
common_server_error(_('Couldn\'t confirm email.'));
return FALSE;
}
# XXX: try not to do this in the middle of a transaction
mail_confirm_address($confirm->code,
$profile->nickname,
$email);
}
$profile = $user->getProfile();
$orig_profile = clone($profile);
@ -192,14 +153,4 @@ class ProfilesettingsAction extends SettingsAction {
return $other->id != $user->id;
}
}
function email_exists($email) {
$user = common_current_user();
$other = User::staticGet('email', $email);
if (!$other) {
return false;
} else {
return $other->id != $user->id;
}
}
}