Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3768100
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
9 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/app/Http/Controllers/Auth/AuthController.php b/app/Http/Controllers/Auth/AuthController.php
index 650b15d..9da8d9d 100644
--- a/app/Http/Controllers/Auth/AuthController.php
+++ b/app/Http/Controllers/Auth/AuthController.php
@@ -1,111 +1,110 @@
<?php
namespace AuthGrove\Http\Controllers\Auth;
use Illuminate\Contracts\Auth\Registrar as RegistrarContract;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
use Illuminate\Foundation\Auth\ThrottlesLogins;
use AuthGrove\Http\Controllers\Controller;
use AuthGrove\Services\Registrar;
-use AuthGrove\Models\User;
use Config;
use Route;
class AuthController extends Controller implements RegistrarContract {
/*
|--------------------------------------------------------------------------
| Registration & Login Controller
|--------------------------------------------------------------------------
|
| This controller handles the registration of new users, as well as the
| authentication of existing users. By default, this controller uses
| a simple trait to add these behaviors. Why don't you explore it?
|
*/
use AuthenticatesAndRegistersUsers, ThrottlesLogins, Registrar;
/**
* Where to redirect users after login / registration.
*
* @var string
*/
protected $redirectTo = '/';
/**
* The field to use as username
*
* @var string
*/
protected $username = 'username';
/**
* Create a new authentication controller instance.
*
* @return void
*/
public function __construct()
{
$this->middleware($this->guestMiddleware(), ['except' => 'logout']);
}
///
/// Routes
///
/**
* Gets the URL prefix for the authentication routes.
*
* @return string
*/
protected static function getRoutePrefix () {
return Config::get('auth.route');
}
/**
* Gets a specific authentication route.
*
* @param $action The authentication action (e.g. login)
* @return string The route URL (e.g. /auth/login)
*/
public static function getRoute ($action) {
$prefix = static::getRoutePrefix();
if ((string)$action === '') {
return $prefix;
}
return $prefix . '/' . $action;
}
/**
* Registers auth routes.
*/
public static function registerRoutes () {
$auth = static::getRoutePrefix();
// Login
Route::get($auth, ['as' => 'auth.login', 'uses' => 'Auth\AuthController@showLoginForm']);
Route::get($auth . '/login', ['as' => 'auth.login', 'uses' => 'Auth\AuthController@showLoginForm']);
Route::post($auth . '/login', ['as' => 'auth.login', 'uses' => 'Auth\AuthController@login']);
// Logout
Route::get($auth . '/logout', ['as' => 'auth.logout', 'uses' => 'Auth\AuthController@logout']);
// Registration
Route::get($auth . '/register', ['as' => 'auth.register', 'uses' => 'Auth\AuthController@showRegistrationForm']);
Route::post($auth . '/register', ['as' => 'auth.register', 'uses' => 'Auth\AuthController@register']);
// Recover account
Route::get($auth . '/recover', ['as' => 'auth.password.reset', 'uses' => 'Auth\PasswordController@getRecover']);
Route::post($auth . '/recover', ['as' => 'auth.password.reset', 'uses' => 'Auth\PasswordController@postRecover']);
// Reset password (with a token received by mail)
Route::get($auth . '/reset/{token?}', ['as' => 'auth.password.reset', 'uses' => 'Auth\PasswordController@getReset']);
Route::post($auth . '/reset', ['as' => 'auth.password.reset', 'uses' => 'Auth\PasswordController@reset']);
}
}
diff --git a/app/Http/Controllers/LoginDashboardController.php b/app/Http/Controllers/LoginDashboardController.php
index 3eea1da..a63ff17 100644
--- a/app/Http/Controllers/LoginDashboardController.php
+++ b/app/Http/Controllers/LoginDashboardController.php
@@ -1,45 +1,44 @@
<?php namespace AuthGrove\Http\Controllers;
use Illuminate\Http\Request;
class LoginDashboardController extends Controller {
/*
|--------------------------------------------------------------------------
| Login dashboard Controller
|--------------------------------------------------------------------------
|
| This controller renders a dashsboard for users that are authenticated. It
| allows them to know they're already authenticated and to get information
| about their authentication data, methods and connections.
*/
/**
* Create a new controller instance.
*
- * @return void
*/
public function __construct() {
$this->middleware('auth');
}
/**
* Show the application dashboard to the user.
*
* @param Request $request
* @return Response
*/
public function index(Request $request)
{
if (!$user = $request->user()) {
throw new \LogicException("The login dashboard controller is called when there isn't any instance of an authenticated user.");
}
return view(
'home',
[
'user' => $user->getInformation(),
]
);
}
}
diff --git a/app/Undo/UndoStore.php b/app/Undo/UndoStore.php
index b9bdf46..bd2f07d 100644
--- a/app/Undo/UndoStore.php
+++ b/app/Undo/UndoStore.php
@@ -1,169 +1,168 @@
<?php
namespace AuthGrove\Undo;
-use Hash;
use InvalidArgumentException;
use OutOfBoundsException;
class UndoStore {
///
/// Private members
///
/**
* The serialized instance of the object stored.
*
* @var string
*/
private $serializedInstance;
/**
* The operation control ID.
*
* @var string
*/
private $controlHash = '';
///
/// Public properties
///
/**
* The method to call to restore the state.
* This method must belongs to the stored object.
*
* @var string
*/
public $restoreMethod = 'save';
/**
* The parameters of the method to call to restore the state.
*
* @var array
*/
public $restoreMethodParameters = [];
/**
* Gets the stored instance.
*
* @return mixed
*/
public function getInstance() {
return unserialize($this->serializedInstance);
}
/**
* Sets a new instance of an object to store.
*
* @param mixed The instance to store
*/
public function setInstance ($instance) {
$this->serializedInstance = serialize($instance);
}
/**
* Gets the control ID of the instance. This allows to ensure its integrity.
*
* @return string An hash of the instance properties
*/
public function getControlHash () {
if ($this->controlHash === '') {
$this->computeControlHash();
}
return $this->controlHash;
}
///
/// Constructor
///
/**
* Initializes a new instance of the UndoStore object.
*
* @param mixed $instance The instance of the object to store
*/
public function __construct ($instance) {
$this->setInstance($instance);
}
///
/// Control ID
///
/**
* Determines if the operation control identifiant is the same than defined in the store.
*
* This allows for example to avoid to restore stale session data and ensure the user wants really to restore this instance.
*
* @param string $actualControlHash The operation control id to compare
* @return bool
*/
public function isSameControlHash ($actualControlHash) {
return $this->controlHash !== '' && $this->controlHash === $actualControlHash;
}
/**
* Determines the object integrity is intact, ie properties has not been modified since last control id computation
*/
public function checkIntegrity () {
$hash = $this->getControlHashForCurrentData();
return hash_equals($hash, $this->controlHash);
}
/**
* Computes a control id from the stored information
*/
public function computeControlHash () {
$this->controlHash = $this->getControlHashForCurrentData();
}
/**
* @return string The control hash
*/
protected function getControlHashForCurrentData () {
$data = $this->getDataForControlHash();
return hash("ripemd160", $data);
}
/**
* Gets a unique string representation of the current store.
*
* @return string
*/
protected function getDataForControlHash () {
return $this->serializedInstance
. $this->restoreMethod
. serialize($this->restoreMethodParameters);
}
///
/// Restore
///
/**
* Restores previous state of the stored instance.
*
* @param out mixed $return The restore method's return value
* @return mixed The restored instance
*/
public function restoreState (&$return = null) {
$instance = $this->getInstance();
if ($instance === null) {
throw new OutOfBoundsException;
}
if (!method_exists($instance, $this->restoreMethod)) {
throw new InvalidArgumentException;
}
$return = call_user_func_array(
[$instance, $this->restoreMethod],
$this->restoreMethodParameters
);
return $instance;
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Nov 25, 06:22 (1 d, 8 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2259607
Default Alt Text
(9 KB)
Attached To
Mode
rGROVE Auth Grove
Attached
Detach File
Event Timeline
Log In to Comment