summaryrefslogtreecommitdiff
path: root/actions/register.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@prodromou.name>2008-07-09 01:53:43 -0400
committerEvan Prodromou <evan@prodromou.name>2008-07-09 01:53:43 -0400
commita67108190a6601db874cedd244b6439feff11258 (patch)
treede9de87902362b41a556c4fb14a9481fcaa77018 /actions/register.php
parent625ac7e1d9ad6b78e713fc556cf544158719fdc9 (diff)
don't refetch user objects so much
darcs-hash:20080709055343-84dde-ac550608a4736ce5daed70af19866c75a1cfb416.gz
Diffstat (limited to 'actions/register.php')
-rw-r--r--actions/register.php16
1 files changed, 10 insertions, 6 deletions
diff --git a/actions/register.php b/actions/register.php
index 3d34de2eb..74a41e706 100644
--- a/actions/register.php
+++ b/actions/register.php
@@ -63,20 +63,24 @@ class RegisterAction extends Action {
$this->show_form(_t('Email address already exists.'));
} else if ($password != $confirm) {
$this->show_form(_t('Passwords don\'t match.'));
- } else if ($this->register_user($nickname, $password, $email)) {
+ } else {
+ $user = $this->register_user($nickname, $password, $email);
+ if (!$user) {
+ $this->show_form(_t('Invalid username or password.'));
+ return;
+ }
# success!
- if (!common_set_user($nickname)) {
+ if (!common_set_user($user)) {
common_server_error(_t('Error setting user.'));
return;
}
+ # this is a real login
common_real_login(true);
if ($this->boolean('rememberme')) {
common_debug('Adding rememberme cookie for ' . $nickname);
- common_rememberme();
+ common_rememberme($user);
}
common_redirect(common_local_url('profilesettings'));
- } else {
- $this->show_form(_t('Invalid username or password.'));
}
}
@@ -148,7 +152,7 @@ class RegisterAction extends Action {
$email);
}
- return $result;
+ return $user;
}
function show_top($error=NULL) {