X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Flogin.php;h=3a93c466facd4ffe6b5707d01033cd4c81f2b6fc;hb=1ef5cf964ef65b248dc150660124e95dcd933106;hp=89d06ee4d9a30c551bc11384c79b6061f48073e0;hpb=6f6aed821387075de8c22da55c5620c04cda0dc1;p=quix0rs-gnu-social.git diff --git a/actions/login.php b/actions/login.php index 89d06ee4d9..3a93c466fa 100644 --- a/actions/login.php +++ b/actions/login.php @@ -1,18 +1,18 @@ . */ @@ -20,7 +20,7 @@ if (!defined('LACONICA')) { exit(1); } class LoginAction extends Action { - + function handle($args) { parent::handle($args); if (common_logged_in()) { @@ -43,30 +43,33 @@ class LoginAction extends Action { common_server_error(_t('Error setting user.')); return; } - # success! - common_redirect(common_local_url('all', - array('nickname' => - $nickname))); + # success! + $url = common_get_returnto(); + if ($url) { + # We don't have to return to it again + common_set_returnto(NULL); + } else { + $url = common_local_url('all', + array('nickname' => + $nickname)); + } + common_redirect($url); } else { $this->show_form(_t('Incorrect username or password.')); } } - + function show_form($error=NULL) { - common_show_header(_t('Login')); - if (!is_null($error)) { - common_element('div', array('class' => 'error'), $msg); + if ($error) { + common_element('div', array('class' => 'error'), $error); } common_element_start('form', array('method' => 'POST', 'id' => 'login', 'action' => common_local_url('login'))); common_input('nickname', _t('Nickname')); common_password('password', _t('Password')); - common_element('input', array('name' => 'submit', - 'type' => 'submit', - 'id' => 'submit', - 'value' => _t('Login'))); + common_submit('submit', _t('Login')); common_element_end('form'); common_show_footer(); }