Infra 2250 - Make FormToken class available in the contructor
Change-Id: I33e177a16c7aa670f4b119829b9c3b63e6a49b96
Signed-off-by: Eric Poirier <eric@eclipse.org>
diff --git a/eclipse.org-common/classes/users/siteLogin.class.php b/eclipse.org-common/classes/users/siteLogin.class.php
index 9533891..87a05ee 100644
--- a/eclipse.org-common/classes/users/siteLogin.class.php
+++ b/eclipse.org-common/classes/users/siteLogin.class.php
@@ -39,6 +39,8 @@
private $githubid = "";
+ private $formToken = NULL;
+
private $Friend = NULL;
private $fname = "";
@@ -125,6 +127,7 @@
$this->Session = $this->App->useSession();
$this->Friend = $this->Session->getFriend();
$this->Ldapconn = new LDAPConnection();
+ $this->FormToken = new FormToken();
$this->_sanitizeVariables();
$this->user_uid = $this->Ldapconn->getUIDFromMail($this->Friend->getEmail());
@@ -505,8 +508,7 @@
private function _createAccount() {
if ($this->username != "" && $this->fname != "" && $this->lname != "" && $this->password1 != "") {
- $FormToken = new FormToken();
- if (!$FormToken->verifyToken($_POST['token-create-account']) || !empty($_POST['create-account-email-req'])) {
+ if (!$this->FormToken->verifyToken($_POST['token-create-account']) || !empty($_POST['create-account-email-req'])) {
# Send mail to webmaster
$mail = "Dear webmaster,\n\n";
$mail .= "A new eclipse.org account was denied:\n\n";
@@ -1416,8 +1418,7 @@
private function _userAuthentification() {
$process = FALSE;
- $FormToken = new FormToken();
- if ($FormToken->verifyToken($_POST['token-login']) && empty($_POST['login-username'])) {
+ if ($this->FormToken->verifyToken($_POST['token-login']) && empty($_POST['login-username'])) {
$process = TRUE;
}
diff --git a/site_login/content/en_index.php b/site_login/content/en_index.php
index b95380a..7572e53 100755
--- a/site_login/content/en_index.php
+++ b/site_login/content/en_index.php
@@ -50,7 +50,7 @@
<button type="submit" name="btn-submit" tabindex="4" class="btn btn-primary">Login</button>
<input type="hidden" name="stage" value="login" />
<input type="hidden" name="takemeback" value="<?php print $var_login['takemeback']; ?>" />
- <input type="hidden" name="token-login" value="<?php print $FormToken->getToken();?>" />
+ <input type="hidden" name="token-login" value="<?php print $Sitelogin->FormToken->getToken();?>" />
<input type="hidden" name="login-username" value="" />
</div>
</form>
@@ -156,7 +156,7 @@
<div class="col-sm-24">
<button type="submit" name="btn-submit" tabindex="4" class="btn btn-primary">Create account!</button>
<input type="hidden" name="stage" value="create" />
- <input type="hidden" name="token-create-account" value="<?php print $FormToken->getToken();?>" />
+ <input type="hidden" name="token-create-account" value="<?php print $Sitelogin->FormToken->getToken();?>" />
<input type="hidden" name="create-account-email-req" value="" />
</div>
</div>
diff --git a/site_login/index.php b/site_login/index.php
index 49a0b28..ea27064 100755
--- a/site_login/index.php
+++ b/site_login/index.php
@@ -16,14 +16,12 @@
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/captcha/captcha.class.php");
require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/users/siteLogin.class.php");
- require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/forms/formToken.class.php");
$App = new App();
$Nav = new Nav();
$Menu = new Menu();
$Sitelogin = new Sitelogin();
$Captcha = new Captcha;
- $FormToken = new FormToken();
$App->preventCaching();