Advertisement
Guest User

Untitled

a guest
May 5th, 2014
183
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.77 KB | None | 0 0
  1. <?php
  2.  
  3. class LoginExtension extends MemberLoginForm {
  4.  
  5.     public function dologin($data) {
  6.  
  7.         $adminGroup = Group::get()->Filter(array(
  8.             'Code' => 'administrators'
  9.         ))->First();
  10.  
  11.         if($this->performLogin($data)) {
  12.             if(Member::currentUser()->inGroup($adminGroup->ID)){
  13.                 return Controller::curr()->redirect(Director::baseURL() . 'admin' );
  14.             }else{
  15.                 Controller::curr()->redirect(DataObject::get_one('EditProfilePage')->Link());
  16.             }
  17.         } else {
  18.             if($badLoginURL = Session::get("BadLoginURL")) {
  19.                 Controller::curr()->redirect($badLoginURL);
  20.             } else {
  21.                 Controller::curr()->redirectBack();
  22.             }
  23.         }
  24.     }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement