示例#1
0
 public function postToLogin($r)
 {
     //this is the default, uber-simple login
     //which should be overidden by a module
     //all valid users need to be superusers
     $username = strtolower($r->get('username'));
     $pass = $r->get('password');
     $superusers = $r->getSuperusers();
     //todo: this is why params are not saved -- super ONLY
     if (isset($superusers[$username]) && $superusers[$username] == $pass) {
         $user = new Dase_DBO_DaseUser($this->db);
         $user->retrieveByEid($username);
         $user->initCart();
         $r->setCookie('collections', Dase_Json::get(Dase_DBO_Collection::getLookupArray($this->db)));
         $r->setCookie('eid', $username);
         $r->setCookie('max', $user->max_items);
         $r->setCookie('display', $user->display);
         $r->renderRedirect(urldecode($r->get('target')));
     } else {
         //I could probably just display here instead of redirect
         $params['msg'] = 'incorrect username/password';
         $r->renderRedirect("login/form", $params);
     }
 }