refactoring

This commit is contained in:
Milos Stojanovic
2019-06-14 13:34:21 +02:00
parent fa319eda36
commit b945526c85
8 changed files with 20 additions and 42 deletions

View File

@@ -67,10 +67,6 @@ class AuthController
return $response->json($errors->firstOfAll(), 422);
}
if ($auth->user() === null) {
return $response->json(['oldpassword' => 'Wrong password'], 422);
}
if (! $auth->authenticate($auth->user()->getUsername(), $request->input('oldpassword'))) {
return $response->json(['oldpassword' => 'Wrong password'], 422);
}

View File

@@ -40,25 +40,21 @@ class SessionStorage implements Service, SessionStorageInterface
public function save()
{
return $this->getSession() !== null ? $this->getSession()->save() : false;
$this->getSession()->save();
}
public function set(string $key, $data)
{
return $this->getSession() !== null ? $this->getSession()->set($key, $data) : false;
return $this->getSession()->set($key, $data);
}
public function get(string $key, $default = null)
{
return $this->getSession() !== null ? $this->getSession()->get($key, $default) : $default;
return $this->getSession() ? $this->getSession()->get($key, $default) : $default;
}
public function invalidate()
{
if ($this->getSession() === null) {
return;
}
if (! $this->getSession()->isStarted()) {
$this->getSession()->start();
}