Rename to RegisterController, make askEmail work
This commit is contained in:
parent
21e0bb18ba
commit
4fff21de2b
|
|
@ -14,7 +14,7 @@ namespace OCA\Registration\AppInfo;
|
||||||
|
|
||||||
use \OCP\AppFramework\App;
|
use \OCP\AppFramework\App;
|
||||||
|
|
||||||
use \OCA\Registration\Controller\RegistrationController;
|
use \OCA\Registration\Controller\RegisterController;
|
||||||
use \OCA\Registration\Wrapper;
|
use \OCA\Registration\Wrapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -28,8 +28,8 @@ class Application extends App {
|
||||||
/**
|
/**
|
||||||
* Controllers
|
* Controllers
|
||||||
*/
|
*/
|
||||||
$container->registerService('RegistrationController', function($c) {
|
$container->registerService('RegisterController', function($c) {
|
||||||
return new RegistrationController(
|
return new RegisterController(
|
||||||
$c->query('AppName'),
|
$c->query('AppName'),
|
||||||
$c->query('Request')
|
$c->query('Request')
|
||||||
);
|
);
|
||||||
|
|
@ -51,6 +51,10 @@ class Application extends App {
|
||||||
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
|
return $c->query('ServerContainer')->getL10N($c->query('AppName'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$container->registerService('URLGenerator', function($c) {
|
||||||
|
return $c->getServer()->getURLGenerator();
|
||||||
|
});
|
||||||
|
|
||||||
$container->registerService('PendingRegist', function($c) {
|
$container->registerService('PendingRegist', function($c) {
|
||||||
return new PendingRegist($c->query('ServerContainer')->getDb());
|
return new PendingRegist($c->query('ServerContainer')->getDb());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -17,16 +17,18 @@ use \OCP\AppFramework\Http\TemplateResponse;
|
||||||
use \OCP\AppFramework\Controller;
|
use \OCP\AppFramework\Controller;
|
||||||
use \OCA\Registration\Wrapper;
|
use \OCA\Registration\Wrapper;
|
||||||
|
|
||||||
class RegistrationController extends Controller {
|
class RegisterController extends Controller {
|
||||||
|
|
||||||
private $mail;
|
private $mail;
|
||||||
private $l10n;
|
private $l10n;
|
||||||
private $db;
|
private $db;
|
||||||
|
private $urlgenerator;
|
||||||
|
|
||||||
public function __construct($appName, IRequest $request, Mail $mail, $l10n, $db){
|
public function __construct($appName, IRequest $request, Mail $mail, $l10n, $db, $urlgenerator){
|
||||||
$this->mail = $mail;
|
$this->mail = $mail;
|
||||||
$this->l10n = $l10n;
|
$this->l10n = $l10n;
|
||||||
$this->db = $db;
|
$this->db = $db;
|
||||||
|
$this->urlgenerator = $urlgenerator;
|
||||||
parent::__construct($appName, $request);
|
parent::__construct($appName, $request);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -35,7 +37,7 @@ class RegistrationController extends Controller {
|
||||||
* @NoCSRFRequired
|
* @NoCSRFRequired
|
||||||
* @PublicPage
|
* @PublicPage
|
||||||
*/
|
*/
|
||||||
public function displayRegisterPage($errormsg, $entered) {
|
public function askEmail($errormsg, $entered) {
|
||||||
$params = array(
|
$params = array(
|
||||||
'errormsg' => $errormsg ? $errormsg : $this->request->getParam('errormsg'),
|
'errormsg' => $errormsg ? $errormsg : $this->request->getParam('errormsg'),
|
||||||
'entered' => $entered ? $entered : $this->request->getParam('entered')
|
'entered' => $entered ? $entered : $this->request->getParam('entered')
|
||||||
|
|
@ -63,8 +65,7 @@ class RegistrationController extends Controller {
|
||||||
// FEATURE: allow only from specific email domain
|
// FEATURE: allow only from specific email domain
|
||||||
|
|
||||||
$token = $this->db->savePendingRegistration($email);
|
$token = $this->db->savePendingRegistration($email);
|
||||||
$link = OC_Helper::linkToRoute('core_registration_register_form',
|
$link = $this->urlgenerator->linkToRoute('registration.verify.token', array('token' => $token));
|
||||||
array('token' => $token));
|
|
||||||
$link = OC_Helper::makeURLAbsolute($link);
|
$link = OC_Helper::makeURLAbsolute($link);
|
||||||
$from = OCP\Util::getDefaultEmailAddress('register');
|
$from = OCP\Util::getDefaultEmailAddress('register');
|
||||||
$tmpl = new OC_Template('core/registration', 'email');
|
$tmpl = new OC_Template('core/registration', 'email');
|
||||||
|
|
@ -78,3 +79,4 @@ class RegistrationController extends Controller {
|
||||||
}
|
}
|
||||||
$this->displayRegisterPage('', true);
|
$this->displayRegisterPage('', true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue