Changeset 1168
- Timestamp:
- 11/18/08 23:20:20 (2 months ago)
- Files:
-
- trunk/lib/jelix-modules/jauth/controllers/login.classic.php (modified) (7 diffs)
- trunk/lib/jelix-modules/jauth/templates/login.form.tpl (modified) (2 diffs)
- trunk/lib/jelix-modules/jauth/zones/loginform.zone.php (modified) (1 diff)
- trunk/lib/jelix/plugins/coord/auth/auth.coord.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/lib/jelix-modules/jauth/controllers/login.classic.php
r1024 r1168 25 25 $url_return = '/'; 26 26 27 // both after_login and after_logout config fields are required 27 28 if ($conf['after_login'] == '') 28 29 throw new jException ('jauth~autherror.no.auth_login'); … … 31 32 throw new jException ('jauth~autherror.no.auth_logout'); 32 33 34 // if after_login_override = off or url_return doesnt exists, set url_return to after_login 35 // if auth_url_return exists, redirect to it 33 36 if (!($conf['enable_after_login_override'] && $url_return= $this->param('auth_url_return'))){ 34 37 $url_return = jUrl::get($conf['after_login']); … … 36 39 37 40 if (!jAuth::login($this->param('login'), $this->param('password'), $this->param('rememberMe'))){ 41 // auth fails 38 42 sleep (intval($conf['on_error_sleep'])); 39 $url_return = jUrl::get($conf['after_logout'],array ('login'=>$this->param('login'), 'failed'=>1)); 43 $params = array ('login'=>$this->param('login'), 'failed'=>1); 44 if($conf['enable_after_login_override']) 45 $params['auth_url_return'] = $this->param('auth_url_return'); 46 $url_return = jUrl::get($conf['after_logout'],$params); 40 47 } 41 48 … … 48 55 * 49 56 */ 50 function out (){57 function out(){ 51 58 jAuth::logout(); 52 59 $conf = $GLOBALS['gJCoord']->getPlugin ('auth')->config; … … 55 62 throw new jException ('jauth~autherror.no.auth_logout'); 56 63 57 if (!($conf['enable_after_logout_override'] && $url_return= $this->param('auth_url_return'))){ 64 if (!($conf['enable_after_logout_override'] && 65 $url_return = $this->param('auth_url_return'))) { 58 66 $url_return = jUrl::get($conf['after_logout']); 59 67 } 68 60 69 $rep = $this->getResponse('redirectUrl'); 61 70 $rep->url = $url_return; … … 67 76 */ 68 77 function form() { 78 $conf = $GLOBALS['gJCoord']->getPlugin('auth')->config; 69 79 if (jAuth::isConnected()) { 70 $conf = $GLOBALS['gJCoord']->getPlugin('auth')->config;71 72 80 if ($conf['after_login'] != '') { 73 if (!($conf['enable_after_login_override'] && $url_return= $this->param('auth_url_return'))){ 81 if (!($conf['enable_after_login_override'] && 82 $url_return= $this->param('auth_url_return'))){ 74 83 $url_return = jUrl::get($conf['after_login']); 75 84 } … … 81 90 82 91 $rep = $this->getResponse('html'); 92 $rep->title = jLocale::get ('auth.titlePage.login'); 93 //$rep->bodyTpl = 'jauth~index'; 83 94 84 $rep->title = jLocale::get ('auth.titlePage.login'); 85 $rep->bodyTpl = 'jauth~index'; 86 $rep->body->assignZone ('MAIN', 'jauth~loginform', array ('login'=>$this->param('login'), 'failed'=>$this->param('failed'), 'showRememberMe'=>jAuth::isPersistant())); 95 $zp = array ('login'=>$this->param('login'), 96 'failed'=>$this->param('failed'), 97 'showRememberMe'=>jAuth::isPersistant()); 98 99 if ($conf['enable_after_login_override']) { 100 $zp['auth_url_return'] = $this->param('auth_url_return'); 101 } 102 103 $rep->body->assignZone ('MAIN', 'jauth~loginform', $zp); 87 104 return $rep; 88 105 } trunk/lib/jelix-modules/jauth/templates/login.form.tpl
r1024 r1168 6 6 {if ! $isLogged} 7 7 8 <form action="{ jurl 'jauth~login:in'}" method="post" id="loginForm">8 <form action="{formurl 'jauth~login:in'}" method="post" id="loginForm"> 9 9 <fieldset> 10 10 <table> … … 24 24 {/if} 25 25 </table> 26 {formurlparam 'jauth~login:in'} 27 {if !empty($auth_url_return)} 28 <input type="hidden" name="auth_url_return" value="{$auth_url_return|eschtml}" /> 29 {/if} 26 30 <input type="submit" value="{@jauth~auth.buttons.login@}"/> 27 31 </fieldset> trunk/lib/jelix-modules/jauth/zones/loginform.zone.php
r534 r1168 16 16 protected function _prepareTpl(){ 17 17 18 $this->_tpl->assign ('login', $this->getParam('login')); 19 $this->_tpl->assign ('failed', $this->getParam('failed')); 20 18 $this->_tpl->assign ('login', $this->param('login')); 19 $this->_tpl->assign ('failed', $this->param('failed')); 20 $this->_tpl->assign ('auth_url_return', $this->param('auth_url_return', '')); 21 21 22 $this->_tpl->assign ('user', jAuth::getUserSession()); 22 23 $this->_tpl->assign ('isLogged', jAuth::isConnected()); trunk/lib/jelix/plugins/coord/auth/auth.coord.php
r1026 r1168 119 119 }else{ 120 120 if(!$badip){ 121 $auth_url_return = $GLOBALS['gJCoord']->request->getParam('auth_url_return'); 122 if($auth_url_return === null) 123 $GLOBALS['gJCoord']->request->params['auth_url_return'] = jUrl::getCurrentUrl(); 121 124 $selector= new jSelectorAct($this->config['on_error_action']); 122 125 }
