예제 #1
0
 public function testAuthFacade()
 {
     $provider = new TestAuthProvider();
     $authy = new AuthedUser('brooke', 1);
     $provider->setRetrieve($authy);
     $cubex = new Cubex();
     $cubex->configure(new TestConfigProvider());
     $cubex->processConfiguration($cubex->getConfiguration());
     $cubex->instance('request', Request::createFromGlobals());
     $cubex->instance('\\Cubex\\Auth\\IAuthProvider', $provider);
     $sm = new ServiceManager();
     $sm->setCubex($cubex);
     $sm->boot();
     Auth::setFacadeApplication($cubex);
     $username = '******';
     $this->assertTrue(Auth::forgottenPassword($username));
     $authUser = Auth::login($username, 'password');
     $this->assertEquals("brooke", $authUser->getUsername());
     $autho = Auth::getAuthedUser();
     $this->assertEquals("brooke", $autho->getUsername());
     Auth::updateAuthedUser($autho);
     $this->assertTrue(Auth::isLoggedIn());
     $this->assertTrue(Auth::logout());
     $this->assertFalse(Auth::isLoggedIn());
 }
예제 #2
0
 public function postIndex()
 {
     $postData = $this->request()->postVariables();
     $user = Auth::authByCredentials(StdLoginCredentials::make($postData['username'], $postData['password']));
     if ($user && Auth::loggedIn()) {
         Redirect::to('/admin')->now();
     } else {
         Redirect::to('/admin')->with('msg', 'Login Failed, please check username and password is correct')->now();
     }
 }
예제 #3
0
파일: Header.php 프로젝트: qubes/support
 public function render()
 {
     $menus = ['Categories' => 'admin/category', 'Articles' => 'admin/article', 'Videos' => 'admin/video', 'Platforms' => 'admin/platform', 'Users' => 'admin/user'];
     $navItems = new Partial('<li class="%s"><a href="%s" title="%s">%s</a></li>', null, false);
     $currPath = $this->request()->path();
     foreach ($menus as $item => $path) {
         $state = starts_with($currPath, "/{$path}", false) ? 'active' : '';
         $navItems->addElement($state, '/' . $path, $item, $item);
     }
     return new RenderGroup('<a id="support-logo" class="brand" href="/admin">', 'Support Center</a>', '<ul class="nav">', $navItems, '</ul>', '<div class="nav-collapse collapse">' . '<ul class="nav pull-right">' . '<li><a href="/admin/profile">' . Auth::getRawUsername() . '</a></li>' . '<li><a href="/admin/access/logout">Logout</a></li>' . '</ul>' . '</div>');
 }