Changeset 283
- Timestamp:
- 06/03/07 03:41:08
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
FreakAuth/trunk/www/system/application/libraries/FAL_front.php
r276 r283 158 158 function login() 159 159 { 160 //if a n user, admin or superadminis already logged in160 //if a valid user is already logged in 161 161 if($this->CI->freakauth_light->belongsToGroup('user')) 162 162 { 163 // Display user name and an 'already logged in' flash message... 164 $msg = $this->CI->freakauth_light->getUserName().', '.$this->CI->lang->line('FAL_already_logged_in_msg'); 163 // we can arrive here after two different things 164 $requested_page = $this->CI->db_session->flashdata('requested_page'); 165 if ( $requested_page == '') 166 { 167 // a simple click on the login link 168 // Display user name and an 'already logged in' flash message... 169 $msg = $this->CI->freakauth_light->getUserName().', '.$this->CI->lang->line('FAL_already_logged_in_msg'); 170 } 171 else 172 { 173 // a lack of credentials after being redirected by the 174 // 'redirect to requested page' process 175 // (after a successful login that followed a denied access) 176 $msg = $this->CI->lang->line('FAL_no_credentials_user'); 177 } 165 178 flashMsg($msg); 166 179 167 // redirects to homepage180 // redirects to homepage 168 181 redirect('', 'location'); 169 182 } … … 209 222 { 210 223 $role= $this->CI->db_session->userdata('role'); 211 224 225 // Here is the 'redirect to requested page after login' thing. 226 // We test if the visitor was denied and sent to the login form. 227 $requested_page = $this->CI->db_session->flashdata('requested_page'); 228 if ( $requested_page != '' ) 229 { 230 // We have to keep the page info once again in case of 231 // the user is still denied on the requested page. 232 // (otherwise the 'already logged in' message is displayed) 233 $this->CI->db_session->set_flashdata('requested_page', $requested_page); 234 redirect( $requested_page, 'location'); 235 } 236 237 // if no page was requested before, let's redirect the user 238 // according to his role 212 239 switch ($role) 213 240 { … … 225 252 } 226 253 227 // else display the login form (for the first time or once again)254 // else display the login form (for the first time or once again) 228 255 else 229 { 230 256 { 257 // keep the page that was requested for the next login attempt 258 $this->CI->db_session->keep_flashdata('requested_page'); 259 231 260 if ($this->CI->config->item('FAL_use_captcha_login')) 232 261 { FreakAuth/trunk/www/system/application/libraries/Freakauth_light.php
r282 r283 218 218 if ($role == '') 219 219 { 220 // First, we have to store the requested page in order 221 // to serve it back to the visitor after a successful login. 222 $this->CI->db_session->set_flashdata('requested_page', 223 $this->CI->uri->uri_string()); 224 225 // Then we redirect to the login form with a 'access denied' 226 // message. Maybe if the visitor can log in, 227 // he'll get some more permissions... 220 228 $msg = $this->CI->lang->line('FAL_no_credentials_guest'); 221 229 flashMsg($msg); 222 // redirects to login form223 // maybe if we can log in, we'll have some more permissions224 230 redirect($this->CI->config->item('FAL_login_uri'), 'location'); 225 231 } … … 242 248 else 243 249 { 244 // if we come from this website, just go to this page back 250 // if we came from our website, just go to this page back 251 // but maybe we arrived here because of the 252 // 'redirect to requested page', so in order not to 253 $this->CI->db_session->keep_flashdata('requested_page'); 245 254 header("location:".$_SERVER['HTTP_REFERER']); 246 255 exit();
