diff options
author | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2014-05-28 00:09:08 +0300 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2014-06-13 15:34:52 +0200 |
commit | a7fbd91e53be5f4fd68f035c999eaa3f187b9d3d (patch) | |
tree | 772844629bbb69dd74549b184828bc9a6c75139e /core/routes.php | |
parent | 23ed038a27901b947b75413b966d4beab21cd2bc (diff) | |
download | nextcloud-server-a7fbd91e53be5f4fd68f035c999eaa3f187b9d3d.tar.gz nextcloud-server-a7fbd91e53be5f4fd68f035c999eaa3f187b9d3d.zip |
Use appframework
Diffstat (limited to 'core/routes.php')
-rw-r--r-- | core/routes.php | 48 |
1 files changed, 39 insertions, 9 deletions
diff --git a/core/routes.php b/core/routes.php index fbbbdee81f0..3ee5fcaa622 100644 --- a/core/routes.php +++ b/core/routes.php @@ -6,6 +6,45 @@ * See the COPYING-README file. */ +use \OCP\AppFramework\App; +use OC\Core\LostPassword\Controller\LostController; +use OC\Core\LostPassword\Controller\AjaxController; + +class Application extends App { + public function __construct(array $urlParams=array()){ + parent::__construct('core', $urlParams); + + $container = $this->getContainer(); + + /** + * Controllers + */ + $container->registerService('LostController', function($c) { + return new LostController( + $c->query('AppName'), + $c->query('ServerContainer')->getRequest(), + $c->query('ServerContainer')->getURLGenerator() + ); + }); + $container->registerService('AjaxController', function($c) { + return new AjaxController( + $c->query('AppName'), + $c->query('ServerContainer')->getRequest(), + $c->query('ServerContainer')->getURLGenerator() + ); + }); + } +} + +$application = new Application(); +$application->registerRoutes($this, array('routes' => array( + array('name' => 'ajax#lost', 'url' => '/core/ajax/password/lost', 'verb' => 'POST'), + array('name' => 'ajax#reset', 'url' => '/core/ajax/password/reset/{token}/{user}', 'verb' => 'POST'), + array('name' => 'lost#reset', 'url' => '/lostpassword/reset/{token}/{user}', 'verb' => 'GET'), + ) +)); + + // Post installation check /** @var $this OCP\Route\IRouter */ @@ -70,15 +109,6 @@ $this->create('core_ajax_preview', '/core/preview') ->actionInclude('core/ajax/preview.php'); $this->create('core_ajax_preview', '/core/preview.png') ->actionInclude('core/ajax/preview.php'); -$this->create('core_ajax_password_lost', '/core/ajax/password/lost') - ->post() - ->action('OC\Core\Lostpassword\AjaxController', 'lost'); -$this->create('core_ajax_password_reset', '/core/ajax/password/reset/{token}/{user}') - ->post() - ->action('OC\Core\LostPassword\AjaxController', 'resetPassword'); -$this->create('core_lostpassword_reset', '/lostpassword/reset/{token}/{user}') - ->get() - ->action('OC\Core\LostPassword\Controller', 'reset'); // Avatar routes $this->create('core_avatar_get_tmp', '/avatar/tmp') |