Address PR comments

This commit is contained in:
Romain Neutron
2013-05-03 16:52:07 +02:00
parent 70b4912427
commit 71d0d83cd8
8 changed files with 107 additions and 5 deletions

View File

@@ -574,11 +574,21 @@ class Application extends SilexApplication
return $this['session']->getFlashBag()->get($type, $default);
}
/**
* Adds a temporary unlock data for a account-locked user
*
* @param integer $usr_id
*/
public function addUnlockLink($usr_id)
{
$this['session']->set('unlock_user_id', $usr_id);
}
/**
* Returns the temporary unlock data
*
* @return null|integer
*/
public function getUnlockLink()
{
if ($this['session']->has('unlock_user_id')) {

View File

@@ -34,7 +34,9 @@ class Lightbox implements ControllerProviderInterface
}
if (false === $usr_id = $app['authentication.token-validator']->isValid($request->query->get('LOG'))) {
return $app->redirect("/login/?error=" . urlencode($e->getMessage()));
$app->addFlash('error', _('The URL you used is out of date, please login'));
return $app->redirect($app->path('homepage'));
}
$app['authentication']->openAccount(\User_Adapter::getInstance($usr_id, $app));

View File

@@ -46,7 +46,6 @@ interface ProviderInterface
*/
public function authenticate();
/**
* This method is called on provider callback, whenever the auth was
* successful or failure.

View File

@@ -22,6 +22,12 @@ class TokenValidator
$this->app = $app;
}
/**
* Returns true if the token is valid
*
* @param type $token
* @return boolean
*/
public function isValid($token)
{
try {

View File

@@ -27,7 +27,6 @@ class Root implements ControllerProviderInterface
->get('/language/{locale}/', $this->call('setLocale'))
->bind('set_locale');
$controllers
->get('/', $this->call('getRoot'))
->bind('root');

View File

@@ -41,7 +41,6 @@ class AuthenticationManagerServiceProvider implements ServiceProviderInterface
return new CookieManager($app['auth.password-encoder'], $app['EM'], $app['browser']);
});
$app['authentication.suggestion-finder'] = $app->share(function (Application $app) {
return new SuggestionFinder($app);
});