Skip to content

Commit

Permalink
do not init View twice (it is already set up in BaseController)
Browse files Browse the repository at this point in the history
  • Loading branch information
niol authored and jtojnar committed Jun 15, 2017
1 parent 3b71b79 commit 3a1c79e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
12 changes: 4 additions & 8 deletions controllers/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@ public function home() {
* @return void
*/
public function password() {
$this->view = new \helpers\View();
$this->view->password = true;
if (isset($_POST['password'])) {
$this->view->hash = hash('sha512', \F3::get('salt') . $_POST['password']);
Expand All @@ -117,8 +116,6 @@ public function password() {
* @return void
*/
public function login() {
$view = new \helpers\View();

$error = null;

if (isset($_REQUEST['username'])) {
Expand All @@ -136,19 +133,19 @@ public function login() {
}

if ($error !== null) {
$view->jsonError([
$this->view->jsonError([
'success' => false,
'error' => $error
]);
}

if (\F3::get('auth')->login($username, $password)) {
$view->jsonSuccess([
$this->view->jsonSuccess([
'success' => true
]);
}

$view->jsonSuccess([
$this->view->jsonSuccess([
'success' => false,
'error' => 'invalid username/password'
]);
Expand All @@ -161,9 +158,8 @@ public function login() {
* @return void
*/
public function logout() {
$view = new \helpers\View();
\F3::get('auth')->logout();
$view->jsonSuccess([
$this->view->jsonSuccess([
'success' => true
]);
}
Expand Down
1 change: 0 additions & 1 deletion controllers/Opml.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ public function __construct() {
public function show() {
$this->needsLoggedIn();

$this->view = new \helpers\View();
$this->view->msg = $this->msg;
$this->view->msgclass = $this->msgclass;
echo $this->view->render('templates/opml.phtml');
Expand Down

0 comments on commit 3a1c79e

Please sign in to comment.