fix rememberme checkboxes on login, register

darcs-hash:20080702125457-84dde-d27e405d7003c86886ad81b87bbbf20cbf6fba1c.gz
This commit is contained in:
Evan Prodromou 2008-07-02 08:54:57 -04:00
parent c6ddd4268b
commit 4ee649058f
2 changed files with 18 additions and 18 deletions

View File

@ -70,7 +70,7 @@ class LoginAction extends Action {
'action' => common_local_url('login'))); 'action' => common_local_url('login')));
common_input('nickname', _t('Nickname')); common_input('nickname', _t('Nickname'));
common_password('password', _t('Password')); common_password('password', _t('Password'));
common_checkbox('rememberme', _t('Remember me'), common_checkbox('rememberme', _t('Remember me'), false,
_t('Automatically login in the future; ' . _t('Automatically login in the future; ' .
'not for shared computers!')); 'not for shared computers!'));
common_submit('submit', _t('Login')); common_submit('submit', _t('Login'));

View File

@ -36,9 +36,9 @@ class RegisterAction extends Action {
function try_register() { function try_register() {
$nickname = $this->trimmed('nickname'); $nickname = $this->trimmed('nickname');
$email = $this->trimmed('email'); $email = $this->trimmed('email');
# We don't trim these... whitespace is OK in a password! # We don't trim these... whitespace is OK in a password!
$password = $this->arg('password'); $password = $this->arg('password');
$confirm = $this->arg('confirm'); $confirm = $this->arg('confirm');
@ -95,17 +95,17 @@ class RegisterAction extends Action {
} }
function register_user($nickname, $password, $email) { function register_user($nickname, $password, $email) {
$profile = new Profile(); $profile = new Profile();
$profile->query('BEGIN'); $profile->query('BEGIN');
$profile->nickname = $nickname; $profile->nickname = $nickname;
$profile->profileurl = common_profile_url($nickname); $profile->profileurl = common_profile_url($nickname);
$profile->created = DB_DataObject_Cast::dateTime(); # current time $profile->created = DB_DataObject_Cast::dateTime(); # current time
$id = $profile->insert(); $id = $profile->insert();
if (!$id) { if (!$id) {
common_log_db_error($profile, 'INSERT', __FILE__); common_log_db_error($profile, 'INSERT', __FILE__);
return FALSE; return FALSE;
@ -116,29 +116,29 @@ class RegisterAction extends Action {
$user->password = common_munge_password($password, $id); $user->password = common_munge_password($password, $id);
$user->created = DB_DataObject_Cast::dateTime(); # current time $user->created = DB_DataObject_Cast::dateTime(); # current time
$user->uri = common_user_uri($user); $user->uri = common_user_uri($user);
$result = $user->insert(); $result = $user->insert();
if (!$result) { if (!$result) {
common_log_db_error($user, 'INSERT', __FILE__); common_log_db_error($user, 'INSERT', __FILE__);
return FALSE; return FALSE;
} }
if ($email) { if ($email) {
$confirm = new Confirm_address(); $confirm = new Confirm_address();
$confirm->code = common_confirmation_code(128); $confirm->code = common_confirmation_code(128);
$confirm->user_id = $user->id; $confirm->user_id = $user->id;
$confirm->address = $email; $confirm->address = $email;
$confirm->address_type = 'email'; $confirm->address_type = 'email';
$result = $confirm->insert(); $result = $confirm->insert();
if (!$result) { if (!$result) {
common_log_db_error($confirm, 'INSERT', __FILE__); common_log_db_error($confirm, 'INSERT', __FILE__);
return FALSE; return FALSE;
} }
} }
$profile->query('COMMIT'); $profile->query('COMMIT');
if ($email) { if ($email) {
@ -146,7 +146,7 @@ class RegisterAction extends Action {
$profile->nickname, $profile->nickname,
$email); $email);
} }
return $result; return $result;
} }
@ -154,11 +154,11 @@ class RegisterAction extends Action {
if ($error) { if ($error) {
common_element('p', 'error', $error); common_element('p', 'error', $error);
} else { } else {
common_element('p', 'instructions', common_element('p', 'instructions',
_t('You can create a new account to start posting notices.')); _t('You can create a new account to start posting notices.'));
} }
} }
function show_form($error=NULL) { function show_form($error=NULL) {
global $config; global $config;
@ -168,14 +168,14 @@ class RegisterAction extends Action {
'action' => common_local_url('register'))); 'action' => common_local_url('register')));
common_input('nickname', _t('Nickname'), NULL, common_input('nickname', _t('Nickname'), NULL,
_t('1-64 lowercase letters or numbers, no punctuation or spaces')); _t('1-64 lowercase letters or numbers, no punctuation or spaces'));
common_password('password', _t('Password'), common_password('password', _t('Password'),
_t('6 or more characters')); _t('6 or more characters'));
common_password('confirm', _t('Confirm'), common_password('confirm', _t('Confirm'),
_t('Same as password above')); _t('Same as password above'));
common_input('email', _t('Email'), NULL, common_input('email', _t('Email'), NULL,
_t('Used only for updates, announcements, and password recovery')); _t('Used only for updates, announcements, and password recovery'));
common_checkbox('rememberme', _t('Remember me'), common_checkbox('rememberme', _t('Remember me'), false,
_t('Automatically login in the future; ' . _t('Automatically login in the future; ' .
'not for shared computers!')); 'not for shared computers!'));
common_element_start('p'); common_element_start('p');
common_element('input', array('type' => 'checkbox', common_element('input', array('type' => 'checkbox',