Implemented controller verifyToken
This commit is contained in:
parent
d26481dbe8
commit
e16e5df481
|
|
@ -82,11 +82,30 @@ class RegisterController extends Controller {
|
||||||
$res = new TemplateResponse('registration', 'email', array('link' => $link));
|
$res = new TemplateResponse('registration', 'email', array('link' => $link));
|
||||||
$msg = $res->render();
|
$msg = $res->render();
|
||||||
try {
|
try {
|
||||||
$this->mail->send($email, 'ownCloud User', $l->t('Verify your ownCloud registration request'), $msg, $from, 'ownCloud');
|
$this->mail->send($email, 'ownCloud User', $this->l10n->t('Verify your ownCloud registration request'), $msg, $from, 'ownCloud');
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
\OC_Template::printErrorPage( 'A problem occurs during sending the e-mail please contact your administrator.');
|
\OC_Template::printErrorPage( 'A problem occurs during sending the e-mail please contact your administrator.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
$this->askEmail('', true);
|
$this->askEmail('', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @NoAdminRequired
|
||||||
|
* @NoCSRFRequired
|
||||||
|
* @PublicPage
|
||||||
|
*/
|
||||||
|
public function verifyToken($token) {
|
||||||
|
$email = $this->pendingreg->findByToken($token);
|
||||||
|
if ( \OCP\DB::isError($email) ) {
|
||||||
|
return new TemplateResponse('', 'error', array(
|
||||||
|
'errors' => array(array(
|
||||||
|
'error' => $this->l10n->t('Invalid verification URL. No registration request with this verification URL is found.'),
|
||||||
|
'hint' => ''
|
||||||
|
))
|
||||||
|
), 'error');
|
||||||
|
} elseif ( $email ) {
|
||||||
|
return new TemplateResponse('registration', 'form', array(), 'guest');
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,4 +25,9 @@ class PendingRegist {
|
||||||
return $query->execute(array($email))->fetchAll();
|
return $query->execute(array($email))->fetchAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function findByToken($token) {
|
||||||
|
$query = $this->db->prepareQuery('SELECT `email` FROM `*PREFIX*registration` WHERE `token` = ? ');
|
||||||
|
return $query->execute(array($token))->fetchOne();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue