diff options
| author | Christopher Guindon | 2017-02-27 15:17:52 +0000 |
|---|---|---|
| committer | Christopher Guindon | 2017-03-10 17:33:32 +0000 |
| commit | 57584dab0ab3be09747d2401567f0546c2a97960 (patch) | |
| tree | 0ca956d59599fa24f25661cbf036b966d7817db5 | |
| parent | 4e9562792c90f21dbef404345aa540c29004048c (diff) | |
| download | dev.eclipse.org-57584dab0ab3be09747d2401567f0546c2a97960.tar.gz dev.eclipse.org-57584dab0ab3be09747d2401567f0546c2a97960.tar.xz dev.eclipse.org-57584dab0ab3be09747d2401567f0546c2a97960.zip | |
Bug 512765 - Deprecate dev.eclipse.org/site_login
Change-Id: I30d3d7c4777d4216542774ace7ae61304a17c1a4
Signed-off-by: Christopher Guindon <chris.guindon@eclipse.org>I
39 files changed, 28 insertions, 5163 deletions
diff --git a/eclipse.org-common/classes/subscriptions/mailchimp.class.php b/eclipse.org-common/classes/subscriptions/mailchimp.class.php deleted file mode 100644 index eaa0f1a..0000000 --- a/eclipse.org-common/classes/subscriptions/mailchimp.class.php +++ /dev/null @@ -1,373 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2015, 2016 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eric Poirier (Eclipse Foundation) - initial API and implementation - * Christopher Guindon (Eclipse Foundation) - *******************************************************************************/ -require_once(realpath(dirname(__FILE__) . "/../../system/app.class.php")); -require_once("subscriptions_base.class.php"); - -define('MAILCHIMP_SUBSCRIBE','subscribe'); -define('MAILCHIMP_UNSUBSCRIBE','unsubscribe'); - -class Mailchimp extends Subscriptions_base { - - private $api_key = FALSE; - - private $subscribe_list = array(); - - private $list_id = FALSE; - - public function __construct(App $App) { - parent::__construct($App); - - // Checking if the user is changing Subscription status - $stage = filter_var($this->App->getHTTPParameter('stage', 'POST'), FILTER_SANITIZE_STRING); - $form = filter_var($this->App->getHTTPParameter('form_name', 'POST'), FILTER_SANITIZE_STRING); - - if ($form === 'mailchimp_form') { - if ($stage === 'mailchimp_subscribe') { - if (!$this->addUserToList()) { - die('The subscription service is unavailable at the moment.'); - } - } - - if ($stage === 'mailchimp_unsubscribe') { - if (!$this->_removeUserFromList()) { - die('The subscription service is unavailable at the moment.'); - } - } - } - } - - - /** - * Add user to mailing list - * - * @return bool - */ - public function addUserToList() { - if (!$this->getIsSubscribed()) { - $email_md5 = $this->_getEmailMd5(); - $list_id = $this->_getListId(); - if ($email_md5 && $list_id) { - $request = array( - 'action' => 'PUT', - 'endpoint' => "/lists/" . $list_id . "/members/" . $email_md5, - 'data' => array( - "email_address" => $this->getEmail(), - "status_if_new" => "subscribed", - "merge_fields" => array( - "FNAME" => $this->getFirstName(), - "LNAME" => $this->getLastName(), - ), - ), - ); - - $data = $this->_curlRequest($request); - if ($data === TRUE) { - // Add to list if there's no error - $this->_addUserToSubscribeList(); - $this->App->setSystemMessage('mailchimp_unsubscribe', 'You have successfully subscribed to Eclipse Newsletter.', 'success'); - return TRUE; - } - } - } - $this->App->setSystemMessage('mailchimp_unsubscribe', 'There was a problem subscribing you to Eclipse Newsletter. (#subscriptions-001)', 'danger'); - return FALSE; - } - - /** - * This function returns the user's subscription status - * - * @return bool - */ - public function getIsSubscribed() { - if (!isset($this->subscribe_list[$this->getEmail()])) { - $this->_verifyUserSubscription(); - } - return $this->subscribe_list[$this->getEmail()]; - } - - /** - * Get HTML form - * - * @return string - */ - public function output(){ - $uid = $this->Friend->getUID(); - $html = ""; - if (!empty($uid)) { - ob_start(); - include 'tpl/subscriptions.tpl.php'; - $html = ob_get_clean(); - } - - return $html; - } - - /** - * Add user to subscribe list - */ - private function _addUserToSubscribeList() { - $this->subscribe_list[$this->getEmail()] = TRUE; - } - - - /** - * This function sends an API request to Mailchimp - * - * @param $action - string containing the words GET, PUT or DELETE - * - * @return array - */ - private function _curlRequest($request) { - - $accepted_actions = array( - 'GET', - 'DELETE', - 'PUT' - ); - - $return = array(); - if (!empty($request['action']) && in_array($request['action'], $accepted_actions) && !empty($request['endpoint'])) { - $url = $this->_mailchimpUrl() . $request['endpoint']; - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $url); - curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json','Authorization: apikey ' . $this->_getApiKey())); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); - curl_setopt($ch, CURLOPT_TIMEOUT, 30); - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, TRUE); - curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0); - curl_setopt($ch, CURLOPT_ENCODING, ''); - - curl_setopt($ch, CURLOPT_FORBID_REUSE, TRUE); - curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2); - - // CONFIG: Optional proxy configuration - curl_setopt($ch, CURLOPT_PROXY, 'proxy.eclipse.org:9899'); - curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1); - - // If we're on staging - if ($this->getDebugMode()) { - curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); - curl_setopt($ch, CURLOPT_PROXY, ''); - } - - switch ($request['action']) { - case "DELETE": - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'DELETE'); - $ret = curl_setopt($ch, CURLOPT_HEADER, TRUE); - $result = curl_exec($ch); - $result = curl_getinfo($ch); - break; - case "PUT": - if (!empty($request['data'])) { - curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT'); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($request['data'])); - $result = curl_exec($ch); - } - break; - case "GET": - curl_setopt($ch, CURLOPT_URL, $url . '?' . http_build_query(array())); - $result = curl_exec($ch); - break; - - } - - curl_close($ch); - if (isset($result)) { - if ($request['action'] !== 'DELETE') { - $result = json_decode($result, TRUE); - } - $result = $this->_validate_results($result, $request); - if (is_bool($result)) { - return $result; - } - } - } - return 'ERROR'; - } - - /** - * Get Api key - * - * @return string - */ - private function _getApiKey(){ - if (empty($this->api_key)) { - $this->_setApiKeyAndListId(); - } - - return $this->api_key; - } - - /** - * Get MD5 hash of the user's e-mail - * - * @return string|bool - */ - private function _getEmailMd5(){ - $email = $this->getEmail(); - if (!empty($email)) { - return md5($email); - } - return FALSE; - } - - /** - * Get List id - * @return string|unknown|boolean - */ - private function _getListId() { - if (empty($this->list_id)) { - $this->_setApiKeyAndListId(); - } - - return $this->list_id; - } - - - /** - * This function assemble the correct API url to send requests to - * - * @return string - * */ - private function _mailchimpUrl() { - if ($key = $this->_getApiKey()) { - $datacentre = explode('-', $key); - return 'https://' . $datacentre[1] . '.api.mailchimp.com/3.0/'; - } - } - - - /** - * Remove user from mailing list. - */ - private function _removeUserFromList() { - - if ($this->getIsSubscribed()) { - $email_md5 = $this->_getEmailMd5(); - $list_id = $this->_getListId(); - if ($email_md5 && $list_id) { - $request = array( - 'action' => 'DELETE', - 'endpoint' => "/lists/". $list_id ."/members/" . $email_md5, - ); - - $data = $this->_curlRequest($request); - - if ($data === TRUE) { - // Remove from list if there's no error - $this->_removeUserFromSubscribeList(); - $this->App->setSystemMessage('mailchimp_unsubscribe', 'You have successfully unsubscribed to Eclipse Newsletter.', 'success'); - return TRUE; - } - } - } - $this->App->setSystemMessage('mailchimp_unsubscribe', 'There was a problem unsubscribing you to Eclipse Newsletter. (#subscriptions-001)', 'danger'); - return FALSE; - } - - /** - * Remove user from subscribe list - */ - private function _removeUserFromSubscribeList() { - $this->subscribe_list[$this->getEmail()] = FALSE; - } - - /** - * This function sets the Mailchimp API Key and List ID - * - * The default API key and List ID are fetched from eclipse-php-classes - */ - private function _setApiKeyAndListId() { - require_once("/home/data/httpd/eclipse-php-classes/system/authcode.php"); - - $mode = "production"; - if ($this->getDebugMode() === TRUE) { - $mode = "staging"; - } - - if (empty($mailchimp_keys[$mode]['api_key']) || empty($mailchimp_keys[$mode]['list_id'])) { - $this->App->setSystemMessage('mailchimp_api_key', 'The Mailchimp API key or List Id is not valid', 'danger'); - return FALSE; - } - - $this->api_key = $mailchimp_keys[$mode]['api_key']; - $this->list_id = $mailchimp_keys[$mode]['list_id']; - - } - - - /** - * Validate curl request results - * - * @param array $return - * @param array $request - * - * @return sting|bool - */ - private function _validate_results($return, $request) { - switch ($request['action']) { - case "DELETE": - if ($return['http_code'] == '204') { - return TRUE; - } - break; - - case "PUT": - if ($return['email_address'] == $this->getEmail() && $return['status'] === 'subscribed') { - return TRUE; - } - break; - - case "GET": - // The user is not subscribed. - if ($return['status'] == '404') { - return FALSE; - } - - //The user was found in the list. - if ($return['email_address'] == $this->getEmail() && $return['status'] === 'subscribed') { - return TRUE; - } - } - - // If something goes wrong - return 'ERROR'; - } - - /** - * This function verifies if the user is part of the members list - * - * @return bool - * */ - private function _verifyUserSubscription() { - $email_md5 = $this->_getEmailMd5(); - $list_id = $this->_getListId(); - if ($email_md5 && $list_id) { - $request = array( - 'action' => 'GET', - 'endpoint' => '/lists/' . $list_id . '/members/' . $email_md5, - ); - - $list = $this->_curlRequest($request); - - if ($list === TRUE) { - $this->_addUserToSubscribeList(); - } - elseif ($list === FALSE) { - $this->_removeUserFromSubscribeList(); - } - } - } -} - diff --git a/eclipse.org-common/classes/subscriptions/subscriptions.class.php b/eclipse.org-common/classes/subscriptions/subscriptions.class.php deleted file mode 100644 index 3c723de..0000000 --- a/eclipse.org-common/classes/subscriptions/subscriptions.class.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2016 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eric Poirier (Eclipse Foundation) - Initial implementation - *******************************************************************************/ -require_once("mailchimp.class.php"); - -class Subscriptions extends Mailchimp { - - function __construct(App $App) { - parent::__construct($App); - } - -}
\ No newline at end of file diff --git a/eclipse.org-common/classes/subscriptions/subscriptions_base.class.php b/eclipse.org-common/classes/subscriptions/subscriptions_base.class.php deleted file mode 100644 index 0f0e599..0000000 --- a/eclipse.org-common/classes/subscriptions/subscriptions_base.class.php +++ /dev/null @@ -1,127 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2016 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christopher Guindon (Eclipse Foundation) - Initial implementation - *******************************************************************************/ - -class Subscriptions_base { - - protected $App = NULL; - - private $debug_mode = FALSE; - - private $email = ""; - - private $first_name = ""; - - private $last_name = ""; - - protected $Friend = NULL; - - protected $Sessions = NULL; - - function __construct(App $App) { - $this->App = $App; - $this->Sessions = $this->App->useSession(); - $this->Friend = $this->Sessions->getFriend(); - - // Set debug mode if the domain contains the word .local or staging - $domain = $this->App->getEclipseDomain(); - if (in_array($domain['shortname'], array('local','staging'))) { - $this->_setDebugMode(TRUE); - } - } - - /** - * Get First Name - */ - public function getFirstName() { - if (empty($this->first_name)) { - $this->setFirstName($this->Friend->getFirstName()); - } - return $this->first_name; - } - - /** - * Set First Name - * - * @param string $first_name - */ - public function setFirstName($first_name = "") { - $this->first_name = filter_var($first_name, FILTER_SANITIZE_STRING); - return $this->first_name; - } - - /** - * Get Last Name - */ - public function getLastName() { - if (empty($this->last_name)) { - $this->setLastName($this->Friend->getLastName()); - } - return $this->last_name; - } - - /** - * Set Last Name - * - * @param string $last_name - */ - public function setLastName($last_name = ""){ - $this->last_name = filter_var($last_name, FILTER_SANITIZE_STRING); - return $this->first_name; - } - - /** - * Get Email - */ - public function getEmail() { - if (empty($this->email)) { - $this->email = $this->setEmail($this->Friend->getEmail()); - } - return $this->email; - } - - /** - * Set Email - * - * @param string $email - */ - public function setEmail($email = "") { - if (filter_var($email, FILTER_VALIDATE_EMAIL)) { - $this->email = $email; - } - - return $this->email; - } - - /** - * Get debug mode value - * - * @return Ambigous <boolean, string> - */ - public function getDebugMode() { - return $this->debug_mode; - } - - /** - * Enable/disable debug/sandbox mode - */ - private function _setDebugMode($debug_mode = FALSE){ - if ($debug_mode === TRUE) { - $this->debug_mode = TRUE; - } - - if ($this->getDebugMode()) { - $this->App->setSystemMessage('debug', 'Debug, logging and Sandbox mode is enabled.', 'warning'); - return TRUE; - } - } - -}
\ No newline at end of file diff --git a/eclipse.org-common/classes/subscriptions/tpl/subscriptions.tpl.php b/eclipse.org-common/classes/subscriptions/tpl/subscriptions.tpl.php deleted file mode 100644 index 52419b9..0000000 --- a/eclipse.org-common/classes/subscriptions/tpl/subscriptions.tpl.php +++ /dev/null @@ -1,36 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2016 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eric Poirier (Eclipse Foundation) - initial API and implementation - * Christopher Guindon (Eclipse Foundation) - *******************************************************************************/ -if(!is_a($this, 'Mailchimp')){ - exit(); -} -?> - <table class="table"> - <thead> - <tr> - <th>Newsletters</th> - <th></th> - </tr> - </thead> - <tbody> - <tr> - <td>Eclipse Newsletter</td> - <td> - <?php if ($this->getIsSubscribed()): ?> - <button id="subscription-form-submit" class="btn btn-danger btn-xs float-right">Unsubscribe</button> - <?php else: ?> - <button id="subscription-form-submit" class="btn btn-primary btn-xs float-right">Subscribe</button> - <?php endif;?> - </td> - </tr> - </tbody> - </table>
\ No newline at end of file diff --git a/eclipse.org-common/classes/themes/baseTheme.class.php b/eclipse.org-common/classes/themes/baseTheme.class.php index 290a23e..096247f 100644 --- a/eclipse.org-common/classes/themes/baseTheme.class.php +++ b/eclipse.org-common/classes/themes/baseTheme.class.php @@ -465,8 +465,8 @@ EOHTML; */ public function getBaseUrlLogin() { if (empty($this->base_url_login)) { - $domains = $this->App->getEclipseDomain(); - $this->base_url_login = 'https://' . $domains['dev_domain']; + $domain = $this->App->getEclipseDomain(); + $this->base_url_login = 'https://' . $domain['accounts']; } return $this->base_url_login; } @@ -1745,8 +1745,8 @@ EOHTML; if (substr($path, 0, 1) == "/") { $path = substr($path, 1); } - - return "?takemeback=" . $this->getBaseUrl() . $path; + $url = urlencode($this->getBaseUrl() . $path); + return "?takemeback=" . $url; } /** @@ -1765,8 +1765,8 @@ EOHTML; ); $Session = $this->_getSession(); $Friend = $Session->getFriend(); - $this->session_variables['create_account_link'] = '<a href="' . $this->getBaseUrlLogin() . '/site_login/createaccount.php"><i class="fa fa-user fa-fw"></i> Create account</a>'; - $this->session_variables['my_account_link'] = '<a href="' . $this->getBaseUrlLogin() . '/site_login/' . $this->_getTakeMeBack() . '"><i class="fa fa-sign-in fa-fw"></i> Log in</a>'; + $this->session_variables['create_account_link'] = '<a href="' . $this->getBaseUrlLogin() . '/user/register"><i class="fa fa-user fa-fw"></i> Create account</a>'; + $this->session_variables['my_account_link'] = '<a href="' . $this->getBaseUrlLogin() . '/user/login/' . $this->_getTakeMeBack() . '"><i class="fa fa-sign-in fa-fw"></i> Log in</a>'; $this->session_variables['logout'] = ''; if ($Session->isLoggedIn()) { @@ -1778,10 +1778,10 @@ EOHTML; if (!empty($this->session_variables['user_ldap_uid'])){ $this->session_variables['create_account_link'] = '<a href="https://www.eclipse.org/user/' . $this->session_variables['user_ldap_uid'] . '">Welcome, ' . $this->session_variables['full_name'] . '</a>'; } - $this->session_variables['my_account_link'] = '<a href="' . $this->getBaseUrlLogin() . '/site_login/myaccount.php#open_tab_profile" class="" data-tab-destination="tab-profile"><i class="fa fa-edit fa-fw"></i> Edit my account</a>'; + $this->session_variables['my_account_link'] = '<a href="' . $this->getBaseUrlLogin() . '/user/edit" class="" data-tab-destination="tab-profile"><i class="fa fa-edit fa-fw"></i> Edit my account</a>'; // Adding <li> with logout because we only display // two options if the user is not logged in. - $this->session_variables['logout'] = '<li><a href="' . $this->getBaseUrlLogin() . '/site_login/logout.php"><i class="fa fa-power-off fa-fw"></i> Log out</a></li>'; + $this->session_variables['logout'] = '<li><a href="' . $this->getBaseUrlLogin() . '/user/logout"><i class="fa fa-power-off fa-fw"></i> Log out</a></li>'; } } if (!empty($this->session_variables[$id])) { diff --git a/eclipse.org-common/classes/users/accountCreator.class.php b/eclipse.org-common/classes/users/accountCreator.class.php deleted file mode 100644 index 5c4c78a..0000000 --- a/eclipse.org-common/classes/users/accountCreator.class.php +++ /dev/null @@ -1,227 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2012-2014 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christopher Guindon (Eclipse Foundation) - initial API and implementation - *******************************************************************************/ - -/** - * Usage example: - * - * $AccountCreator = New AccountCreator(); - * $AccountCreator->setDebugMode(); - * $AccountCreator->setUrl('https://bugs.eclipse.org/bugstest/index.cgi'); - * $AccountCreator->setUsername('user@mail.com'); - * $AccountCreator->setPassword('the_password'); - * $AccountCreator->setAccountType('gerrit'); - * $AccountCreator->execute(); - */ - - -/** - * Eclipse Account Creator Class - * - * Create new users to 3rd party applications. - * - * @package Site_login - * @author Christopher Guindon - */ -class AccountCreator { - - /** - * Type of Account to create - * - * @var string - */ - private $account_type = ""; - - /** - * Enable or disable debug mode. - * - * @var bool - */ - private $debug = FALSE; - - /** - * Username/e-mail address of the user. - * - * @var string - */ - private $username = ""; - - /** - * Password of the user. - * - * @var string - */ - private $password = ""; - - /** - * Url of Website. - * - * @var string - */ - private $url = ""; - - // -------------------------------------------------------------------- - - /** - * Constructor - Sets default settings - * - * @return void - */ - function __construct() { - $this->url = "https://bugs.eclipse.org/bugs/index.cgi"; - } - - /** - * Execute Login Process - * - * @return int/bool - */ - public function execute() { - if (filter_var($this->username, FILTER_VALIDATE_EMAIL) && !empty($this->password)) { - return $this->_process(); - } - else{ - trigger_error("Invalid username or password", E_USER_NOTICE); - } - return FALSE; - } - - /** - * Set Account Type - * - * @return bool - */ - public function setAccountType($type = "") { - $allowed_type = array('gerrit', 'bugzilla'); - $type = strtolower($type); - if (in_array($type, $allowed_type)) { - $this->account_type = $type; - return TRUE; - } - return FALSE; - } - - /** - * Enable Debug Mode - * - * @return bool - */ - public function setDebugMode($set = TRUE){ - if ($set == TRUE) { - $this->debug = TRUE; - return TRUE; - } - return FALSE; - } - - /** - * Set Password - * - * @return bool - */ - public function setPassword($password = "") { - if (!empty($password)) { - $this->password = $password; - return TRUE; - } - return FALSE; - } - - /** - * Set Website URL - * - * @return bool - */ - public function setUrl($url = "") { - if (filter_var($url, FILTER_VALIDATE_URL)) { - $this->url = $url; - return TRUE; - } - return FALSE; - } - - /** - * Set Username - * - * @return bool - */ - public function setUsername($username = "") { - if (filter_var($username, FILTER_VALIDATE_EMAIL)) { - $this->username = $username; - return TRUE; - } - return FALSE; - } - - /** - * Print Response Output - * - * @return int - */ - private function _output($ch){ - - $result = curl_exec($ch); - - if (curl_errno($ch)) { - // @todo: Log errors - if ($this->debug) { - echo 'Error: ' . curl_error($ch); - } - } - else { - if ($this->debug) { - print $result; - } - } - $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE); - curl_close($ch); - return $http_code; - } - - /** - * Initialize a CURL Session - * - * @return int - */ - private function _process() { - - $ch = curl_init(); - curl_setopt($ch, CURLOPT_URL, $this->url); - curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5); - curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/4.0 (site_login)"); - - // Bug 442432 - New posts are being associated with incorrect accounts/authors - curl_setopt($ch, CURLOPT_REFERER, $this->url); - - curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); - curl_setopt($ch, CURLOPT_FRESH_CONNECT, TRUE); - - curl_setopt($ch, CURLOPT_POST, TRUE); - curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); - - curl_setopt($ch, CURLOPT_HEADER, TRUE); - curl_setopt($ch, CURLINFO_HEADER_OUT, TRUE); - - switch ($this->account_type) { - case "gerrit": - $post = "username=" . urlencode($this->username) . "&password=" . urlencode($this->password); - break; - - default: - $post = "Bugzilla_login=" . urlencode($this->username) . "&Bugzilla_password=" . urlencode($this->password); - break; - } - - curl_setopt($ch, CURLOPT_POSTFIELDS, $post); - return $this->_output($ch); - } - -} diff --git a/eclipse.org-common/classes/users/cla.class.php b/eclipse.org-common/classes/users/cla.class.php deleted file mode 100644 index 2b30876..0000000 --- a/eclipse.org-common/classes/users/cla.class.php +++ /dev/null @@ -1,717 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2016 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eric Poirier (Eclipse Foundation) - initial API and implementation - *******************************************************************************/ - -require_once(realpath(dirname(__FILE__) . "/../friends/friend.class.php")); - -class Cla { - - /** - * Eclipse App class - * - * @var stdClass - */ - private $App = NULL; - - /** - * List of possible contributor agreements - * - * @var Array - */ - private $contributor_agreement_documents = NULL; - - /** - * Signed Agreements by the user - * @var unknown - */ - private $user_contributor_agreement_documents = NULL; - - /** - * Form field values - * - * @var array - */ - private $form_fields = NULL; - - /** - * Content for the Contributor aggrement form - * - * @var array - */ - private $form_content = array(); - - /** - * Display Contributor notification flag - * - * @var string - */ - private $display_notificaiton = TRUE; - - /** - * Eclipse Friend object - * - * @var stdClass - */ - private $Friend = NULL; - - /** - * LDAP UID of the user - * @var string - */ - private $ldap_uid = ''; - - /** - * Current state of contributor agreement - * @var string - */ - private $eca = TRUE; - - /** - * URL of ECA document - * - * https://eclipse.local:50243/legal/ECA.html - * @var string - */ - private $eca_url = "http://www.eclipse.org/legal/ECA.html"; - - public function Cla(App $App) { - // Load the user - $this->App = $App; - $Session = $this->App->useSession(); - $this->Friend = $Session->getFriend(); - $this->ldap_uid = $this->Friend->getUID(); - - // Load contributor agreement documents - $this->_setContributorDocuments(); - $this->_setUserContributorSignedDocuments(); - - // Get the current state - $state = filter_var($this->App->getHTTPParameter("state", "POST"), FILTER_SANITIZE_STRING); - $form = filter_var($this->App->getHTTPParameter("form_name", "POST"), FILTER_SANITIZE_STRING); - - if (!empty($this->ldap_uid) && $form == "cla-form") { - switch ($state) { - case 'submit_cla': - $this->_submitClaDocument(); - break; - case 'invalidate_cla': - $this->_invalidateClaDocument(); - break; - case 'disable_unsigned_notification': - $this->_disableUnsignedNotification(); - break; - } - } - - // Check if the current user has a signed CLA - $this->notifyUserOfUnsignedCla(); - } - - private function _setEca($eca = TRUE) { - if (is_bool($eca)) { - $this->eca = $eca; - } - return $this->eca; - } - - public function getEca() { - return $this->eca; - } - - /** - * Get CLA Document Id - * @return string - */ - public function getClaDocumentId() { - return 'a6f31f81d1b9abbcdbba'; - } - - /** - * Get ECA Document Id - * @return string - */ - public function getEcaDocumentId() { - return '99f64b0dac3e41dc1e97'; - } - - /** - * Return CLA document id if still valid, - * otherwise return eca document id - * - * @return string - */ - public function getContributorDocumentId() { - if (!$this->getEca()) { - return $this->getClaDocumentId(); - } - return $this->getEcaDocumentId(); - } - - /** - * Get Display CLA notification flag - * @return boolean|string - */ - public function getDisplayNotification() { - return $this->display_notificaiton; - } - - /** - * Set Display CLA notification flag - * - * @param string $value - * @return boolean|string - */ - public function setDisplayNotification($value = TRUE) { - if (is_bool($value)) { - $this->display_notificaiton = $value; - } - return $this->display_notificaiton; - } - - /** - * This function let the user know about an unsigned CLA - * - * @return boolean - */ - public function notifyUserOfUnsignedCla() { - // Verify if the display notification flag was disabled - if (!$this->getDisplayNotification()) { - return FALSE; - } - - // We don't need to display the nofication if the user already signed the cla - if ($this->getClaIsSigned()) { - return FALSE; - } - - // Check if user don't want to see the notification - if (isset($_COOKIE['ECLIPSE_CLA_DISABLE_UNSIGNED_NOTIFICATION']) && $_COOKIE['ECLIPSE_CLA_DISABLE_UNSIGNED_NOTIFICATION'] === '1') { - return FALSE; - } - - $committer_string = ''; - if ($this->Friend->getIsCommitter()) { - $committer_string = ' for which you are not a committer '; - } - - $message = ' - <p>In order to contribute code to an Eclipse Foundation Project ' . $committer_string . 'you will be required to sign a Eclipse Contributor Agreement (ECA).</p> - <form action="" method="POST"> - <input type="hidden" name="unsigned_cla_notification" value="1"> - <input type="hidden" name="state" value="disable_unsigned_notification"> - <input type="hidden" name="form_name" value="cla-form"> - <ul class="list-inline margin-top-10 margin-bottom-0"> - <li><a class="small btn btn-primary" href="http://www.eclipse.org/legal/clafaq.php">What is a ECA?</a></li> - <li><a class="small btn btn-primary" href="#open_tab_cla">Sign your ECA</a></li> - <li><button class="small btn btn-primary">Disable this message</button></li> - </ul> - </form>'; - - $this->App->setSystemMessage('unsigned_cla',$message,'info'); - } - - /** - * This function returns the CLA expiry date - * - * @return string - */ - public function getClaExpiryDate() { - $user_documents = $this->_getUserContributorSignedDocuments(); - if (!empty($user_documents[$this->getContributorDocumentId()]['EffectiveDate'])) { - return date("Y-m-d", strtotime('+3 years', strtotime($user_documents[$this->getContributorDocumentId()]['EffectiveDate']))); - } - - return ''; - } - - /** - * These functions returns the text to put on the CLA form - * - * @param string $key - * @return NULL|string|string - */ - public function getClaFormContent($key = "") { - if (!empty($key) && isset($this->form_content[$key])) { - return $this->form_content[$key]; - } - return ''; - } - - /** - * This function sets the CLA fields - * values from what's being posted from the form - * - * @param string $field - * @return mixed - */ - public function getFieldValues($field = "") { - if (is_null($this->form_fields)) { - $this->form_fields = array( - 'Question 1' => filter_var($this->App->getHTTPParameter("question_1", "POST"), FILTER_SANITIZE_NUMBER_INT), - 'Question 2' => filter_var($this->App->getHTTPParameter("question_2", "POST"), FILTER_SANITIZE_NUMBER_INT), - 'Question 3' => filter_var($this->App->getHTTPParameter("question_3", "POST"), FILTER_SANITIZE_NUMBER_INT), - 'Question 4' => filter_var($this->App->getHTTPParameter("question_4", "POST"), FILTER_SANITIZE_NUMBER_INT), - 'Email' => filter_var($this->App->getHTTPParameter("email", "POST"), FILTER_SANITIZE_EMAIL), - 'Legal Name' => filter_var($this->App->getHTTPParameter("legal_name", "POST"), FILTER_SANITIZE_STRING), - 'Public Name' => filter_var($this->App->getHTTPParameter("public_name", "POST"), FILTER_SANITIZE_STRING), - 'Employer' => filter_var($this->App->getHTTPParameter("employer", "POST"), FILTER_SANITIZE_STRING), - 'Address' => filter_var($this->App->getHTTPParameter("address", "POST"), FILTER_SANITIZE_STRING), - 'Agree' => filter_var($this->App->getHTTPParameter("cla_agree", "POST"), FILTER_SANITIZE_STRING) - ); - } - - // Return the field if we're asking for one in particular - if (!empty($field)) { - if (empty($this->form_fields[$field])) { - return ''; - } - return $this->form_fields[$field]; - } - - return $this->form_fields; - } - - /** - * Set contributor_agreement_documents - * @return Array - */ - protected function _setContributorDocuments() { - $this->contributor_agreement_documents = array(); - $sql = "SELECT * FROM SYS_Documents - WHERE DocumentID = " . $this->App->returnQuotedString($this->getClaDocumentID()) . " or " . - $this->App->returnQuotedString($this->getECADocumentID()) . " AND Version=1 AND Type='IN'"; - $result = $this->App->foundation_sql($sql); - while ($row = mysql_fetch_assoc($result)) { - $this->contributor_agreement_documents[$row['DocumentID']] = $row; - } - return $this->contributor_agreement_documents; - } - - /** - * Get contributor_agreement_documents - * @return Array - */ - protected function _getContributorDocuments(){ - if (is_null($this->contributor_agreement_documents)) { - $this->_setContributorDocuments(); - } - return $this->contributor_agreement_documents; - } - - /** - * Set user_contributor_agreement_documents - * - * @return array - */ - protected function _setUserContributorSignedDocuments(){ - $this->user_contributor_agreement_documents = array(); - $sql = "SELECT PersonID, EffectiveDate, DocumentID - FROM PeopleDocuments - WHERE PersonID = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->ldap_uid)) . " - AND (DocumentID = " . $this->App->returnQuotedString($this->getClaDocumentID()) . " or " . - $this->App->returnQuotedString($this->getECADocumentID()) . ") - AND ExpirationDate IS NULL"; - $result = $this->App->foundation_sql($sql); - - while ($row = mysql_fetch_assoc($result)) { - $this->user_contributor_agreement_documents[$row['DocumentID']] = $row; - } - - if (!empty($this->user_contributor_agreement_documents[$this->getClaDocumentID()])) { - $this->_setEca(FALSE); - } - return $this->user_contributor_agreement_documents; - } - - /** - * Set user_contributor_agreement_documents - * - * @return array - */ - protected function _getUserContributorSignedDocuments(){ - if (is_null($this->user_contributor_agreement_documents)) { - $this->_setUserContributorSignedDocuments(); - } - return $this->user_contributor_agreement_documents; - } - - /** - * Verify if the user signed his CLA. - * - * @return boolean - */ - public function getClaIsSigned($document_id = NULL) { - - if (is_null($document_id)) { - $document_id = $this->getContributorDocumentId(); - } - - $user_documents = $this->_getUserContributorSignedDocuments(); - - // If the array is empty, the user did not - // sign the eca or cla. - if (empty($user_documents)) { - return FALSE; - } - - if (!empty($user_documents[$document_id])) { - return TRUE; - } - - return FALSE; - } - - - /** - * Generate HTML for CLA page - */ - public function outputPage() { - switch ($this->getClaIsSigned()){ - case TRUE: - include $_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/users/tpl/cla_record.tpl.php"; - break; - case FALSE: - $this->_claFormContent(); - include $_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/users/tpl/cla_form.tpl.php"; - break; - } - } - - /** - * This function insert rows in the account_requests and SYS_EvtLog tables - * depending on $action is specified - * - * @param $action - Validate or invalidate a CLA - * @return mysql_query() - */ - private function _actionLdapGroupRecord($action) { - $email = $this->Friend->getEmail(); - $accepted_actions = array( - 'CLA_SIGNED', - 'CLA_INVALIDATED' - ); - if ($this->ldap_uid && in_array($action, $accepted_actions) && !empty($email)) { - //Insert the request to add to LDAP. - $sql = "INSERT INTO account_requests - (email,fname,lname,password,ip,token,req_when) - values ( - ".$this->App->returnQuotedString($this->App->sqlSanitize($email)).", - ".$this->App->returnQuotedString($this->App->sqlSanitize($this->Friend->getFirstName())).", - ".$this->App->returnQuotedString($this->App->sqlSanitize($this->Friend->getLastName())).", - 'eclipsecla', - ".$this->App->returnQuotedString($this->App->sqlSanitize($_SERVER['REMOTE_ADDR'])).", - ".$this->App->returnQuotedString($this->App->sqlSanitize($action)).", - NOW() - )"; - $result = $this->App->eclipse_sql($sql); - - // Log that this event occurred - $sql = "INSERT INTO SYS_EvtLog - (LogTable,PK1,PK2,LogAction,uid,EvtDateTime) - values ( - 'cla', - ".$this->App->returnQuotedString($this->App->sqlSanitize($this->ldap_uid)).", - 'EclipseCLA-v1', - ".$this->App->returnQuotedString($this->App->sqlSanitize($action)).", - 'cla_service', - NOW() - )"; - return $this->App->eclipse_sql($sql); - } - $this->App->setSystemMessage('account_requests', "There's been an error updated the LDAP group record. (LDAP-01)", "danger"); - } - - /** - * This function check if the current user has access to sign the CLA - * - * @return boolean - */ - private function _allowSigning() { - // If user is logged in - $email = $this->Friend->getEmail(); - if (!empty($this->ldap_uid) || !empty($email)) { - return TRUE; - } - - // The user is not logged in and is not part of the foundation staff - return FALSE; - } - - /** - * This internal function prepares a data array and converts it to JSON, - * it is a helper function for contributor_agreement__insert_cla_document - * - * @return string JSON encoded string. - */ - private function _claDocumentInJson() { - - $cla_document = fopen($this->eca_url, 'r'); - $data = array( - 'legal_name' => $this->form_fields['Legal Name'], - 'public_name' => $this->form_fields['Public Name'], - 'employer' => $this->form_fields['Employer'], - 'address' => $this->form_fields['Address'], - 'email' => $this->form_fields['Email'], - 'question_1' => $this->form_fields['Question 1'], - 'question_2' => $this->form_fields['Question 2'], - 'question_3' => $this->form_fields['Question 3'], - 'question_4' => $this->form_fields['Question 4'], - 'agree' => $this->form_fields['Agree'], - 'cla_doc' => base64_encode(stream_get_contents($cla_document)), - ); - fclose($cla_document); - return json_encode($data); - } - - /** - * This function fetches content from the CLA html file - */ - private function _claFormContent() { - - $cla_document = new DomDocument(); - $cla_document->loadhtmlfile($this->eca_url); - - // Remove the #reference DIV - $reference = $cla_document->getElementById('reference'); - $reference->parentNode->removeChild($reference); - - // Fetching the pieces of content by ID - $question1 = $cla_document->getElementById('question1'); - $question2 = $cla_document->getElementById('question2'); - $question3 = $cla_document->getElementById('question3'); - $question4 = $cla_document->getElementById('question4'); - $text1 = $cla_document->getElementById('text1'); - $text2 = $cla_document->getElementById('text2'); - $text3 = $cla_document->getElementById('text3'); - $text4 = $cla_document->getElementById('text4'); - - $this->form_content = array( - 'question_1' => $question1->nodeValue, - 'question_2' => $question2->nodeValue, - 'question_3' => $question3->nodeValue, - 'question_4' => $question4->nodeValue, - 'text_1' => $cla_document->saveXML($text1), - 'text_2' => $cla_document->saveXML($text2), - 'text_3' => $cla_document->saveXML($text3), - 'text_4' => $cla_document->saveXML($text4), - ); - } - - /** - * This function creates a new people record in the foundationDB - * if it can't find an existing one - * - * @return bool - */ - private function _createPeopleRecordIfNecessary() { - - if (empty($this->ldap_uid)) { - return FALSE; - } - - $sql = "SELECT PersonID FROM People - WHERE PersonID = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->ldap_uid)); - $result = $this->App->foundation_sql($sql); - - if ($row = mysql_fetch_assoc($result)) { - if (isset($row['PersonID']) && !empty($row['PersonID'])) { - return TRUE; - } - } - - $sql = "INSERT INTO People - (PersonID, FName, LName, Type, IsMember, Email, IsUnixAcctCreated) - values ( - ". $this->App->returnQuotedString($this->App->sqlSanitize($this->ldap_uid)) .", - ". $this->App->returnQuotedString($this->App->sqlSanitize($this->Friend->getFirstName())) .", - ". $this->App->returnQuotedString($this->App->sqlSanitize($this->Friend->getLastName())) .", - 'XX', - 0, - ". $this->App->returnQuotedString($this->App->sqlSanitize($this->Friend->getEmail())) .", - 0 - )"; - $result_insert = $this->App->foundation_sql($sql); - - // Log that this event occurred - $sql = "INSERT INTO SYS_ModLog - (LogTable,PK1,PK2,LogAction,PersonID,ModDateTime) - VALUES ( - 'cla', - 'cla_service', - 'EclipseCLA-v1', - 'NEW PEOPLE RECORD', - ". $this->App->returnQuotedString($this->App->sqlSanitize($this->ldap_uid)) .", - NOW() - )"; - $result_log = $this->App->foundation_sql($sql); - - - return (bool)$result_insert; - } - - /** - * This function sets a cookie to hide the unsigned notification message - * */ - private function _disableUnsignedNotification() { - setcookie ('ECLIPSE_CLA_DISABLE_UNSIGNED_NOTIFICATION', '1', time() + 3600 * 24 * 1095, '/' ); - $this->setDisplayNotification(FALSE); - } - -/** - * This function invalidates a user's CLA document - */ - private function _invalidateClaDocument() { - $document_id = $this->getContributorDocumentId(); - $user_documents = $this->_getUserContributorSignedDocuments(); - $document = $user_documents[$document_id]; - - if (!empty($this->ldap_uid) && !empty($document['EffectiveDate'])) { - // Log that this event occurred Note that foundationdb uses SYS_ModLog instead of SYS_EvtLog; - $sql = "INSERT INTO SYS_ModLog - (LogTable,PK1,PK2,LogAction,PersonID,ModDateTime) - values ( - 'cla', - 'cla_service', - 'EclipseCLA-v1', - 'INVALIDATE_CLA DOCUMENT', - ".$this->App->returnQuotedString($this->App->sqlSanitize($this->ldap_uid)).", - NOW() - )"; - $result = $this->App->foundation_sql($sql); - - // Invalidate the users LDAP group. - $this->_actionLdapGroupRecord('CLA_INVALIDATED'); - - $invalidated = FALSE; - $loop = 0; - - while($loop < 10) { - // Wait 1 second for the Perl script to invalidate - // the user's CLA/ECA in the PeopleDocuments table - sleep(1); - - // Perform another Select to find out if the user - // still has a valid CLA/ECA - $this->_setUserContributorSignedDocuments(); - - if ($this->getClaIsSigned() == FALSE) { - $invalidated = TRUE; - break; - } - $loop++; - } - - if ($invalidated) { - - // Making sure we add the notification back in the page - if (isset($_COOKIE['ECLIPSE_CLA_DISABLE_UNSIGNED_NOTIFICATION'])) { - unset($_COOKIE['ECLIPSE_CLA_DISABLE_UNSIGNED_NOTIFICATION']); - setcookie('ECLIPSE_CLA_DISABLE_UNSIGNED_NOTIFICATION', '', time() - 3600, '/'); - } - - // Create success message - $this->App->setSystemMessage('invalidate_cla','You have successfully invalidated your ECA.','success'); - return TRUE; - } - $this->App->setSystemMessage('invalidate_cla','We were unable to invalidate the ECA we have on record. (LDAP-02)','danger'); - return FALSE; - } - - $this->App->setSystemMessage('invalidate_cla','An attempt to invalidate the ECA failed because we were unable to find the ECA that matches. (LDAP-03)','danger'); - return FALSE; - } - - /** - * This internal function inserts a new CLA document based off the form data submitted. - */ - private function _submitClaDocument() { - // Check if the sumitted fields validate and if there is no signed CLA for this user - $document_id = $this->getEcaDocumentId(); - if ($this->_allowSigning() && $this->_validatedClaFields() && !$this->getClaIsSigned($document_id)) { - - $this->_createPeopleRecordIfNecessary(); - - // get the CLA document in Json format - $blob = $this->_claDocumentInJson(); - - $sql = "INSERT INTO PeopleDocuments - (PersonId,DocumentId,Version,EffectiveDate,ReceivedDate, - ScannedDocumentBLOB,ScannedDocumentMime,ScannedDocumentBytes, - ScannedDocumentFileName,Comments) - VALUES ( - ". $this->App->returnQuotedString($this->App->sqlSanitize($this->ldap_uid)) .", - ". $this->App->returnQuotedString($this->App->sqlSanitize($document_id)) .", - 1, - now(), - now(), - '". $blob ."', - 'application/json', - ". strlen($blob) .", - 'eclipse-eca.json', - 'Automatically generated CLA' - )"; - $result = $this->App->foundation_sql($sql); - - // Log that this event occurred - $sql = "INSERT INTO SYS_ModLog - (LogTable,PK1,PK2,LogAction,PersonID,ModDateTime) - VALUES ( - 'cla', - ". $this->App->returnQuotedString($this->App->sqlSanitize($this->ldap_uid)) .", - 'EclipseCLA-v1', - 'NEW CLA DOCUMENT', - 'cla_service', - NOW() - )"; - $result = $this->App->foundation_sql($sql); - - // Submit the users LDAP group. - $this->_actionLdapGroupRecord('CLA_SIGNED'); - $this->App->setSystemMessage('submit_cla',"You successfully submitted the ECA!",'success'); - $this->_setUserContributorSignedDocuments(); - return TRUE; - } - - $this->App->setSystemMessage('submit_cla',"Error, the ECA have not been submitted. (LDAP-03)",'danger'); - return FALSE; - } - - /** - * This function checks if all the fields from the form validates - * - * @return BOOL - * - */ - private function _validatedClaFields() { - $form_fields = $this->getFieldValues(); - foreach ($form_fields as $field_name => $field_value) { - if (strpos($field_name, 'Question') !== FALSE && $field_value !== "1") { - $this->App->setSystemMessage('submit_cla','You must accept ' . $field_name,'danger'); - $is_valid = FALSE; - } - if (($field_name == 'Email' || $field_name == 'Legal Name' || $field_name == 'Employer' || $field_name == 'Address') && empty($field_value)) { - $this->App->setSystemMessage('submit_cla','You must enter your ' . $field_name,'danger'); - $is_valid = FALSE; - } - if ($field_name == 'Agree' && $field_value !== 'I AGREE') { - $this->App->setSystemMessage('submit_cla','You must enter "I AGREE" in the Electronic Signature field.','danger'); - $is_valid = FALSE; - } - } - - if (!isset($is_valid)) { - return TRUE; - } - - return FALSE; - } - -}
\ No newline at end of file diff --git a/eclipse.org-common/classes/users/siteLogin.class.php b/eclipse.org-common/classes/users/siteLogin.class.php deleted file mode 100644 index 364f30d..0000000 --- a/eclipse.org-common/classes/users/siteLogin.class.php +++ /dev/null @@ -1,1632 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2014, 2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christopher Guindon (Eclipse Foundation) - initial API and implementation - *******************************************************************************/ - -require_once(realpath(dirname(__FILE__) . "/../../system/app.class.php")); -require_once(realpath(dirname(__FILE__) . "/../friends/friend.class.php")); -require_once(realpath(dirname(__FILE__) . "/../../system/session.class.php")); -require_once("accountCreator.class.php"); -require_once('/home/data/httpd/eclipse-php-classes/system/ldapconnection.class.php'); -require_once(realpath(dirname(__FILE__) . "/../../system/evt_log.class.php")); -require_once(realpath(dirname(__FILE__) . "/../captcha/captcha.class.php")); -require_once(realpath(dirname(__FILE__) . "/../forms/formToken.class.php")); - -define('SITELOGIN_EMAIL_REGEXP', '/^(([^<>()[\]\\.,;:\s@\"]+(\.[^<>()[\]\\.,;:\s@\"]+)*)|(\".+\"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/'); - -define('SITELOGIN_NAME_REGEXP', '/[^\p{L}\p{N}\-\.\' ]/u'); - -class Sitelogin { - - private $App = NULL; - - private $agree = ""; - - private $bio = ""; - - private $Captcha = NULL; - - private $country = ""; - - private $country_list = NULL; - - private $githubid = ""; - - private $formToken = NULL; - - private $Friend = NULL; - - private $fname = ""; - - private $exipred_pass_token = FALSE; - - private $interests = ""; - - private $jobtitle = ""; - - private $Ldapconn = NULL; - - private $lname = ""; - - private $messages = array(); - - private $newsletter_status = ""; - - private $organization = ""; - - private $p = ""; - - private $page = ""; - - private $password = ""; - - private $password1 = ""; - - private $password2 = ""; - - private $password_update = 0; - - private $password_expired = ""; - - private $path_public_key = ""; - - private $profile_default = array(); - - private $referer = ""; - - private $remember = ""; - - private $Session = NULL; - - private $stage = ""; - - private $submit = ""; - - private $takemeback = ""; - - private $t = ""; - - private $twitter_handle = ""; - - private $username = ""; - - private $user_uid = ""; - - private $user_mail = ""; - - private $website = ""; - - private $xss_patterns = array(); - - private $is_committer = ""; - - private $changed_employer = ""; - - function Sitelogin($stage = NULL) { - $this->xss_patterns = array( - '/<script[^>]*?>.*?<\/script>/si', - '/<[\/\!]*?[^<>]*?>/si', - '/<style[^>]*?>.*?<\/style>/siU', - '/<![\s\S]*?–[ \t\n\r]*>/' - ); - - $this->path_public_key = "/home/data/httpd/dev.eclipse.org/html/public_key.pem"; - - global $App; - $this->App = $App; - $this->Captcha = New Captcha(); - $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()); - $this->user_mail = $this->Friend->getEmail(); - $this->is_committer = $this->Friend->getIsCommitter(); - $this->password_expired = $this->_verifyIfPasswordExpired(); - - $this->_setStage($stage); - - switch ($this->stage) { - case 'login': - $this->_userAuthentification(); - break; - case 'create': - $this->_createAccount(); - break; - case 'reset': - $this->_resetPassword(); - break; - case 'reset2': - $this->_resetPassword2(); - break; - case 'reset3': - $this->_resetPassword3(); - break; - case 'confirm': - $this->_confirmAccount(); - break; - case 'save': - $this->_processSave(); - break; - case 'save-account': - $this->_processSave(FALSE); - break; - case 'save-profile': - $this->_processSaveProfile(); - break; - } - } - - public function getDomain() { - $domain = $this->App->getEclipseDomain(); - return 'https://' . $domain['dev_domain']; - } - - public function getStage(){ - return $this->stage; - } - - public function getIsCommitter(){ - return $this->is_committer; - } - - public function getCountryList() { - if (is_null($this->country_list)) { - $this->_fetchCountries(); - } - return $this->country_list; - } - - public function getSystemMessage() { - $return = ""; - $allowed_type = array( - 'success', - 'info', - 'warning', - 'danger' - ); - foreach ($this->messages as $type) { - foreach ($type as $key => $value) { - if (!in_array($key, $allowed_type)) { - continue; - } - $list = '<ul>'; - if (count($value) == 1) { - if ($key == 'danger'){ - $org_value = $value[0]; - $value[0] = '<p><strong>' . $org_value . '</strong></p>'; - } - $return .= $this->_getMessageContainer($value[0], $key); - continue; - } - foreach ($value as $msg) { - $list .= '<li><strong>' . $msg . '</strong></li>'; - } - $list .= '</ul>'; - $return .= $this->_getMessageContainer($list, $key); - } - } - return $return; - } - - public function getVariables($type = NULL){ - - $return = array( - 'agree' => "", - 'username' => "", - 'password' => "", - 'remember' => "", - 'submit' => "", - 'takemeback' => "", - 'githubid' => "", - 'referer' => "", - 'password1' => "", - 'password2' => "", - 'password_update' => "", - 'fname' => "", - 'lname' => "", - 'githubid' => "", - 'organization' => "", - 'jobtitle' => "", - 'website' => "", - 'bio' => "", - 'interests' => "", - 'twitter_handle' => "", - 'country' => "", - 'newsletter_status' => "", - ); - - $this->_get_default_profile_fields(); - # Bug 428032 - Multiple XSS on site_login - $username = filter_var($this->username, FILTER_SANITIZE_EMAIL); - $fname = filter_var($this->fname, FILTER_SANITIZE_STRING,FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_HIGH|FILTER_FLAG_ENCODE_LOW); - $lname = filter_var($this->lname, FILTER_SANITIZE_STRING,FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_HIGH|FILTER_FLAG_ENCODE_LOW); - $takemeback = filter_var($this->takemeback, FILTER_SANITIZE_ENCODED); - $remember = filter_var($this->remember, FILTER_SANITIZE_NUMBER_INT); - $agree = filter_var($this->agree, FILTER_SANITIZE_NUMBER_INT); - $password_update = filter_var($this->password_update, FILTER_SANITIZE_NUMBER_INT); - $githubid = filter_var($this->Ldapconn->getGithubIDFromMail($this->Friend->getEmail()), FILTER_SANITIZE_STRING); - $organization = filter_var($this->organization, FILTER_SANITIZE_STRING,FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_HIGH|FILTER_FLAG_ENCODE_LOW); - $country = filter_var($this->country, FILTER_SANITIZE_STRING,FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_HIGH|FILTER_FLAG_ENCODE_LOW); - $jobtitle = filter_var($this->jobtitle, FILTER_SANITIZE_STRING,FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_HIGH|FILTER_FLAG_ENCODE_LOW); - $website = filter_var($this->website, FILTER_SANITIZE_URL); - $bio = filter_var($this->bio, FILTER_SANITIZE_STRING,FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_HIGH|FILTER_FLAG_ENCODE_LOW); - $interests = filter_var($this->interests, FILTER_SANITIZE_STRING,FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_HIGH|FILTER_FLAG_ENCODE_LOW); - $token = filter_var($this->t, FILTER_SANITIZE_STRING,FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_HIGH|FILTER_FLAG_ENCODE_LOW); - $twitter_handle = filter_var($this->twitter_handle, FILTER_SANITIZE_STRING,FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_HIGH|FILTER_FLAG_ENCODE_LOW); - $newsletter_status = filter_var($this->newsletter_status, FILTER_SANITIZE_STRING,FILTER_FLAG_ENCODE_AMP|FILTER_FLAG_ENCODE_HIGH|FILTER_FLAG_ENCODE_LOW); - - switch ($type) { - case 'login': - $return['username'] = $username; - $return['remember'] = ($remember) ? 'checked="checked"' : ""; - $return['takemeback'] = $takemeback; - break; - - case 'welcomeback': - $return['username'] = $this->_get_default_field_value('username', $username); - $return['fname'] = $this->_get_default_field_value('fname', $fname); - $return['lname'] = $this->_get_default_field_value('lname', $lname); - $return['githubid'] = $this->_get_default_field_value('githubid', $githubid); - $return['takemeback'] = $takemeback; - $return['organization'] = $organization; - $return['jobtitle'] = $jobtitle; - $return['website'] = $website; - $return['bio'] = $bio; - $return['country'] = $country; - $return['interests'] = $interests; - $return['twitter_handle'] = $twitter_handle; - $return['friend'] = array( - 'uid' => $this->Friend->getUID(), - 'is_committer' => $this->Friend->getIsCommitter(), - 'is_benefit' => $this->Friend->getIsBenefit(), - 'date_joined' => substr($this->Friend->getDateJoined(), 0, 10), - 'date_expired' => substr($this->Friend->getBenefitExpires(), 0, 10), - ); - - break; - - case 'create': - if ($this->stage == 'create') { - $return['username'] = $username; - $return['fname'] = $fname; - $return['lname'] = $lname; - $return['organization'] = $organization; - $return['country'] = $country; - $return['agree'] = $agree; - $return['takemeback'] = $takemeback; - $return['newsletter_status'] = $newsletter_status; - } - break; - - case 'reset': - $return['token'] = $token; - break; - - case 'logout': - $return['password_update'] = $password_update; - break; - - } - return $return; - } - - public function logout() { - $referer = ""; - if (isset($_SERVER['HTTP_REFERER'])) { - $referer = $_SERVER['HTTP_REFERER']; - } - - $eclipse_domains = array( - 'projects.eclipse.org' => 'https://projects.eclipse.org/', - 'eclipse.org/forums/' => 'https://www.eclipse.org/forums/', - 'wiki.eclipse.org' => 'https://wiki.eclipse.org/index.php?title=Special:UserLogout', - 'git.eclipse.org/r/' => 'https://git.eclipse.org/r/', - 'bugs.eclipse.org/bugs/' => 'https://bugs.eclipse.org/bugs/', - 'lts.eclipse.org' => 'https://lts.eclipse.org/', - 'marketplace.eclipse.org' => 'https://marketplace.eclipse.org', - ); - - $redirect = 'https://www.eclipse.org/'; - - foreach ($eclipse_domains as $key => $value) { - if (strpos($referer, $key)){ - $redirect = $value; - break; - } - } - - // Destroy the session for the user. - // Bug 443883 - [site_login] Password change should invalidate all active sessions - if ($this->Session->isLoggedIn()) { - $this->Session->destroy(TRUE); - $this->messages['logout']['info'][] = 'You have been logged out.'; - } - else{ - $this->messages['logout']['danger'][] = 'You are currently not logged in.'; - $redirect = 'https://dev.eclipse.org/site_login/'; - } - - return $redirect; - } - - public function password_update() { - $this->messages['logout']['success'][] = "Your account details have been updated successfully."; - $this->messages['logout']['warning'][] = 'Please login to confirm your new password.'; - } - - public function showCountries() { - $options = ""; - $continents = $this->_fetchcontinents(); - $countries = $this->_fetchCountries(); - - foreach ($continents as $continent) { - $options .= '<optgroup label="'. $continent .'">'; - foreach ($countries as $country) { - if ($country['continent'] == $continent) { - $selected = ""; - if (!empty($this->country) && $this->country == $country['ccode']) { - $selected = "selected"; - } - $options .= '<option value="'. $country['ccode'] .'" ' . $selected.'>'. $country['description'] .'</option>'; - } - } - $options .= '</optgroup>'; - } - return $options; - } - - function verifyUserStatus() { - # bug 432822 - if someone is already logged in, send them to their account info page - if (empty($this->takemeback)) { - $this->takemeback = 'myaccount.php'; - } - if ($this->Session->getGID() != "") { - header("Location: " . $this->takemeback, 302); - exit; - } - } - - /** - * Validate takemeback Url - * - * Bug 421097 - * @return boolean - */ - public function validateTakemebackUrl($takemeback = "") { - if ($takemeback == "") { - $takemeback = $this->takemeback; - } - - $domains = array( - 'eclipse.org', - 'planeteclipse.org', - 'locationtech.org', - 'polarsys.org', - 'eclipse.local' - ); - - foreach ($domains as $d) { - if (preg_match('#^(http(s)?:\/\/)(www\.)?([\w+0-9-]{0,}\.)?' . $d . '(:\d{1,5})?(\/)?#', $takemeback) && - strpos($takemeback, $d . ".") === FALSE){ - return TRUE; - break; - } - } - return FALSE; - } - - private function _confirmAccount() { - $sql = "SELECT /* USE MASTER */ COUNT(1) AS RecordCount - FROM account_requests - WHERE token IN ('TOKEN_FAILED', 'CONFIRM_SUCCESS') - AND ip = " . $this->App->returnQuotedString($_SERVER['REMOTE_ADDR']); - $rs = $this->App->eclipse_sql($sql); - $myrow = mysql_fetch_assoc($rs); - if ($myrow['RecordCount'] > 0) { - $this->messages['confirm']['danger'][] = "<b>You have already submitted a request. Please check your email inbox and spam folders to respond to the previous request.</b> (8728s)"; - } - else { - if ($this->t != "") { - $sql = "SELECT /* USE MASTER */ email, fname, password, lname, COUNT(1) AS RecordCount FROM account_requests WHERE token = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->t)); - $rs = $this->App->eclipse_sql($sql); - $myrow = mysql_fetch_assoc($rs); - if ($myrow['RecordCount'] <= 0) { - $this->messages['confirm']['danger'][] = "We were unable to validate your request. The supplied token is invalid; perhaps it has expired? Please try creating your account again, and contact webmaster@eclipse.org if the problem persists. (8729s)"; - # If we can't find a record, insert a record preventing this dude from bombing us - $this->t = $this->App->getAlphaCode(64); - $this->App->eclipse_sql("INSERT INTO account_requests VALUES (" . $this->App->returnQuotedString($this->App->sqlSanitize($this->t)) . ", - '', - 'token_failed', - 'token_failed', - 'token_failed', - " . $this->App->returnQuotedString($_SERVER['REMOTE_ADDR']) . ", - NOW(), - 'TOKEN_FAILED')" - ); - $EventLog = new EvtLog(); - $EventLog->setLogTable("__ldap"); - $EventLog->setPK1($this->App->sqlSanitize($this->t)); - $EventLog->setPK2($_SERVER['REMOTE_ADDR']); - $EventLog->setLogAction("ACCT_CREATE_TOKEN_FAILED"); - $EventLog->insertModLog("apache"); - } - else { - // New accounts will always have a value in $myrow['password']. - $token_confirm = 'CONFIRM_SUCCESS'; - # Update this row, change IP address to reflect that of the person who successfully confirmed this email to avoid bombing - $sql = "UPDATE account_requests SET token = ". $this->App->returnQuotedString($this->App->sqlSanitize($token_confirm)) .", ip = " . $this->App->returnQuotedString($this->App->sqlSanitize($_SERVER['REMOTE_ADDR'])) - . " WHERE token = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->t)); - $rs = $this->App->eclipse_sql($sql); - - $this->messages['confirm']['success'][] = "Thank you for confirming your email address. - Your Eclipse.org account is now active and you may now </strong>log in</strong></a>. - Please note that some Eclipse.org pages may require you to provide your login - credentials."; - - $EventLog = new EvtLog(); - $EventLog->setLogTable("__ldap"); - $EventLog->setPK1($this->App->sqlSanitize($this->t)); - $EventLog->setPK2($_SERVER['REMOTE_ADDR']); - $EventLog->setLogAction("ACCT_CREATE_CONFIRM"); - $EventLog->insertModLog($myrow['email']); - } - } - else { - $this->messages['confirm']['danger'][] = "We were unable to validate your request. The supplied token is invalid. Please contact webmaster@eclipse.org."; - } - } - } - - private function _createAccount() { - if ($this->username != "" && $this->fname != "" && $this->lname != "" && $this->password1 != "") { - 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"; - $mail .= "Email: " . $this->username . "\n\n"; - $mail .= "First name: " . $this->fname . "\n\n"; - $mail .= "Last name: " . $this->lname . "\n\n"; - - $mail .= "Organization: " . $this->organization. "\n\n"; - $mail .= "Country: " . $this->country. "\n\n"; - $mail .= "Remote addr: " . $_SERVER['REMOTE_ADDR'] . "\n\n"; - $mail .= "Browser: " . $_SERVER['HTTP_USER_AGENT'] . "\n\n"; - $mail .= "Referer: " . $_SERVER['HTTP_REFERER'] . "\n\n"; - - $mail .= " -- Eclipse webdev\n"; - $headers = 'From: Eclipse Webmaster (automated) <webmaster@eclipse.org>' . "\n" . 'Content-Type: text/plain; charset=UTF-8'; - mail('webmaster@eclipse.org', "Denied Account: Possible spammer", $mail, $headers); - return FALSE; - } - - // Select entries that are only created on an account creation - $sql = "SELECT /* USE MASTER */ email - FROM account_requests - WHERE ip = " . $this->App->returnQuotedString($_SERVER['REMOTE_ADDR']) . " - AND fname NOT IN ('MAILCHANGE','RESET') - AND lname NOT IN ('MAILCHANGE','RESET') - AND password = '' - AND new_email = '' - AND token NOT IN ('CLA_SIGNED','CLA_INVALIDATED','TOKEN_FAILED')"; - $rs = $this->App->eclipse_sql($sql); - - $list_of_emails = array(); - while ($row = mysql_fetch_array($rs)) { - $list_of_emails[] = $row['email']; - } - - // Check if there are more than 25 request coming from the same ip address - if (count($list_of_emails) >= 25) { - $this->messages['create']['danger'][] = "You have already submitted a request. Please check your email inbox and spam folders to respond to the previous request. (8723s)"; - } - - // Check if there are more than one request from the same email address - if (!empty($list_of_emails) && in_array($this->username, $list_of_emails)) { - $this->messages['create']['danger'][] = "You have already submitted a request. Please check your email inbox and spam folders to respond to the previous request. (8724s)"; - } - - // If there are no errors, we can insert in the account_request table - if (empty($this->messages['create']['danger'])) { - # Check LDAP - if(!$this->Ldapconn->checkEmailAvailable($this->username)) { - $this->messages['create']['danger'][] = "That account already exists. If you cannot remember your password, please use the password reset option below. (8725s)"; - # Jot this down to avoid repetitively polling ldap - $this->App->eclipse_sql("INSERT INTO account_requests VALUES (" . $this->App->returnQuotedString($this->App->sqlSanitize($this->username)) . ", - '', - " . $this->App->returnQuotedString($this->App->sqlSanitize($this->fname)) . ", - " . $this->App->returnQuotedString($this->App->sqlSanitize($this->lname)) . ", - '', - " . $this->App->returnQuotedString($_SERVER['REMOTE_ADDR']) . ", - NOW(), - " . $this->App->returnQuotedString("CREATE_FAILED") . ")"); - - $EventLog = new EvtLog(); - $EventLog->setLogTable("__ldap"); - $EventLog->setPK1($this->username); - $EventLog->setPK2($_SERVER['REMOTE_ADDR']); - $EventLog->setLogAction("ACCT_CREATE_ALREADY_EXISTS"); - $EventLog->insertModLog("apache"); - } - else { - if ($this->agree != 1) { - $this->messages['create']['danger'][] = "- You must agree to the terms and contitions of use<br />"; - } - - if (!preg_match(SITELOGIN_EMAIL_REGEXP, $this->username)) { - $this->messages['create']['danger'][] = "- Your email address is not formatted correctly<br />"; - } - - if (!$this->Captcha->validate()) { - $this->messages['create']['danger'][] = "- You haven't answered the captcha question correctly<br />"; - } - if (!preg_match("/(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/", $this->password1)) { - $this->messages['create']['danger'][] = "- Your password does not meet the complexity requirements. It must be at least 6 characters long, and contain one number or one symbol.<br />"; - } - - if (!$cryptopass = $this->_generateCryptotext($this->App->sqlSanitize($this->password1))) { - $this->messages['create']['danger'][] = "- An error occurred while processing your request. (8730s)"; - } - - if (empty($this->country)) { - $this->messages['create']['danger'][] = "- You must select your country of residence."; - } - - if (empty($this->messages['create']['danger'])) { - # Add request to database - $this->t = $this->App->getAlphaCode(64); - $this->App->eclipse_sql("INSERT INTO account_requests VALUES (" . $this->App->returnQuotedString($this->App->sqlSanitize(trim($this->username))) . ", - '', - " . $this->App->returnQuotedString($this->App->sqlSanitize(trim($this->fname))) . ", - " . $this->App->returnQuotedString($this->App->sqlSanitize(trim($this->lname))) . ", - '" . $cryptopass . "', - " . $this->App->returnQuotedString($_SERVER['REMOTE_ADDR']) . ", - NOW(), - " . $this->App->returnQuotedString($this->t) . ")"); - - - $this->App->eclipse_sql("INSERT INTO users_profiles - (user_uid,user_mail,user_country,user_org,user_status) - VALUES ( - ". $this->App->returnQuotedString($this->App->sqlSanitize($this->t)) .", - ". $this->App->returnQuotedString($this->App->sqlSanitize($this->username)) .", - ". $this->App->returnQuotedString($this->App->sqlSanitize($this->country)) .", - ". $this->App->returnQuotedString($this->App->sqlSanitize($this->organization)) .", - 0 - )" - ); - - if ($this->newsletter_status === 'subscribe') { - $Subscriptions = $this->App->getSubscriptions(); - $Subscriptions->setFirstName($this->fname); - $Subscriptions->setLastName($this->lname); - $Subscriptions->setEmail($this->username); - $Subscriptions->addUserToList(); - } - - $EventLog = new EvtLog(); - $EventLog->setLogTable("__ldap"); - $EventLog->setPK1($this->t); - $EventLog->setPK2($_SERVER['REMOTE_ADDR']); - $EventLog->setLogAction("ACCT_CREATE_REQ_SUCCESS"); - $EventLog->insertModLog($this->username); - - # Send mail to dest - $mail = "Dear $this->fname,\n\n"; - $mail .= "Thank you for registering for an account at Eclipse.org. Before we can activate your account one last step must be taken to complete your registration.\n\n"; - $mail .= "To complete your registration, please visit this URL:\nhttps://dev.eclipse.org/site_login/token.php?stage=confirm&t=$this->t\n\n"; - $mail .= "Your Username is: $this->username\n\n"; - $mail .= "If you have any problems signing up please contact webmaster@eclipse.org\n\n"; - $mail .= " -- Eclipse webmaster\n"; - $headers = 'From: Eclipse Webmaster (automated) <webmaster@eclipse.org>' . "\n" . 'Content-Type: text/plain; charset=UTF-8'; - mail($this->username, "Eclipse Account Registration", $mail, $headers); - - # Debug - //print $mail; - - $this->messages['create']['success'][] = "<p>Welcome to the Eclipse.org community! We've sent a confirmation to the email address - you have provided. In that email there are instructions you must follow in order to activate your account.</p> - <p>If you have not received the email within a few hours, and you've made sure it's not in your Junk, Spam or trash folders, please contact webmaster@eclipse.org</p>"; - } - else { - $this->messages['create']['danger'][] = "An error occurred while processing your request. Please ensure that all the required fields are entered correctly and try again. (5496s)"; - } - } - } - } - else { - $this->messages['create']['danger'][] = "An error occurred while processing your request. Please ensure that all the required fields are entered correctly and try again. (8726s)"; - } - } - - private function _generateBugzillaSHA256Password($_password) { - $cp = 0; - if ($_password != "") { - # Generate random salt - $hash = "{SHA-256}"; - $salt = $this->App->getAlphaCode(8); - $cp = str_replace("=", "", $salt . base64_encode(hash("sha256", $_password . $salt, true))) . $hash; - } - return $cp; - } - - private function _generateCryptotext($plaintext) { - if (empty($plaintext) || !is_readable($this->path_public_key)) { - return FALSE; - } - - #load public key - $fp = fopen($this->path_public_key, "r"); - $pub_key = fread($fp, 8192); - fclose($fp); - - $key = openssl_pkey_get_public($pub_key); - openssl_public_encrypt($plaintext, $cryptotext, $key, OPENSSL_PKCS1_OAEP_PADDING); - - #encode the output - return base64_encode($cryptotext); - } - - private function _generatePassword($_num_chars) { - $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1023456789,.;:/@#$%^&*()-_=+"; - srand((double)microtime()*1000000); - $loopcount = 0; - $rValue = ""; - while (!preg_match("/(?=^.{6,}$)(?=.*\d)(?=.*[A-Za-z]).*$/", $rValue)) { - $rValue = ""; - $i = 0; - $loopcount++; - srand((double)microtime()*1000000); - while ($i <= $_num_chars) { - $num = rand() % strlen($chars); - $rValue .= substr($chars, $num, 1); - $i++; - } - # antilooper - if($loopcount > 1000) { - $rValue = "aA1$" . $this->App->getAlphaCode(4); - } - } - return $rValue; - } - - private function _getMessageContainer($message = '', $type = 'alert') { - $class = "alert alert-" . $type; - return '<div class="' . $class . '" role="alert">' . $message . '</div>'; - } - - private function _get_default_field_value($id, $value, $default_values = TRUE) { - // If the value is not empty and the user is not requesting the default values, - // return the updated values. - if (!empty($value) && $default_values === FALSE) { - return $value; - } - - switch ($id) { - case 'fname': - return $this->Friend->getFirstName(); - break; - - case 'lname': - return $this->Friend->getLastName(); - break; - - case 'username': - return $this->Friend->getEmail(); - break; - - case 'githubid': - return $this->Ldapconn->getGithubIDFromMail($this->Friend->getEmail()); - break; - } - } - - private function _get_profile_from_token($token = NULL){ - if (empty($token)) { - return FALSE; - } - $sql = "SELECT /* USE MASTER */ - user_org as organization, user_jobtitle as jobtitle, user_bio as bio, user_interests as interests, user_website as website, user_twitter_handle as twitter_handle, user_country as country - FROM users_profiles - WHERE user_uid = " . $this->App->returnQuotedString($token) . " - ORDER BY user_update DESC LIMIT 1"; - $rs = $this->App->eclipse_sql($sql); - $profile = mysql_fetch_assoc($rs); - - if (!empty($profile)) { - foreach ($profile as $key => $value) { - if (is_null($value)) { - $value = ""; - } - $this->{$key} = $value; - } - return TRUE; - } - return FALSE; - } - - private function _get_default_profile_fields($get_default_values = FALSE){ - - // Making sure we don't have an empty user_uid to avoid pre-populating - // the account creation fields with an empty user_uid - if (empty($this->user_uid)) { - return FALSE; - } - - if (empty($this->messages['profile']['danger'])) { - $sql = "SELECT /* USE MASTER */ - user_org as organization, user_jobtitle as jobtitle, user_bio as bio, user_interests as interests, user_website as website, user_twitter_handle as twitter_handle, user_country as country - FROM users_profiles - WHERE user_uid = " . $this->App->returnQuotedString($this->user_uid) . " - ORDER BY user_update DESC LIMIT 1"; - $rs = $this->App->eclipse_sql($sql); - $profile = mysql_fetch_assoc($rs); - - $this->profile_default = $profile; - if ($get_default_values) { - return TRUE; - } - - if (!empty($profile)) { - foreach ($profile as $key => $value) { - if (is_null($value)) { - $value = ""; - } - $this->{$key} = $value; - } - } - } - } - - private function _getProfileDefaultValues(){ - if (empty($this->profile_default)) { - $this->_get_default_profile_fields(TRUE); - } - return $this->profile_default; - } - - private function _processSaveProfile() { - if (!$this->FormToken->verifyToken($_POST['token-update-profile']) || !empty($_POST['profile-name-req'])) { - //token verification failed or expected empty field wasn't empty - return FALSE; - } - if ($this->password_expired === TRUE) { - $this->messages['password_expired']['danger'][] = "You need to set a new password before you can update your profile."; - return FALSE; - } - $fname = $this->_get_default_field_value('fname', $this->fname, FALSE); - $lname = $this->_get_default_field_value('lname', $this->lname, FALSE); - - $default_values = $this->_getProfileDefaultValues(); - $default_org = $default_values['organization']; - - $fields = array( - 'user_uid' => $this->user_uid, - 'user_mail' => $this->user_mail, - 'user_org' => $this->organization, - 'user_jobtitle' => $this->jobtitle, - 'user_website' => $this->website, - 'user_bio' => $this->bio, - 'user_interests' => $this->interests, - 'user_twitter_handle' => $this->twitter_handle, - 'user_country' => $this->country, - ); - - $possible_null_field = array( - 'user_org', - 'user_jobtitle', - 'user_website', - 'user_bio', - 'user_interests', - 'user_twitter_handle', - ); - - # Validate values - if (empty($fields['user_uid']) || !is_string($fields['user_uid'])) { - $this->messages['profile']['danger'][] = 'Invalid user id<br>'; - } - if (!empty($fields['user_website']) && !filter_var($fields['user_website'], FILTER_VALIDATE_URL)) { - $this->messages['profile']['danger'][] = 'Invalid website URL<br>'; - } - if (empty($fields['user_country']) && !in_array($fields['user_country'], $this->getCountryList())) { - $this->messages['profile']['danger'][] = 'You must enter a valid country<br>'; - } - - if (!empty($this->messages['profile']['danger'])) { - return FALSE; - } - - //if they are a committer and have changed employers toss all changes and throw a warning + send a message - if ($this->is_committer) { - if ($default_org !== $fields["user_org"]) { - if ($this->changed_employer === 'Yes') { - // Send mail to dest - $this->_sendNotice(); - $this->messages['myaccount']['danger'][] = "You have indicated a change in employer. As such any changes you made have not been saved. A notice has been sent to you and EMO legal (emo-records@eclipse.org) so that they can advise what paperwork(if any) needs to be updated."; - //exit - return FALSE; - } - else if ($this->changed_employer !== "No") { - $this->messages['myaccount']['danger'][] = "You must indicate if you have changed employers in order to save changes to your organization."; - return FALSE; - } - } else { - if ($this->changed_employer === 'Yes') { - // Send mail to dest - $this->_sendNotice(); - $this->messages['myaccount']['danger'][] = "A notice has been sent to you and EMO legal (emo-records@eclipse.org) so that they can advise what paperwork (if any) needs to be updated due to your change in employers."; - } - } - } - - foreach ($possible_null_field as $value) { - if (empty($fields[$value])) { - $fields[$value] = NULL; - } - } - - $sql = "INSERT INTO users_profiles ("; - $columns = array(); - $values = array(); - foreach ($fields as $key => $value) { - if (!empty($value)) { - $columns[] = $key; - $values[] = '"' . $this->App->sqlSanitize($value) . '"'; - } - else if(in_array($key, $possible_null_field)) { - $columns[] = $key; - $values[] = 'NULL'; - } - } - $sql .= implode(',', $columns); - $sql .= ') VALUES ('; - $sql .= implode(',', $values); - $sql .= ") ON DUPLICATE KEY UPDATE"; - foreach ($columns as $key => $value){ - $sql .= ' ' .$value . '=' . $values[$key] . ','; - } - $sql = rtrim($sql, ','); - $this->App->eclipse_sql($sql); - $this->messages['profile']['success'][] = 'Your profile have been updated successfully.'; - - } - - private function _processSave() { - if (!$this->FormToken->verifyToken($_POST['token-edit-account']) || !empty($_POST['edit-account-email-req'])) { - //token verification failed or expected empty field wasn't empty - return FALSE; - } - // Check IF the password is expired - // AND if the user is NOT trying to change the password - if ($this->password_expired === TRUE && (empty($this->password1) && empty($this->password2))) { - $this->messages['password_expired']['danger'][] = "You need to set a new password before you can update your Account Settings."; - $this->getVariables("welcomeback"); - return FALSE; - } - - $user_is_changing_password = FALSE; - if ($this->username != "" && $this->fname != "" && $this->lname != "" && $this->password != "") { - # update account. - # we must first bind to ldap to be able to change attributes - $dn = $this->Ldapconn->authenticate($this->Friend->getEmail(), $this->password); - if ($dn) { - #work out what's changed - $fname_changed = ($this->Ldapconn->getLDAPAttribute($dn, "givenName") !== $this->fname) ? TRUE : FALSE ; - $lname_changed = ($this->Ldapconn->getLDAPAttribute($dn, "sn") !== $this->lname) ? TRUE : FALSE ; - $email_changed = ($this->Ldapconn->getLDAPAttribute($dn, "mail") !== $this->username) ? TRUE : FALSE ; - - //if they are a committer and have changed employers toss all changes and throw a warning + send a message - if ($this->is_committer && $this->changed_employer === 'Yes') { - // Send mail to dest - $this->_sendNotice(); - //notify the user - if ( !$lname_changed && !$email_changed) { - //I guess they just want us to know they've changed employers - $this->messages['myaccount']['danger'][] = "A notice has been sent to you and EMO legal (emo-records@eclipse.org) so that they can advise what paperwork(if any) needs to be updated due to your change in employers."; - } - else { - //they've changed something - $this->messages['myaccount']['danger'][] = "You have indicated a change in employer. As such any changes you made have not been saved. A notice has been sent to you and EMO legal (emo-records@eclipse.org) so that they can advise what paperwork(if any) needs to be updated."; - } - //reset form data - $this->getVariables("welcomeback"); - //return - return; - } - - $update_bz_name = FALSE; - if ($fname_changed) { - $this->Ldapconn->changeAttributeValue($dn, $this->password, "givenName", $this->fname); - $this->Friend->setFirstName($this->fname); - $update_bz_name = TRUE; - } - - if ($lname_changed) { - if ($this->changed_employer === 'No' || !$this->is_committer) { - $this->Ldapconn->changeAttributeValue($dn, $this->password, "sn", $this->lname); - $this->Friend->setLastName($this->lname); - $update_bz_name = TRUE; - $this->_sendNotice("surname", "to: " . $this->lname); - } else if($this->is_committer && empty($this->changed_employer)) { - $this->messages['myaccount']['danger'][] = "You must indicate if you have changed employers in order to save changes to your last name."; - return; - - } - } - - //if either the first or last name has changed the cn should be updated. - if ($fname_changed || $lname_changed) { - $this->Ldapconn->changeAttributeValue($dn, $this->password, "cn", $this->fname . " " . $this->lname); - $update_bz_name = TRUE; - } - - if ($update_bz_name) { - $this->App->bugzilla_sql("SET NAMES 'utf8'"); - $sql = "UPDATE profiles SET realname='" . $this->App->sqlSanitize($this->fname . " " . $this->lname) . "' WHERE login_name = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->username)) . " LIMIT 1"; - $this->App->bugzilla_sql($sql); - $this->Session->updateSessionData($this->Friend); - } - - # Update GitHub ID? - if ($this->githubid != "") { - $oldgithubid = $this->Ldapconn->getGithubIDFromMail($this->Friend->getEmail()); - - # we can't change GH ID's automagically - if ($oldgithubid != "") { - $this->messages['myaccount']['danger'][] = "- Your GitHub ID cannot be changed from this form. Please contact webmaster@eclipse.org to update your GitHub ID.<br />"; - } - else { - $this->Ldapconn->setGithubID($dn, $this->password, $this->githubid); - $this->messages['myaccount']['success'][] = "Your github id was saved successfully."; - } - } - - # User is trying to update change is password - if (!empty($this->password1) && !empty($this->password2)) { - if (!preg_match("/(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/", $this->password1)) { - $this->messages['myaccount']['danger'][] = "- Your password does not meet the complexity requirements. It must be at least 6 characters long, and contain one number or one symbol.<br />"; - } - else { - if ($this->password != $this->password1) { - $user_is_changing_password = TRUE; - $this->Ldapconn->changePassword($dn, $this->password, $this->password1); - $bzpass = &$this->_generateBugzillaSHA256Password($this->password1); - $sql = "UPDATE profiles SET cryptpassword='" . $this->App->sqlSanitize($bzpass) . "' WHERE login_name = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->username)) . " LIMIT 1"; - $this->App->bugzilla_sql($sql); - $this->App->ipzilla_sql($sql); - $this->messages['myaccount']['success'][] = "Your password was updated successfully."; - } - // If the user is trying to update password with the current password - else{ - $this->messages['myaccount']['danger'][] = "- Your new password must be different than your current password."; - } - } - } - - # if email address has changed, we must update Bugzilla DB record too. - $oldmail = $this->Ldapconn->getLDAPAttribute($dn, "mail"); - $mailmsg = ""; - if($email_changed) { - #Not a committer or didn't change employers? - if (!$this->is_committer || $this->changed_employer === 'No') { - if (!$this->Ldapconn->checkEmailAvailable($this->username)) { - $this->messages['myaccount']['danger'][] = "- Unable to change your email address<br />"; - } - elseif (!preg_match(SITELOGIN_EMAIL_REGEXP, $this->username)) { - $this->messages['myaccount']['danger'][] = "- Your email address is not formatted correctly<br />"; - } - else { - $sql = "SELECT /* USE MASTER */ email - FROM account_requests - WHERE ip = " . $this->App->returnQuotedString($_SERVER['REMOTE_ADDR']) . " - AND fname = 'MAILCHANGE' - AND lname = 'MAILCHANGE'"; - $rs = $this->App->eclipse_sql($sql); - - $list_of_emails = array(); - while ($row = mysql_fetch_array($rs)) { - $list_of_emails[] = $row['email']; - } - - // Check if there are more than 3 request coming from the same ip address - if (count($list_of_emails) > 3) { - $this->messages['myaccount']['danger'][] = "<b>You have already submitted a request. Please check your email inbox and spam folders to respond to the previous request.</b>"; - } - - // Check if there are more than one request from the same email address - if (!empty($list_of_emails) && in_array($this->username, $list_of_emails)) { - $this->messages['myaccount']['danger'][] = "<b>You have already submitted a request. Please check your email inbox and spam folders to respond to the previous request.</b>"; - } - - if (empty($this->messages['myaccount']['danger'])) { - # Toss in a request to change the email address - $this->messages['myaccount']['success'][] = " Please check your Inbox for a confirmation email with instructions to complete the email address change. Your email address will not be updated until the process is complete."; - $this->t = $this->t = $this->App->getAlphaCode(64); - $sql = "INSERT INTO account_requests (email,new_email,fname,lname,password,ip,req_when,token)VALUES (" . $this->App->returnQuotedString($oldmail) . ", - " . $this->App->returnQuotedString($this->App->sqlSanitize($this->username)) . ", - " . $this->App->returnQuotedString("MAILCHANGE") . ", - " . $this->App->returnQuotedString("MAILCHANGE") . ", - '', - " . $this->App->returnQuotedString($_SERVER['REMOTE_ADDR']) . ", - NOW(), - " . $this->App->returnQuotedString($this->t) . ")"; - $this->App->eclipse_sql($sql); - - # Send mail to dest - $mail = "You (or someone pretending to be you) has changed their Eclipse.org account email address to this one (" . $this->App->sqlSanitize($this->username) . ") from this IP address:\n"; - $mail .= " " . $_SERVER['REMOTE_ADDR'] . "\n\n"; - $mail .= "To confirm this email change, please click the link below:\n"; - $mail .= " https://dev.eclipse.org/site_login/token.php?stage=confirm&t=$this->t\n\n"; - $mail .= "If you have not issued this request, you can safely ignore it.\n\n"; - $mail .= " -- Eclipse webmaster\n"; - $headers = 'From: Eclipse Webmaster (automated) <webmaster@eclipse.org>'; - mail($this->username, "Eclipse Account Change", $mail, $headers); - //notify EMO - $this->_sendNotice("Email address","from: " . $oldmail . " to: " . $this->username ); - } - } - } - else if ($this->is_committer && $this->changed_employer === "") { - $this->messages['myaccount']['danger'][] = "You must indicate if you have changed employers in order to save changes to your email address."; - return; - } - } - - - if (empty($this->messages['myaccount']['danger'])) { - $this->messages['myaccount']['success'][] = "Your account details have been updated successfully." . $mailmsg . ""; - if ($user_is_changing_password) { - header("Location: https://dev.eclipse.org/site_login/logout.php?password_update=1", 302); - } - } - } - else { - $this->messages['myaccount']['danger'][] = "Your current password is incorrect."; - } - } - else { - $this->messages['myaccount']['danger'][] = "Please ensure that all the required fields are entered correctly and try again."; - } - } - - private function _resetPassword() { - if (!$this->FormToken->verifyToken($_POST['token-password-recovery']) || !empty($_POST['recover-account-email-req'])) { - //token verification failed or expected empty field wasn't empty - return FALSE; - } - # reset stage 1. We got an email address, create token and email to user - # make sure someone isn't blasting us. We disregard "token failed" since a common use-case - # is to click the reset link after it has expired. - $sql = "SELECT /* USE MASTER */ email - FROM account_requests - WHERE token <> 'TOKEN_FAILED' - AND fname = 'RESET' - AND lname = 'RESET' - AND ip = " . $this->App->returnQuotedString($_SERVER['REMOTE_ADDR']); - $rs = $this->App->eclipse_sql($sql); - - $list_of_emails = array(); - while ($row = mysql_fetch_array($rs)) { - $list_of_emails[] = $row['email']; - } - - // Check if a valid email has been provided - if (!preg_match(SITELOGIN_EMAIL_REGEXP, $this->username)) { - $this->messages['reset']['danger'][] = "<b>Your email address is not formatted correctly.</b><br />"; - } - - // Check if the provided email is in LDAP - if ($this->Ldapconn->checkEmailAvailable($this->username)) { - $this->messages['reset']['danger'][] = "<b>We were unable to determine your identity with the information you've supplied.</b> Perhaps you don't have an Eclipse.org account, or your account is under a different email address.(8x27s)"; - } - - // Check if there are more than 13 request coming from the same ip address - if (count($list_of_emails) >= 13) { - $this->messages['reset']['danger'][] = "<b>We were unable to determine your identity after several attempts. Subsequent inquiries will be ignored for our protection. Please try later, or contact webmaster@eclipse.org for support.</b> (8727s)"; - } - - // Check if there are more than one request from the same email address - if (!empty($list_of_emails) && in_array($this->username, $list_of_emails)) { - $this->messages['reset']['danger'][] = "<b>There's already a reset password request associated to this email address. Please try later, or contact webmaster@eclipse.org for support.</b> (8728s)"; - } - - // If there are no errors we can proceed - if (empty($this->messages['reset']['danger'])) { - # Check to see if we're trying to reset the password of a valid account. - $this->t = $this->App->getAlphaCode(64); - $this->App->eclipse_sql("INSERT IGNORE INTO account_requests VALUES (" . $this->App->returnQuotedString($this->App->sqlSanitize($this->username)) . ", - '', - " . $this->App->returnQuotedString("RESET") . ", - " . $this->App->returnQuotedString("RESET") . ", - '', - " . $this->App->returnQuotedString($_SERVER['REMOTE_ADDR']) . ", - NOW(), - " . $this->App->returnQuotedString($this->t) . ")"); - - # Send mail to dest - $mail = "You (or someone pretending to be you) has requested a password reset from:\n"; - $mail .= " " . $_SERVER['REMOTE_ADDR'] . "\n\n"; - $mail .= "To change your password, please visit this URL:\nhttps://dev.eclipse.org/site_login/token.php?p=p&t=$this->t\n\n"; - $mail .= "If you have not requested this change, you can safely let it expire. If you have any problems signing in please contact webmaster@eclipse.org\n\n"; - $mail .= " -- Eclipse webmaster\n"; - $headers = 'From: Eclipse Webmaster (automated) <webmaster@eclipse.org>'; - mail($this->username, "Eclipse Account Password Reset", $mail, $headers); - $this->messages['reset']['success'][] = '<strong>Password Recovery:</strong> A token has been emailed to you to allow - you to reset your Eclipse.org password. Please check your Trash and Junk/Spam - folders if you do not see this email in your inbox.'; - - # Debug - //print $mail; - - $EventLog = new EvtLog(); - $EventLog->setLogTable("__ldap"); - $EventLog->setPK1($this->t); - $EventLog->setPK2($_SERVER['REMOTE_ADDR']); - $EventLog->setLogAction("PASSWD_RESET_REQ"); - $EventLog->insertModLog($this->username); - } - } - - private function _resetPassword2() { - # reset stage 2. We got an token back. If we find a record, allow user to reset password, then proceed to stage3 - if($this->t != "") { - $sql = "SELECT /* USE MASTER */ email, COUNT(1) AS RecordCount FROM account_requests WHERE token = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->t)); - $rs = $this->App->eclipse_sql($sql); - $myrow = mysql_fetch_assoc($rs); - if($myrow['RecordCount'] <= 0) { - $this->exipred_pass_token = TRUE; - $this->_setStage('reset'); - $this->messages['reset2']['danger'][] = "<b>The supplied reset token is invalid; perhaps it has expired? Please wait 5 minutes and try to <a href='password_recovery.php'>reset your password again</a>. If the problem persits, please contact webmaster@eclipse.org.</b> (8129rs)"; - # If we can't find a record, insert a record preventing this dude from bombing us - $this->t = $this->App->getAlphaCode(64); - $this->App->eclipse_sql("INSERT INTO account_requests VALUES (" . $this->App->returnQuotedString($this->App->sqlSanitize($this->t)) . ", - '', - 'token_failed', - 'token_failed', - 'token_failed', - " . $this->App->returnQuotedString($_SERVER['REMOTE_ADDR']) . ", - NOW(), - 'TOKEN_FAILED')" - ); - } - else { - # display password reset page. - $EventLog = new EvtLog(); - $EventLog->setLogTable("__ldap"); - $EventLog->setPK1($this->t); - $EventLog->setPK2($_SERVER['REMOTE_ADDR']); - $EventLog->setLogAction("PASSWD_RESET_CONF"); - $EventLog->insertModLog($myrow['email']); - } - } - } - - private function _resetPassword3() { - if (!$this->FormToken->verifyToken($_POST['token-password-reset']) || !empty($_POST['reset-account-email-req'])) { - //token verification failed or expected empty field wasn't empty - return FALSE; - } - # reset stage 3. We got a token back, and user is submitting a password. - if ($this->t != "" && $this->password1 != "" ) { - if ($this->password1 != $this->password2) { - $this->messages['reset3']['danger'][] = "Submitted passwords don't match."; - $this->_setStage('reset2'); - return FALSE; - } - - if (!$this->Captcha->validate()) { - $this->messages['reset3']['danger'][] = "- You haven't answered the captcha question correctly<br />"; - $this->_setStage('reset2'); - return FALSE; - } - - $sql = "SELECT /* USE MASTER */ email, COUNT(1) AS RecordCount FROM account_requests WHERE token = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->t)); - $rs = $this->App->eclipse_sql($sql); - $myrow = mysql_fetch_assoc($rs); - if ($myrow['RecordCount'] <= 0) { - $this->messages['reset3']['danger'][] = "We were unable to validate your request. The supplied token is invalid; perhaps it has expired? Please try to <a href='createaccount.php'>reset your password again</a>. If the problem persits, please contact webmaster@eclipse.org. (8329rs)"; - $this->_setStage('reset2'); - # If we can't find a record, insert a record preventing this dude from bombing us - $this->t = $this->App->getAlphaCode(64); - $this->App->eclipse_sql("INSERT INTO account_requests VALUES (" . $this->App->returnQuotedString($this->App->sqlSanitize($this->t)) . ", - '', - 'token_failed', - 'token_failed', - 'token_failed', - " . $this->App->returnQuotedString($_SERVER['REMOTE_ADDR']) . ", - NOW(), - 'TOKEN_FAILED')" - ); - } - else { - if (!preg_match("/(?=^.{6,}$)(?=.*\d)(?=.*[A-Za-z]).*$/", $this->password1)) { - $this->messages['reset3']['danger'][] = "- Your password does not meet the complexity requirements<br />"; - $this->_setStage('reset2'); - } - elseif ($cryptopass = $this->_generateCryptotext($this->App->sqlSanitize($this->password1))) { - # Update this row, change IP address to reflect that of the person who successfully confirmed this password to avoid bombing - $sql = "UPDATE account_requests SET token = 'PASSWORD_SUCCESS', password='" . $cryptopass . "', ip = " . $this->App->returnQuotedString($this->App->sqlSanitize($_SERVER['REMOTE_ADDR'])) - . " WHERE token = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->t)); - $rs = $this->App->eclipse_sql($sql); - - $bzpass = &$this->_generateBugzillaSHA256Password($this->password1); - $sql = "UPDATE profiles SET cryptpassword='" . $this->App->sqlSanitize($bzpass) . "' WHERE login_name = " . $this->App->returnQuotedString($this->App->sqlSanitize($myrow['email'])) . " LIMIT 1"; - $this->App->bugzilla_sql($sql); - $this->App->ipzilla_sql($sql); - - $this->messages['reset']['success'][] = '<strong>Password Recovery:</strong> Your password was reset. You may now <a href="/site_login/index.php">log in</a>. Please note that some Eclipse.org sites, such as Bugzilla, Wiki or Forums, may ask you to login again with your new password.'; - - $EventLog = new EvtLog(); - $EventLog->setLogTable("__ldap"); - $EventLog->setPK1($this->t); - $EventLog->setPK2($_SERVER['REMOTE_ADDR']); - $EventLog->setLogAction("PASSWD_RESET_SUCCESS"); - $EventLog->insertModLog($myrow['email']); - } - else { - $this->messages['create']['danger'][] = "An error occurred while processing your request. Please ensure that all the required fields are entered correctly and try again. (3543s)"; - } - } - } - else { - $this->_setStage('reset2'); - $this->messages['reset3']['danger'][] = "Please enter a new password."; - return FALSE; - } - } - - private function _sanitizeVariables() { - $inputs = array( - 'agree', - 'githubid', - 'fname', - 'lname', - 'password', - 'p', - 'page', - 'password', - 'password1', - 'password2', - 'password_update', - 'remember', - 'stage', - 'submit', - 'takemeback', - 't', - 'username', - 'organization', - 'jobtitle', - 'website', - 'bio', - 'interests', - 'twitter_handle', - 'changed_employer', - 'country', - 'newsletter_status', - ); - - foreach ($inputs as $field) { - $this->$field = $this->App->getHTTPParameter($field, "POST"); - - if ($field == 'takemeback' || $field == 'website') { - $this->$field = urldecode($this->$field); - } - - if ($field == 'fname' || $field == 'lname') { - $this->$field = preg_replace(SITELOGIN_NAME_REGEXP, '', $this->$field); - } - else if ($field == 't') { - $this->$field = preg_replace("/[^a-zA-Z0-9]/", "", $this->t); - } - else { - $this->$field = preg_replace($this->xss_patterns, '', $this->$field); - } - - // Remove whitespace characters on the githubid field - if ($field == 'githubid') { - $this->$field = preg_replace("/\s+/", "", $this->$field); - } - - # Magic quotes feature is removed from PHP 5.4 but just incase. - if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) { - $this->$field = stripslashes($this->$field); - } - } - - $this->username = trim($this->username); - - if (!is_numeric($this->remember)) { - $this->remember = 0; - } - - # Takemeback processing - $this->referer = ""; - if (isset($_SERVER['HTTP_REFERER'])) { - $this->referer = $_SERVER['HTTP_REFERER']; - } - - # Coming from the Wiki? Redirect to Special:Userlogin to finish processign - if(preg_match('/^(http|https):\/\/(wiki|wikitest)\.eclipse\.org\//', $this->referer, $matches)) { - $location = substr($this->referer, strlen($matches[0])); - #strip 'extra' index data bug 308257 - $location = preg_replace("/index\.php\?title\=/","",$location); - $this->takemeback = $matches[0] . "index.php?title=Special:Userlogin&action=submitlogin&type=login&returnto=" . $location ; - } - - # Forum login process broken with bad redirect - # Bug 430302 - if (preg_match('#^https?://.*eclipse.org/forums/index.php\?t=login#', $this->referer, $matches)) { - $this->takemeback = "https://www.eclipse.org/forums/index.php/l/"; - } - - # Since we use a secure cookie, anything http should be sent back https. - if (preg_match("#^http://(.*)#", $this->takemeback, $matches)) { - $this->takemeback = "https://" . $matches[1]; - } - - if (preg_match('#^https?://dev.eclipse.org/#', $this->takemeback) && !preg_match('#^https?://dev.eclipse.org/site_login/myaccount.php#', $this->takemeback)){ - $this->takemeback = ""; - } - if (!$this->validateTakemebackUrl()) { - $this->takemeback = ""; - } - } - - private function _setStage($stage){ - $possible_values = array( - 'login', - 'create', - 'save', - 'save-profile', - 'reset', - 'reset2', - 'reset3', - 'confirm', - ); - if ($this->t != "" && $stage == "confirm") { - $this->stage = 'confirm'; - } - elseif ($this->exipred_pass_token) { - $this->stage = "reset"; - } - elseif ($this->t == "" && $this->p == "" && $stage == 'password-recovery' && !empty($this->username)) { - $this->stage = "reset"; - } - elseif ($this->t != "" && $this->p == "p" && $stage == 'password-recovery') { - $this->stage = "reset2"; - } - elseif ($this->t != "" && $stage == 'password-recovery') { - $this->stage = "reset3"; - } - elseif (in_array($stage, $possible_values)){ - $this->stage = $stage; - } - } - - private function _sendNotice($changed="", $details=""){ - if ($this->is_committer) { - //do nothing if the changed state isn't yes or no. - if ($this->changed_employer === 'Yes') { - $mail = "Because you have changed employers, you must promptly provide the EMO(emo-records@eclipse.org) with your new employer information.\r\n"; - $mail .= "The EMO will determine what, if any, new legal agreements and/or employer consent forms are required for your committer account to remain active.\r\n\r\n"; - $mail .= " -- Eclipse webmaster\r\n"; - $headers = "From: Eclipse Webmaster (automated) <webmaster@eclipse.org>\r\n"; - $headers .= "CC: EMO-Records <emo-records@eclipse.org>"; - mail($this->user_mail, "Eclipse Account Change", $mail, $headers); - } else if ($this->changed_employer === 'No') { - if ($changed === "" || $details === "" ){ - $mail = "Committer: " . $this->user_uid . "\r\n"; - $mail .= "Has changed something, but details are incomplete. \r\n"; - $mail .= "What changed: " . $changed . " \r\n"; - $mail .= "Details: " . $details . "\r\n\r\n"; - $mail .= "Committer confirms they have NOT changed employers \r\n\r\n"; - } else { - $mail = "Committer: " . $this->user_uid . "\r\n"; - $mail .= "Has changed their " . $changed . " " . $details . "\r\n\r\n"; - $mail .= "Committer confirms they have NOT changed employers \r\n\r\n"; - } - $headers = "From: Eclipse Webmaster (automated) <webmaster@eclipse.org>"; - mail("emo-records@eclipse.org", "Eclipse Account Change", $mail, $headers); - } - } - } - - public function _showChangedEmployer() { - //show the changed employer buttons - if ($this->is_committer) { - echo <<<END - <div class="form-group clearfix has-feedback"> - <label class="col-sm-6 control-label">Have you changed employers<sup>[<a href="https://www.eclipse.org/legal/#CommitterAgreements" title="Why are we asking this?">?</a>]</sup><span class="required">*</span></label> - <div class="col-sm-16"> - <input type="radio" name="changed_employer" value="Yes"> Yes - <input type="radio" name="changed_employer" value="No"> No - </div> - </div> -END; - } - } - - private function _userAuthentification() { - $process = FALSE; - if ($this->FormToken->verifyToken($_POST['token-login']) && empty($_POST['login-username'])) { - $process = TRUE; - } - - if (!preg_match(SITELOGIN_EMAIL_REGEXP, $this->username) && $this->stage == "login") { - $this->messages['login']['danger'][] = "Your email address does not appear to be valid."; - $process = FALSE; - } - - if ($process) { - $dn = $this->Ldapconn->authenticate($this->username, $this->password); - if ($dn) { - # If you've logged in with your uid, we need to get the email. - if (!preg_match("/@/", $this->username)) { - $this->username = $this->Ldapconn->getLDAPAttribute($dn, "mail"); - } - - $this->Friend->getIsCommitter(); - - # Look up BZ ID - - $sql = "SELECT /* USE MASTER */ userid FROM profiles where login_name = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->username)); - $rs = $this->App->bugzilla_sql($sql); - - if ($myrow = mysql_fetch_assoc($rs)) { - - $uid = $this->Ldapconn->getUIDFromMail($this->username); - $this->Friend->selectFriend($this->Friend->selectFriendID("uid", $uid)); - $this->Friend->setBugzillaID($myrow['userid']); - - } - else { - # Try to log into Bugzilla using these credentials - # This will create one - # creating one is important, since not all our sites use LDAP auth, and some rely on BZ auth - $AccountCreator = New AccountCreator(); - $AccountCreator->setUsername($this->username); - $AccountCreator->setPassword($this->password); - $AccountCreator->execute(); - - # create/update Gerrit account - # Bug 421319 - # sleep(1); # not needed if we take the time to log into Gerrit - $AccountCreator = New AccountCreator(); - $AccountCreator->setUrl('https://git.eclipse.org/r/login/q/status:open,n,z'); - $AccountCreator->setAccountType('gerrit'); - $AccountCreator->setUsername($this->username); - $AccountCreator->setPassword($this->password); - $http_code = $AccountCreator->execute(); - # TODO: verify that account was created (see bugzilla SQL below) - - # Get BZ ID now that an acct should be created - $sql = "SELECT /* USE MASTER */ userid FROM profiles where login_name = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->username)); - $rs = $this->App->bugzilla_sql($sql); - if ($myrow = mysql_fetch_assoc($rs)) { - $uid = $this->Ldapconn->getUIDFromMail($this->username); - $this->Friend->selectFriend($this->Friend->selectFriendID("uid", $uid)); - $this->Friend->setBugzillaID($myrow['userid']); - } - else { - $EventLog = new EvtLog(); - $EventLog->setLogTable("bugs"); - $EventLog->setPK1($this->password); - $EventLog->setPK2($sql); - $EventLog->setLogAction("AUTH_BZID_NOT_FOUND"); - $EventLog->insertModLog($dn); - $this->Friend->setBugzillaID(41806); # Nobody. - } - } - - # Override loaded friends info with LDAP info - $this->Friend->setFirstName($this->Ldapconn->getLDAPAttribute($dn, "givenName")); - $this->Friend->setLastName($this->Ldapconn->getLDAPAttribute($dn, "sn")); - $realname = $this->Friend->getFirstName() . " " . $this->Friend->getLastName(); - $this->Friend->setDn($dn); - $this->Friend->setEMail($this->username); - - $this->Session->setIsPersistent($this->remember); - $this->Session->setFriend($this->Friend); - $this->Session->create(); - - - # Only temporarily, re-hash the password in Bugzilla so that other services can use it - $bzpass = $this->_generateBugzillaSHA256Password($this->password); - $this->App->bugzilla_sql("SET NAMES 'utf8'"); - $sql = "UPDATE profiles SET cryptpassword='" . $this->App->sqlSanitize($bzpass) . "', realname='" . $this->App->sqlSanitize($realname) . "' WHERE login_name = " . $this->App->returnQuotedString($this->App->sqlSanitize($this->username)) . " LIMIT 1"; - - $this->App->bugzilla_sql($sql); - - # Begin: Bug 432830 - Remove the continue button in site_login - if ($this->takemeback != "") { - header("Location: " . $this->takemeback, 302); - } - else { - header("Location: myaccount.php", 302); - } - exit(); - # END: Bug 432830 - Remove the continue button in site_login - } - else { - $this->messages["login"]['danger'][] = "Authentication Failed. Please verify that your email address and password are correct."; - } - } - } - - private function _verifyIfPasswordExpired() { - - // Check if the user is logged in - if($this->Session->isLoggedIn()){ - // Get the Distinguished Name from UID - $dn = $this->Ldapconn->getDNFromUID($this->user_uid); - // Get shadowLastChange in seconds - $lastChange = ($this->Ldapconn->getLDAPAttribute($dn, "shadowLastChange")) * 86400; - // Get the number of days - $shadowMax = $this->Ldapconn->getLDAPAttribute($dn, "shadowMax"); - // Set the expiry date - $expiryDate = strtotime('+'.$shadowMax.' days', $lastChange); - $expireSoon = strtotime('-30 days', $expiryDate); - if ($this->Friend->getIsCommitter()) { - $numberOfDays = round(($expiryDate - time()) / (3600*24)); - if ($expiryDate >= time() && time() > $expireSoon) { - $days = $numberOfDays == 1 ? 'day' : 'days'; - $this->messages['password_expire_soon']['info'][] = 'Your password expires in <strong>' . $numberOfDays . ' '. $days .'.</strong>'; - return FALSE; - } - if ($expiryDate < time()) { - $this->messages['password_expired']['danger'][] = "Your password is expired. <br>Please update it immediately."; - return TRUE; - } - } - } - return FALSE; - } - - /** - * This function fetches all the countries and continents - * @return array - * */ - private function _fetchCountries() { - $sql = "SELECT - countries.ccode, - countries.en_description as description, - countries.continent_code, - continents.en_description as continent - FROM SYS_countries as countries - LEFT JOIN SYS_continents as continents - ON countries.continent_code = continents.continent_code"; - $result = $this->App->eclipse_sql($sql); - - $countries = array(); - while ($row = mysql_fetch_array($result)) { - $countries[] = $row; - } - $this->country_list = $countries; - return $countries; - } - - /** - * This function fetches all the continents from the SYS_continents table - * @return array - * */ - private function _fetchcontinents() { - $sql = "SELECT en_description FROM SYS_continents ORDER BY sort_order DESC"; - $result = $this->App->eclipse_sql($sql); - - $continents = array(); - while ($row = mysql_fetch_array($result)) { - $continents[] = $row['en_description']; - } - return $continents; - } - -} diff --git a/eclipse.org-common/classes/users/tpl/cla_form.tpl.php b/eclipse.org-common/classes/users/tpl/cla_form.tpl.php deleted file mode 100644 index 6945344..0000000 --- a/eclipse.org-common/classes/users/tpl/cla_form.tpl.php +++ /dev/null @@ -1,149 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2016 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eric Poirier (Eclipse Foundation) - initial API and implementation - *******************************************************************************/ -?> -<?php if (is_a($this, 'Cla') && $this->ldap_uid): ?> - <form id="frm_cla" name="frm_cla" action="#open_tab_cla" method="post"> - <?php print $this->getClaFormContent('text_1'); ?> - <div class="well"> - <?php print $this->getClaFormContent('text_2'); ?> - - <div class="form-group clearfix"> - <div class="col-xs-1 position-static"> - <input <?php if ($this->getFieldValues('Question 1') === "1"){print 'checked';}?> - class="committer-license-agreement-checkbox form-checkbox required" - type="checkbox" id="edit-question-1" name="question_1" value="1" /> - </div> - <div class="col-xs-22"> - <label class="option" for="edit-question-1">Question A <span - class="form-required" title="This field is required.">*</span></label> - <div class="description"><?php print $this->getClaFormContent('question_1'); ?></div> - </div> - </div> - - <div class="form-group clearfix"> - <div class="col-xs-1 position-static"> - <input <?php if ($this->getFieldValues('Question 2') === "1"){print 'checked';}?> - class="committer-license-agreement-checkbox form-checkbox required" - type="checkbox" id="edit-question-2" name="question_2" value="1" /> - </div> - <div class="col-xs-22"> - <label class="option" for="edit-question-2">Question B <span - class="form-required" title="This field is required.">*</span></label> - <div class="description"><?php print $this->getClaFormContent('question_2'); ?></div> - </div> - </div> - - <div class="form-group clearfix"> - <div class="col-xs-1 position-static"> - <input <?php if ($this->getFieldValues('Question 3') === "1"){print 'checked';}?> - class="committer-license-agreement-checkbox form-checkbox required" - type="checkbox" id="edit-question-3" name="question_3" value="1" /> - </div> - <div class="col-xs-22"> - <label class="option" for="edit-question-3">Question C <span - class="form-required" title="This field is required.">*</span></label> - <div class="description"><?php print $this->getClaFormContent('question_3'); ?></div> - </div></div> - - <div class="form-group clearfix"> - <div class="col-xs-1 position-static"> - <input <?php if ($this->getFieldValues('Question 4') === "1"){print 'checked';}?> - class="committer-license-agreement-checkbox form-checkbox required" - type="checkbox" id="edit-question-4" name="question_4" value="1" /> - </div> - <div class="col-xs-22"> - <label class="option" for="edit-question-4">Question D <span - class="form-required" title="This field is required.">*</span></label> - <div class="description"><?php print $this->getClaFormContent('question_4'); ?></div> - </div></div> - - <div class="form-group"> - <?php print $this->getClaFormContent('text_3'); ?> - </div> - <div class="form-group"> - <label for="edit-agree">Electronic Signature <span - class="form-required" title="This field is required.">*</span></label> - <input class="form-control form-text required" type="text" - id="edit-cla-agree" name="cla_agree" value="<?php print $this->getFieldValues('Agree'); ?>" size="60" maxlength="128" /> - <div class="description">Type "I AGREE" to accept the - terms above</div> - </div> - </div> - - - <?php print $this->getClaFormContent('text_4'); ?> - - <div class="form-group"> - <label for="edit-email">Email Address <span class="form-required" - title="This field is required.">*</span></label> - <input readonly class="form-control form-text" - type="text" id="edit-email" name="email" - value="<?php print $this->Friend->getEmail(); ?>" size="60" maxlength="128" /> - <div class="description">If you wish to use a different email - address you must first change the primary email address associated - with your account</div> - - </div> - <div class="form-group"> - <label for="edit-legal-name">Legal Name <span class="form-required" - title="This field is required.">*</span></label> - <input - class="form-control form-text" type="text" - id="edit-legal-name" name="legal_name" value="<?php print $this->Friend->getFirstName() . ' ' . $this->Friend->getLastName(); ?>" - size="60" maxlength="128" /> - <div class="description">Your full name as written in your passport - (e.g. First Middle Lastname)</div> - </div> - - <div class="form-group"> - <label for="edit-public-name">Public Name </label> - <input - class="form-control form-text" type="text" id="edit-public-name" - name="public_name" value="<?php print $this->getFieldValues('Public Name'); ?>" size="60" maxlength="128" /> - <div class="description">Your full name, alias, or nickname that - people call you in the Project (e.g. First Lastname) - leave this - field empty if it's identical to your legal name</div> - </div> - - <div class="form-group"> - <label for="edit-employer">Employer <span class="form-required" - title="This field is required.">*</span></label> <input - class="form-control form-text required" type="text" - id="edit-employer" name="employer" value="<?php print $this->getFieldValues('Employer'); ?>" size="60" - maxlength="128" /> - <div class="description">Your employer - you may choose to enter - "Self-employed" or "Student" in this field</div> - </div> - - <div class="form-group"> - <label for="edit-address">Postal Address <span - class="form-required" title="This field is required.">*</span></label> - <div class="form-textarea-wrapper resizable"> - <textarea class="form-control form-textarea required" - id="edit-address" name="address" cols="60" rows="5"><?php print $this->getFieldValues('Address'); ?></textarea> - </div> - <div class="description">Your physical mailing address</div> - </div> - - <div class="form-group"> - <input type="hidden" name="state" value="submit_cla"> - <input type="hidden" name="form_name" value="cla-form"> - <button class="btn btn-default form-submit" id="edit-submit" name="op" - value="Accept" type="submit">Accept</button> - </div> - <p class="help_text"> - If you have any questions about this agreement, licensing, or - anything related to intellectual property at the Eclipse Foundation, - please send an email to <a href="mailto:license@eclipse.org">license@eclipse.org</a>. - </p> - </form> -<?php endif; ?>
\ No newline at end of file diff --git a/eclipse.org-common/classes/users/tpl/cla_record.tpl.php b/eclipse.org-common/classes/users/tpl/cla_record.tpl.php deleted file mode 100644 index 8650a82..0000000 --- a/eclipse.org-common/classes/users/tpl/cla_record.tpl.php +++ /dev/null @@ -1,32 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2016 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Eric Poirier (Eclipse Foundation) - initial API and implementation - *******************************************************************************/ -?> - -<?php if (is_a($this, 'Cla') && $this->Friend->getUID()): ?> - <br> - <div class="alert alert-success" role="alert"> - <strong>Congratulations!</strong> You've signed a ECA. - </div> - <div class="alert alert-info" role="alert"> - <p>The Eclipse Contributor Agreement that we have on record for - you will expire on <?php print $this->getClaExpiryDate(); ?></p> - </div> - <p>If you've changed employers or your contact information, - please invalidate your current ECA and complete the form again. - <strong>Note that if you invalidate / renew your ECA, it cannot be undone; - you will be prompted to sign a new ECA.</strong></p> - <form action="#open_tab_cla" method="POST"> - <input type="hidden" name="state" value="invalidate_cla"> - <input type="hidden" name="form_name" value="cla-form"> - <button class="btn btn-primary">Invalidate / Renew ECA</button> - </form> -<?php endif; ?>
\ No newline at end of file diff --git a/eclipse.org-common/system/eclipseenv.class.php b/eclipse.org-common/system/eclipseenv.class.php index d58a661..e73e392 100644 --- a/eclipse.org-common/system/eclipseenv.class.php +++ b/eclipse.org-common/system/eclipseenv.class.php @@ -87,6 +87,7 @@ class EclipseEnv { 'cookie' => '.eclipse.local', 'domain' => 'www.eclipse.local:502' . $local_docker_port, 'dev_domain' => 'dev.eclipse.local:51143', + 'accounts' => 'accounts.eclipse.local:51243', 'allowed_hosts' => array( 'eclipse.local', 'www.eclipse.local', @@ -101,6 +102,7 @@ class EclipseEnv { 'domain' => 'staging.eclipse.org', // We currently dont have a staging server for dev.eclipse.org 'dev_domain' => 'dev.eclipse.org', + 'accounts' => 'accounts-staging.eclipse.org', 'allowed_hosts' => array( 'staging.eclipse.org' ), @@ -111,6 +113,7 @@ class EclipseEnv { 'cookie' => '.eclipse.org', 'domain' => 'www.eclipse.org', 'dev_domain' => 'dev.eclipse.org', + 'accounts' => 'accounts.eclipse.org', 'allowed_hosts' => array( // Empty, since it's the default. ), diff --git a/eclipse.org-common/system/session.class.php b/eclipse.org-common/system/session.class.php index 8cd28d2..160d606 100644 --- a/eclipse.org-common/system/session.class.php +++ b/eclipse.org-common/system/session.class.php @@ -59,7 +59,7 @@ class Session { 'session_name' => 'ECLIPSESESSION', 'env' => 'ECLIPSE_ENV', 'htaccess' => '/home/data/httpd/friends.eclipse.org/html/.htaccess', - 'login_page' => 'https://' . $domain['dev_domain'] . '/site_login/', + 'login_page' => 'https://' . $domain['accounts'] . '/user/login', ); # Set default config values. diff --git a/site_login/Gruntfile.js b/site_login/Gruntfile.js deleted file mode 100644 index 307fb41..0000000 --- a/site_login/Gruntfile.js +++ /dev/null @@ -1,62 +0,0 @@ -module.exports = function(grunt) { - // Initializing the configuration object - grunt.initConfig({ - // Task configuration - less: { - development: { - options: { - compress: true, - // minifying the result - }, - files: { - // compiling styles.less into styles.css - "./public/css/styles.min.css": "./src/less/styles.less", - } - } - }, - concat: { - options: { - separator: ';', - }, - js_frontend: { - src: ['./src/js/validation.jquery.js','./src/js/subscriptions_tab.js'], - dest: './public/js/script.min.js', - }, - }, - uglify: { - options: { - mangle: false - // Use if you want the names of your functions and variables - // unchanged. - }, - frontend: { - files: { - './public/js/script.min.js': './public/js/script.min.js', - } - }, - }, - watch: { - js_frontend: { - files: [ - // watched files - './src/js/*.js'], - // tasks to run - tasks: ['concat:js_frontend', 'uglify:frontend'], - }, - less: { - files: ['./src/less/*.less', './src/less/**/*.less'], - // watched files - tasks: ['less'], - // tasks to run - }, - } - }); - // Plugin loading - grunt.loadNpmTasks('grunt-contrib-concat'); - grunt.loadNpmTasks('grunt-contrib-watch'); - grunt.loadNpmTasks('grunt-contrib-less'); - grunt.loadNpmTasks('grunt-contrib-uglify'); - grunt.loadNpmTasks('grunt-contrib-copy'); - // Task definition - grunt.registerTask('default', ['watch']); -};
\ No newline at end of file diff --git a/site_login/bower.json b/site_login/bower.json deleted file mode 100644 index f1400de..0000000 --- a/site_login/bower.json +++ /dev/null @@ -1,22 +0,0 @@ -{ - "name": "eclipse-site_login", - "version": "0.0.1", - "authors": [ - "Christopher Guindon <chris.guindon@eclipse.org>" - ], - "description": "Solstice is a responsive theme for eclipse.org.", - "license": "EPL", - "homepage": "http://www.eclipse.org", - "private": true, - "ignore": [ - "**/.*", - "node_modules", - "bower_components", - "test", - "tests" - ], - "devDependencies": { - "solstice-assets": "git@github.com:EclipseFdn/solstice-assets.git", - "bootstrap": "3.3.1" - } -} diff --git a/site_login/content/en_index.php b/site_login/content/en_index.php deleted file mode 100755 index 60fb65a..0000000 --- a/site_login/content/en_index.php +++ /dev/null @@ -1,159 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2012-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Denis Roy (Eclipse Foundation)- initial API and implementation - * Christopher Guindon (Eclipse Foundation) - Bug 432355 - Update l&f of the Eclipse site login - *******************************************************************************/ - -//if name of the file requested is the same as the current file, the script will exit directly. -if(basename(__FILE__) == basename($_SERVER['PHP_SELF'])){exit();} - -$var_login = $Sitelogin->getVariables('login'); -$var_create = $Sitelogin->getVariables('create'); -?> -<div class="container padding-bottom" style="padding-top:2em;"> - <div class="col-md-24"> - <?php print $Sitelogin->getSystemMessage();?> - </div> - <div class="col-md-12"> - <h1>Eclipse Login</h1> - <p><a href="http://eclipse.org/friends">Friends of Eclipse</a> must log in to receive friendship benefits.</p><br/> - <form class="form-horizontal" name="login" method="post" action="index.php" id="frm_login"> - - <div class="form-group"> - <label class="col-sm-6 control-label">Email address</label> - <div class="col-sm-16"> - <input class="form-control" type="text" name="username" value="<?php print $var_login['username'] ?>" size="42" maxlength="255" tabindex="1" placeholder="Enter email" /> - </div> - </div> - <div class="form-group"> - <label class="col-sm-6 control-label">Password</label> - <div class="col-sm-16"> - <input class="form-control" type="password" name="password" value="<?php print $var_login['password'] ?>" size="42" maxlength="255" tabindex="2" placeholder="Password" /> - </div> - </div> - <div class="col-md-9"> - <input type="checkbox" name="remember" value="1" <?php print $var_login['remember'] ?> tabindex="3"/> Remember me - </div> - <div class="col-md-15"> - <a href="password_recovery.php">Reset my password</a> - </div> - <div> - <br/> - <br/> - <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 $Sitelogin->FormToken->getToken();?>" /> - <input type="hidden" name="login-username" value="" /> - </div> - </form> - </div> - <div class="col-md-12 border-left-column border-left-col"> - <h2>New to Eclipse? Create an account</h2> - <p>Welcome to the Eclipse.org community. Use the form below to create a new account to access our <a href="http://www.eclipse.org/forums">forums</a>, <a href="https://bugs.eclipse.org/bugs">Bugzilla</a>, <a href="http://wiki.eclipse.org">Wiki</a> and other Eclipse sites.</p> - <p><b>Please note:</b> Eclipse is an open and transparent community. Most of what you submit on our site will be visible to everyone, - and your email address may be visible to users who use Bugzilla, Gerrit, Git, and our mailing lists. You may prefer to use an email account specifically for this purpose.</p> - - <h3>Create a New Account</h3> - <form name="login" class="form-horizontal" action="index.php" method="post" id="frm_create_account"> - - <div class="form-group clearfix"> - <label class="col-sm-7 control-label">Email address <span class="required">*</span></label> - <div class="col-sm-16"> - <input type="text" class="form-control" tabindex="5" name="username" value="<?php print $var_create['username'] ?>" size="32" maxlength="255" placeholder="Enter email" /> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-7 control-label">First name <span class="required">*</span></label> - <div class="col-sm-16"> - <input class="form-control" type="text" tabindex="6" name="fname" value="<?php print $var_create['fname'] ?>" size="32" maxlength="255" placeholder="First name" /> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-7 control-label">Last name <span class="required">*</span></label> - <div class="col-sm-16"> - <input class="form-control" type="text" tabindex="6" name="lname" value="<?php print $var_create['lname'] ?>" size="32" maxlength="255" placeholder="Last name" /> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-7 control-label">Password <span class="required">*</span></label> - <div class="col-sm-16"> - <input class="form-control" tabindex="7" type="password" name="password1" value="<?php print $var_create['password1'] ?>" size="16" maxlength="255" placeholder="Password" /> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-7 control-label">Password (again) <span class="required">*</span></label> - <div class="col-sm-16"> - <input class="form-control" type="password" tabindex="8" name="password2" value="<?php print $var_create['password2'] ?>" size="16" maxlength="255" placeholder="Password (again)" /> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-7 control-label">Country of residence <span class="required">*</span></label> - <div class="col-sm-16"> - <select name="country" class="form-control"> - <option value="">Choose a country</option> - <?php print $Sitelogin->showCountries(); ?> - </select> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-7 control-label">Organization</label> - <div class="col-sm-16"> - <input class="form-control" type="text" name="organization" value="<?php print $var_create['organization'] ?>" size="32" maxlength="255"/> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-7 control-label">Verification<span class="required">*</span></label> - <div class="col-sm-16"> - <?php print $Captcha->get_html();?> - </div> - </div> - - <div class="form-group clearfix"> - <div class="col-sm-24"> - <div class="checkbox"> - <label> - <input type="checkbox" name="newsletter_status" value="subscribe" tabindex="10" /> - <span class="col-sm-24">I would like to subscribe to the Eclipse newsletter</span> - </label> - </div> - </div> - </div> - - <div class="form-group clearfix"> - <div class="col-sm-24"> - <div class="checkbox"> - <label> - <input type="checkbox" name="agree" <?php print $var_create['agree']; ?> value="1" tabindex="10" /> - <span class="col-sm-24">I agree not to post SPAM on this account. I also agree to the Eclipse.org <a href="http://www.eclipse.org/legal/termsofuse.php">Terms of Use</a> and <a href="http://www.eclipse.org/legal/privacy.php">Privacy Policy</a>.<span color="red">*</span></span> - </label> - </div> - </div> - </div> - - <div class="form-group clearfix"> - <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 $Sitelogin->FormToken->getToken();?>" /> - <input type="hidden" name="create-account-email-req" value="" /> - </div> - </div> - </form><br/> - </div> -</div> - diff --git a/site_login/content/en_logout.php b/site_login/content/en_logout.php deleted file mode 100644 index 2d46fef..0000000 --- a/site_login/content/en_logout.php +++ /dev/null @@ -1,17 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2014-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christopher Guindon (Eclipse Foundation) - Bug 432355 - Update l&f of the Eclipse site login - *******************************************************************************/ -?> -<?php print $Sitelogin->getSystemMessage();?> - -<h1>Please wait while you are redirected</h1> - -<p>If you are not redirected automatically, please click <a href="http://www.eclipse.org/">here</a>.</p>
\ No newline at end of file diff --git a/site_login/content/en_myaccount.php b/site_login/content/en_myaccount.php deleted file mode 100644 index 8035d1f..0000000 --- a/site_login/content/en_myaccount.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2012-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Denis Roy (Eclipse Foundation)- initial API and implementation - * Christopher Guindon (Eclipse Foundation) - Bug 432355 - Update l&f of the Eclipse site login - * Matt Ward (Eclipse Foundation) - Added block notification - *******************************************************************************/ - - $var_welcomeback = $Sitelogin->getVariables('welcomeback'); - $name = $var_welcomeback['fname'] . ' ' . $var_welcomeback['lname']; - $pageTitle = 'My Account'; - -?> - -<div class="container padding-top-25 padding-bottom-25"> - <div id="maincontent"> - <div id="midcolumn"> - <h1><?php print $pageTitle; ?> <small><?php print $name; ?></small></h1> - <?php if ($InfraBlock->isBlocked()) :?> - <div class="alert alert-danger" role="alert"> Your IP (<?php print $_SERVER['REMOTE_ADDR'];?>) is currently blocked <?php print $InfraBlock->whyBlocked() ?>. - <br/> The block will expire after: <strong><?php print $InfraBlock->getExpiry();?></strong></div> - <?php endif;?> - <?php print $Sitelogin->getSystemMessage();?> - <ul class="nav nav-tabs" role="tablist"> - <li<?php print ($Cla->getClaIsSigned() === TRUE ? ' class="active"' : '');?>><a href="#open_tab_profile" role="tab" data-toggle="tab" id="tab-profile">Edit Profile</a></li> - <li><a href="#open_tab_accountsettings" role="tab" data-toggle="tab" id="tab-accountsettings">Account Settings</a></li> - <li><a data-url="<?php print $Sitelogin->getDomain(); ?>/site_login/subscriptions.php" href="#open_tab_subscriptions" role="tab" data-toggle="tab" id="tab-subscriptions">Subscriptions</a></li> - <li <?php print ($Cla->getClaIsSigned() === FALSE ? 'class="active"' : '');?>><a href="#open_tab_cla" role="tab" data-toggle="tab" id="tab-accountsettings">Eclipse ECA</a></li> - - <?php if ($var_welcomeback['friend']['is_benefit']) :?> - <li><a href="#foe" role="tab" data-toggle="tab" id="tab-profile">Friends of Eclipse</a></li> - <?php endif;?> - - </ul> - <div class="tab-content"> - <div class="tab-pane fade in <?php print ($Cla->getClaIsSigned() === TRUE ? 'active' : '');?>" id="open_tab_profile"> - <?php include "myaccount/en_profile.php" ?> - </div> - - <div class="tab-pane fade in" id="open_tab_accountsettings"> - <?php include "myaccount/en_accountsettings.php" ?> - </div> - - <div class="tab-pane fade in" id="open_tab_subscriptions"> - <noscript>You need to enable Javascript to manage your subscriptions</noscript> - </div> - - <div class="tab-pane fade in <?php print ($Cla->getClaIsSigned() === FALSE ? 'active' : '');?>" id="open_tab_cla"> - <hr> - Visit the <a href="https://www.eclipse.org/legal/ECA.php">ECA</a> page to learn more. - <hr> - <?php $Cla->outputPage(); ?> - </div> - - <?php if ($var_welcomeback['friend']['is_benefit']) :?> - <div class="tab-pane fade" id="foe"> - <?php include "myaccount/en_friends_info.php" ?> - </div> - <?php endif;?> - - </div> - </div> - - <div id="rightcolumn"> - <?php include "myaccount/en_sidebar.php" ?> - </div> - </div> -</div> diff --git a/site_login/content/en_password_recovery.php b/site_login/content/en_password_recovery.php deleted file mode 100644 index 7d78038..0000000 --- a/site_login/content/en_password_recovery.php +++ /dev/null @@ -1,83 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2012-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Denis Roy (Eclipse Foundation)- initial API and implementation - * Christopher Guindon (Eclipse Foundation) - Bug 432355 - Update l&f of the Eclipse site login - *******************************************************************************/ - - if ($stage == "reset3") : - include_once('en_index.php'); - else: -?> - <div class="container padding-bottom" style="padding-top:2em;"> - <div class="col-md-16"> - <h1>Reset my password</h1> - <?php print $Sitelogin->getSystemMessage();?> - <?php if ($stage == "reset2") :?> - <form name="frm-new-password" method="post" action="password_recovery.php"> - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">New Password<span class="required">*</span></label> - <div class="col-sm-16"> - <input id="msg_password1" tabindex="1" class="form-control" type="password" name="password1" value="" size="32" maxlength="255"/> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">New Password (again)<span class="required">*</span></label> - <div class="col-sm-16"> - <input id="msg_password2" tabindex="2" class="form-control" type="password" name="password2" value="" size="32" maxlength="255"/> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Verification <span class="required">*</span></label> - <div class="col-sm-16"> - <?php print $Captcha->get_html();?> - </div> - </div> - - <div class="form-group clearfix"> - <div class="col-sm-24"> - <button id="btn_submit" type="submit" name="btn-submit" tabindex="4" class="btn btn-primary">Reset password</button> - <input type="hidden" name="t" value="<?php print $var_reset['token']; ?>" /> - <input type="hidden" name="token-password-reset" value="<?php print $Sitelogin->FormToken->getToken();?>" /> - <input type="hidden" name="reset-account-email-req" value="" /> - </div> - </div> - </form> - <?php else:?> - <p>So you lost the sticky note that your password was written on? - No worries -- just enter your email address and we'll send you instructions - for resetting your password.</p> - <form name="frm_passwd" id="frm_passwd" class="form-horizontal" method="post"> - <div class="form-group"> - <label class="col-sm-6 control-label">Email address <span class="required">*</span></label> - <div class="col-sm-16"> - <input class="form-control" autofocus="autofocus" type="text" name="username" value="" size="42" maxlength="255" placeholder="Enter email"/> - </div> - </div> - <button type="submit" name="btn_submit" class="btn btn-warning" >Continue</button> - <input type="hidden" name="stage" value="reset" /> - <input type="hidden" name="token-password-recovery" value="<?php print $Sitelogin->FormToken->getToken();?>" /> - <input type="hidden" name="recover-account-email-req" value="" /> - </form> - <?php endif;?> - </div> - <div class="col-md-6 col-md-offset-2"> - <div class="sideitem background-white"> - <h6>Related Links</h6> - <ul> - <li><a href="index.php">Create Account</a></li> - <li><a href="https://www.eclipse.org/legal/termsofuse.php">Term of use</a></li> - <li><a href="http://www.eclipse.org/legal/privacy.php">Privacy Policy</a></li> - </ul> - </div> - </div> - </div> - <?php endif;?>
\ No newline at end of file diff --git a/site_login/content/myaccount/en_accountsettings.php b/site_login/content/myaccount/en_accountsettings.php deleted file mode 100644 index 3a0c17f..0000000 --- a/site_login/content/myaccount/en_accountsettings.php +++ /dev/null @@ -1,101 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2012-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christopher Guindon (Eclipse Foundation) - initial API and implementation - *******************************************************************************/ -?> - - <form id="frm_accountsettings" name="frm_accountsettings" method="post" action="myaccount.php#accountsettings" class="clearfix"> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Current password<span class="required">*</span></label> - <div class="col-sm-16"> - <input class="form-control" type="password" name="password" value="" size="32" maxlength="255" /> - <p class="help-block">Your current password is required to change your account details. <br><a href="password_recovery.php">Reset my password</a></p> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">E-mail address<span class="required">*</span></label> - <div class="col-sm-16"> - <input class="form-control" type="text" name="username" value="<?php print $var_welcomeback['username']; ?>" size="40" maxlength="255"/> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">First name<span class="required">*</span></label> - <div class="col-sm-16"> - <input class="form-control" type="text" name="fname" value="<?php print $var_welcomeback['fname']; ?>" size="40" maxlength="125" /> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Last name<span class="required">*</span></label> - <div class="col-sm-16"> - <input class="form-control" type="text" name="lname" value="<?php print $var_welcomeback['lname']; ?>" size="40" maxlength="125"/> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">New Password<span class="required">*</span></label> - <div class="col-sm-16"> - <input class="form-control" type="password" name="password1" value="<?php print $var_welcomeback['password1']; ?>" size="32" maxlength="255"/> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">New Password (again)<span class="required">*</span></label> - <div class="col-sm-16"> - <input class="form-control" type="password" name="password2" value="<?php print $var_welcomeback['password2']; ?>" size="32" maxlength="255"/> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label"><a href="https://github.com/" target="_blank">GitHub</a> ID (optional)</label> - <div class="col-sm-16"> - <?php if ($var_welcomeback['githubid'] == "") : ?> - <input class="form-control" type="text" name="githubid" value="<?php print $var_welcomeback['githubid']; ?>" size="32" maxlength="255" /> - <p><i><small>Your GitHub ID makes it easier for you to participate on Eclipse projects hosted on GitHub.</small></i></p> - <?php else:?> - <input type="text" disabled="disabled" name="githubid" value="<?php print $var_welcomeback['githubid']; ?>"/><br/> - <p><i><small>Your GitHub ID is already set and cannot be changed. Please contact <a href="mailto:webmaster@eclipse.org">webmaster@eclipse.org</a> to update it.</small></i></p> - <?php endif;?> - </div> - </div> - - <?php $Sitelogin->_showChangedEmployer(); ?> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Gerrit HTTP password</label> - <div class="col-sm-16"> - <a href="https://git.eclipse.org/r/#/settings/http-password">Go to Gerrit</a> - </div> - </div> - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Gerrit SSH keys</label> - <div class="col-sm-16"> - <a href="https://git.eclipse.org/r/#/settings/ssh-keys">Go to Gerrit</a> - </div> - </div> - <div class="form-group clearfix"> - <div class="col-sm-24"> - <button type="submit" name="btn_submit" class="btn btn-warning" />Update account</buttton> - <input type="hidden" name="stage" value="save-account" /> - <input type="hidden" name="token-edit-account" value="<?php print $Sitelogin->FormToken->getToken();?>" /> - <input type="hidden" name="edit-account-email-req" value="" /> - </div> - </div> - </form> - - <div class=""> - <h3>Please note:</h3> - <p><small>the Eclipse Foundation communities operate in an open and transparent fashion. Most of what you submit on our site(s) will be visible to everyone, - and your email address may be visible to users who use Bugzilla, Gerrit, Git, and our mailing lists. You may prefer to use an email account specifically for this purpose.</small></p> - </div> - diff --git a/site_login/content/myaccount/en_friends_info.php b/site_login/content/myaccount/en_friends_info.php deleted file mode 100644 index f3b92bf..0000000 --- a/site_login/content/myaccount/en_friends_info.php +++ /dev/null @@ -1,80 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2013-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christopher Guindon (Eclipse Foundation) - *******************************************************************************/ - - // If name of the file requested is the same as the current file, - // the script will exit directly. - if (basename(__FILE__) == basename($_SERVER['PHP_SELF'])) { - exit(); - } - - if (!isset($var_welcomeback['friend'])){ - $var_welcomeback = $Sitelogin->getVariables('welcomeback'); - } - - if ($var_welcomeback['friend']['is_benefit']) : -?> - -<p>As a Friend of Eclipse, you can use the Friends mirror to get fast downloads -from the eclipse.org servers. *</p> - -<div class="clearfix"> - <label class="col-sm-6 control-label">Friend Since:</label> - <div class="col-sm-16"> - <p><?php print $var_welcomeback['friend']['date_joined']; ?></p> - </div> -</div> -<div class="clearfix"> - <label class="col-sm-6 control-label">Benefits Expire:</label> - <div class="col-sm-16"> - <p><?php print $var_welcomeback['friend']['date_expired']; ?></p> - </div> -</div> - -<p><small>* Eclipse Foundation Inc. cannot guarantee that the Friends mirror will be -faster than its other mirrors, however it will give users of this mirror priority.</small></p> - -<h2>Logo</h2> -<p>If you wish to link to the Friends of Eclipse Logo on your website or blog -please use of the codes below:</p> - -<div class="row padding-bottom-15"> - <div class="col-md-10"> - <img src="images/friendslogo.png" class="img-responsive"/> - </div> - <div class="col-md-14"> - <textarea class="margin-top-15 form-control" rows="3"> - <img src="http://eclipse.org/donate/images/friendslogo.png"/> - </textarea> - </div> -</div> - -<div class="row padding-bottom-15"> - <div class="col-md-10"><img src="images/friendslogo200.png" class="img-responsive"/></div> - <div class="col-md-14"> - <textarea class="form-control" rows="3"> - <img src="http://eclipse.org/donate/images/friendslogo200.png"> - </textarea> - </div> -</div> - -<div class="row padding-bottom-15"> - <div class="col-md-10"> - <img src="images/friendslogo160.png" class="img-responsive"/> - </div> - <div class="col-md-14"> - <textarea class="form-control" rows="3"> - <img src="http://eclipse.org/donate/images/friendslogo160.png"> - </textarea> - </div> -</div> - -<?php endif;?> diff --git a/site_login/content/myaccount/en_profile.php b/site_login/content/myaccount/en_profile.php deleted file mode 100644 index bc4bd3a..0000000 --- a/site_login/content/myaccount/en_profile.php +++ /dev/null @@ -1,104 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2014-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christopher Guindon (Eclipse Foundation) - *******************************************************************************/ - - $password_required = '<small><a href="#" data-tab-destination="tab-accountsettings"><i class="fa fa-edit"></i> Edit</a></small>'; -?> - - <form id="frm_profile" name="frm_profile" method="post" action="myaccount.php#profile" class="clearfix"> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">First name</label> - <div class="col-sm-16"> - <p class="form-control-static"><?php print $var_welcomeback['fname']; ?> <?php print $password_required;?></p> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Last name</label> - <div class="col-sm-16"> - <p class="form-control-static"><?php print $var_welcomeback['lname']; ?> <?php print $password_required;?></p> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Organization</label> - <div class="col-sm-16"> - <input class="form-control" type="text" name="organization" value="<?php print $var_welcomeback['organization']; ?>" size="32" maxlength="255"/> - </div> - </div> - - <?php $Sitelogin->_showChangedEmployer(); ?> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Job Title</label> - <div class="col-sm-16"> - <input class="form-control" type="text" name="jobtitle" value="<?php print $var_welcomeback['jobtitle']; ?>" size="32" maxlength="255"/> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Country of residence<span class="required">*</span></label> - <div class="col-sm-16"> - <select name="country" class="form-control"> - <option value="">Choose a country</option> - <?php print $Sitelogin->showCountries(); ?> - </select> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Bio</label> - <div class="col-sm-16"> - <textarea class="form-control" rows="5" name="bio"><?php print $var_welcomeback['bio']; ?></textarea> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Interests</label> - <div class="col-sm-16"> - <input class="form-control" type="text" name="interests" value="<?php print $var_welcomeback['interests']; ?>" size="32" maxlength="255"/> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Website</label> - <div class="col-sm-16"> - <input aria-describedby="helpBlock" placeholder="http://" class="form-control" type="text" name="website" value="<?php print $var_welcomeback['website']; ?>" size="32" maxlength="255"/> - <span id="helpBlock" class="help-block"> - <small>* You need to specify the protocol (ie: https:// or http://)</small> - </span> - </div> - </div> - - <div class="form-group clearfix"> - <label class="col-sm-6 control-label">Twitter handle</label> - <div class="col-sm-16"> - <input class="form-control" type="text" name="twitter_handle" value="<?php print $var_welcomeback['twitter_handle']; ?>" size="32" maxlength="255"/> - </div> - </div> - - <div class="form-group clearfix"> - <div class="col-sm-24"> - <button type="submit" name="btn_submit" class="btn btn-warning">Update Profile</button> - <input type="hidden" name="stage" value="save-profile" /> - <input type="hidden" name="token-update-profile" value="<?php print $Sitelogin->FormToken->getToken();?>" /> - <input type="hidden" name="profile-name-req" value="" /> - </div> - </div> - </form> - - <div class=""> - <h3>Please note:</h3> - <p><small>The Eclipse Foundation communities operate in an open and transparent fashion. Most of what you submit on our site(s) will be visible to everyone, - and your email address may be visible to users who use Bugzilla, Gerrit, Git, and our mailing lists. You may prefer to use an email account specifically for this purpose.</small></p> - </div> - diff --git a/site_login/content/myaccount/en_sidebar.php b/site_login/content/myaccount/en_sidebar.php deleted file mode 100644 index 5278c4e..0000000 --- a/site_login/content/myaccount/en_sidebar.php +++ /dev/null @@ -1,112 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2013-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Denis Roy (Eclipse Foundation)- initial API and implementation - * Christopher Guindon (Eclipse Foundation) - Bug 432355 - Update l&f of the Eclipse site login - *******************************************************************************/ - - # Build HIPP Control UI - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/projects/projectList.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/projects/hipp.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/session.class.php"); - $ProjectList = new ProjectList(); - $ProjectList->selectCommitterProjectList($var_welcomeback['friend']['uid']); - - $Session = $App->useSession(true); - $Friend = $Session->getFriend(); - - $str = ""; - $help_link = "<li><a href='https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Community&component=Hudson&short_desc=HIPP%20for%20MyProject'>Request a HIPP instance</a></li>"; - if($ProjectList->getCount() > 0) { - $help_link = "<li><a href='https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Community&component=Hudson&short_desc=HIPP%20Help'>Request Webmaster support for a HIPP instance</a></li>"; - $str .= '<div class="block-padding"><h4><img alt="Hudson" src="images/icon_hudson.png" width="30" class="float-right"/> Instances</h4>'; - for($i = 0; $i < $ProjectList->getCount(); $i++) { - # Add some spacing - if($i > 0) { - $str .= "<hr />"; - } - $Project = $ProjectList->getItemAt($i); - $Hipp = new Hipp(); - $Hipp->selectHipp($Project->getProjectID()); - - # Not all HIPP instances are on hudson.eclipse.org - # $hippurl = "https://hudson.eclipse.org/" . $Project->getProjectShortName(); - preg_match("/(\w+)\.org/", $Hipp->getServerHost(), $matches); # server running the instance must match the domain serving the instance - $hippurl = "https://hudson." . $matches[0] . "/" . $Project->getProjectShortName(); - $str .= "<div class=\"hipp-control-item\"><a href='$hippurl'>" . $Project->getName() . "</a>: <br/> "; - - if ($Hipp->getID() > 0) { - $str .= $Hipp->getControlLink($Project->getProjectID(), $Project->getProjectShortName()); - } - else { - $str .= "No HIPP instance found for this project. <a href='https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Community&component=Hudson&short_desc=HIPP%20for%20" . $Project->getProjectShortName() . "'>Request one.</a>"; - } - $str .= "</div>"; - } - $str .= "</div>"; - } -?> - -<?php if ($var_welcomeback['friend']['is_committer']) :?> -<div class="sideitem background-white"> - <h3> Hudson HIPP Control</h3> - <?php print $str; ?> - <div class="block-padding"> - <h4>Links</h4> - <ul> - <?php print $help_link;?> - <li><a href='http://wiki.eclipse.org/Hudson'>About Hudson and HIPP</a></li> - </ul> - </div> -</div> -<?php endif;?> - -<?php if ($var_welcomeback['friend']['is_committer']) :?> -<div class="sideitem background-white"> - <h3>Committer Tools</h3> - <ul> - <li><a href="../committers/bugs/bugz_manager.php">Bugzilla Manager: components, targets, milestones</a></li> - <li><a href="https://dev.eclipse.org/mailman/listinfo/eclipse.org-committers">Committer mailing list</a></li> - <li><a href="../committers/committertools/stats.php">Download stats</a></li> - <li><a href="https://dev.eclipse.org/committers/help/status.php">Eclipse infras status</a></li> - <li><a href="../committers/committertools/ip_test.php">IP address / DNS test tool</a></li> - <li><a href="https://dev.eclipse.org/ipzilla/">IPZilla</a></li> - <li><a href="https://projects.eclipse.org/">PMI - Project management infrastructure</a></li> - <li><a href="../committers/webstats/webstats.php">Website stats</a></li> - </ul> -</div> -<?php endif;?> - -<?php if ($Friend->checkUserIsWebmaster()): ?> - <?php include $_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/webmaster/tpl/sidebar.tpl.php" ?> -<?php endif; ?> - -<div class="sideitem background-white"> -<h3>Development Tools</h3> - <ul> - <?php if($Friend->checkUserIsFoundationStaff()): ?> - <li><a href="../committers/committertools/adReports.php">Ads Report</a></li> - <?php endif; ?> - <li><a href="https://bugs.eclipse.org/">Bugzilla</a></li> - <?php if($Friend->checkUserIsFoundationStaff()): ?> - <li><a href="../committers/committertools/campaignManager.php">Campaign Manager</a></li> - <?php endif; ?> - <li><a href="http://marketplace.eclipse.org/">Eclipse Marketplace</a></li> - <li><a href="http://git.eclipse.org/r/">Gerrit code review</a></li> - <li><a href="http://git.eclipse.org/c/">Git source repositories</a></li> - <li><a href="http://www.eclipse.org/forums/">Forums</a></li> - <li><a href="https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Community&component=Git">Request Webmaster Support</a></li> - </ul> -</div> -<style> - hr { - margin-bottom: 6px; - margin-top: 6px; - } -</style>
\ No newline at end of file diff --git a/site_login/control_hipp/hipp_control.jquery.js b/site_login/control_hipp/hipp_control.jquery.js deleted file mode 100644 index 6de31dc..0000000 --- a/site_login/control_hipp/hipp_control.jquery.js +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christopher Guindon (Eclipse Foundation) - * Denis Roy (Eclipse Foundation) - *******************************************************************************/ - -jQuery(document).ready(function() { - $(".hipp-control-action-link").click(function(e) { - e.preventDefault(); - var action = $(this).data("action"); - var shortname = $(this).data("shortname"); - var projectid = $(this).data("projectid"); - - if(action != "readme") { - $("#" + shortname + "_state").html(""); - } - - $.post("control_hipp/index.php", {action: action, project: projectid }) - .done(function(data) { - var output = data; - var regexp = /^token:/; - if (regexp.test(data)) { - var token = data.split(":"); - var output = "<i class=\"fa fa-spinner fa-spin\"></i>"; - var timer, delay = 5000;timer = setInterval(function(){ - $.post("control_hipp/index.php", { action: "check", token: token[1] }) - .done(function(html){ - $("#" + shortname + "_instance").html(html); - }) - },delay); - }; - if(action == "readme") { - output = output.replace(/\n/g, "<br />"); - $("#" + shortname + "_readme").html(output); - } - else { - $("#" + shortname + "_instance").html(output); - } - }); - }); -}); diff --git a/site_login/control_hipp/index.php b/site_login/control_hipp/index.php deleted file mode 100755 index 02c2eaa..0000000 --- a/site_login/control_hipp/index.php +++ /dev/null @@ -1,165 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2013-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Denis Roy (Eclipse Foundation)- initial API and implementation - *******************************************************************************/ - - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/projects/projectList.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/projects/hipp.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/evt_log.class.php"); - - $App = new App(); - - define("SVCTYPE", "HIPPCTL"); - - # require session for this page - $Session = $App->useSession(true); - $Friend = $Session->getFriend(); - - $ProjectList = new ProjectList(); - $ProjectList->selectCommitterProjectList($Friend->getUID()); - - $prj = $App->getHTTPParameter("project"); - $action = $App->getHTTPParameter("action"); - $token = $App->getHTTPParameter("token"); - $token = preg_replace("/[^a-zA-Z0-9]/", "", $token); - - # Sanitize action - $validActions = array("start", "stop", "restart", "check", "upgrade", "readme"); - if(!in_array($action, $validActions)) { - echo "Invalid request."; exit; - } - - # Check status of token - if($action == "check") { - if($token != "") { - $sql = "SELECT /* USE MASTER */ NOW() AS timenow, ROUND(NOW() - req_when,0) AS seconds_waiting, req_result, req_output, req_action FROM service_requests - WHERE token = " . $App->returnQuotedString($App->sqlSanitize($token)); - $rs = $App->eclipse_sql($sql); - if($myrow = mysql_fetch_assoc($rs)) { - if($myrow['req_result'] == "") { - if($myrow['seconds_waiting'] > 300) { - echo "<b>Your request has not produced a result in 5 minutes. Please refresh this page and try again, and notify webmaster@eclipse.org if the problem persists.</b>"; - } - else { - $dots = 1; - if($myrow['seconds_waiting'] > 0) { - $dots = $myrow['seconds_waiting'] / 5; - } - $s = str_repeat(".", $dots); - echo "<img class='spinner' src='../images/spinner.gif' />   <b>" . $myrow['timenow'] . ":</b> pending execution of " . $myrow['req_action'] . $s; - } - } - else { - if($myrow['req_action'] == "upgrade") { - $output = nl2br($myrow['req_output']); - echo "Your request to " . $myrow['req_action'] . " Hudson has begun. <b>Output text:</b> " . $output; - } - else { - echo "Your request to " . $myrow['req_action'] . " Hudson has completed. <b>Output text:</b> " . $myrow['req_output']; - } - } - } - else { - echo "<b><font class='darkred'>Invalid or expired token. Please refresh this page.</font></b>"; - } - } - else { - echo "No token!"; - } - exit; - } - - - # Sanitize committer/project - $validCommitter = false; - if($ProjectList->getCount() > 0) { - for($i = 0; $i < $ProjectList->getCount(); $i++) { - $Project = $ProjectList->getItemAt($i); - if($Project->getProjectID() == $prj) { - $validCommitter = true; - break; - } - } - } - if(!$validCommitter) { - echo "You are not a committer on this project."; exit; - } - # End sanitize - - # Determine if another request is still pending - $sql = "SELECT /* USE MASTER */ COUNT(1) AS RecordCount FROM service_requests - WHERE service_type = " . $App->returnQuotedString(SVCTYPE) - . " AND project_id = " . $App->returnQuotedString($App->sqlSanitize($prj)) - . " AND req_result IS NULL"; - $rs = $App->eclipse_sql($sql); - $myrow = mysql_fetch_assoc($rs); - if($myrow['RecordCount'] > 0) { - echo "<b><font color='darkred'>You have already submitted a request. Please wait for the current request to complete. (1356)</font></b>"; - exit; - } - - # Completed requests will stay in the table for 15 minutes. - # Determine if another request was issued recently, and prevent another from happening - $sql = "SELECT /* USE MASTER */ COUNT(1) AS RecordCount FROM service_requests - WHERE service_type = " . $App->returnQuotedString(SVCTYPE) - . " AND project_id = " . $App->returnQuotedString($App->sqlSanitize($prj)) - . " AND req_result IS NOT NULL AND DATE_SUB(NOW(), INTERVAL 1 minute) < req_when"; - $rs = $App->eclipse_sql($sql); - $myrow = mysql_fetch_assoc($rs); - if($myrow['RecordCount'] > 4) { - echo "<b><font color='darkred'>A similar request was issued recently. Please wait a few moments before trying again. If the problem persists, please contact webmaster@eclipse.org (1122).</font></b>"; - exit; - } - - # Completed requests will stay in the table for 15 minutes. - # Determine if an specific IP address is trying to harm us - $sql = "SELECT /* USE MASTER */ COUNT(1) AS RecordCount FROM service_requests - WHERE service_type = " . $App->returnQuotedString(SVCTYPE) - . " AND ip = " . $App->returnQuotedString($_SERVER['REMOTE_ADDR']); - $rs = $App->eclipse_sql($sql); - $myrow = mysql_fetch_assoc($rs); - if($myrow['RecordCount'] > 4) { - echo "<b><font color='darkred'>Too many requests. Please wait a few moments before trying again. If the problem persists, please contact webmaster@eclipse.org (3124).</font></b>"; - exit; - } - - - ##################################### - # All is good. - if($action == "readme") { - $Hipp = new Hipp(); - $Hipp->selectHipp($prj); - echo $Hipp->getReadmeContents("hipp", $Hipp->getServiceLatestVersion()); - } - else { - $token = $App->getAlphaCode(64); - $sql = "INSERT INTO service_requests VALUES (NULL, - " . $App->returnQuotedString($Friend->getUID()) . ", - " . $App->returnQuotedString($App->sqlSanitize($prj)) . ", - 'HIPPCTL', - " . $App->returnQuotedString($App->sqlSanitize($action)) . ", - NULL, - NULL, - " . $App->returnQuotedString($_SERVER['REMOTE_ADDR']) . ", - NOW(), - " . $App->returnQuotedString($token) . ")"; - $App->eclipse_sql($sql); - - $EventLog = new EvtLog(); - $EventLog->setLogTable("service_requests"); - $EventLog->setPK1("HIPPCTL"); - $EventLog->setPK2($App->sqlSanitize($prj)); - $EventLog->setLogAction("request_" . $App->sqlSanitize($action)); - $EventLog->insertModLog($Friend->getUID()); - - echo "token:" . $token; - } -?>
\ No newline at end of file diff --git a/site_login/createaccount.php b/site_login/createaccount.php index ecbfcb7..d938758 100644 --- a/site_login/createaccount.php +++ b/site_login/createaccount.php @@ -9,6 +9,5 @@ * Contributors: * Christopher Guindon (Eclipse Foundation) - initial API and implementation *******************************************************************************/ - - header("location:/site_login/"); - exit;
\ No newline at end of file + header("Location: https://accounts.eclipse.org/user/register", 301); + exit();
\ No newline at end of file diff --git a/site_login/index.php b/site_login/index.php index ea27064..e224ed2 100755 --- a/site_login/index.php +++ b/site_login/index.php @@ -10,39 +10,9 @@ * Denis Roy (Eclipse Foundation)- initial API and implementation * Christopher Guindon (Eclipse Foundation) - Bug 432355 - Update l&f of the Eclipse site login *******************************************************************************/ - header('Content-Type: text/html; charset=utf-8'); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); - 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"); - - $App = new App(); - $Nav = new Nav(); - $Menu = new Menu(); - $Sitelogin = new Sitelogin(); - $Captcha = new Captcha; - - $App->preventCaching(); - - include("_projectCommon.php"); - - $pageTitle = "Eclipse Login"; - $pageKeywords = "eclipse,friends,login,account,signon,sign-on"; - $pageAuthor = "Eclipse Foundation, Inc."; - - // Custom theme variables - $variables = array(); - $variables['main_container_classes'] = 'container-full footer-offset breadcrumbs-offset background-grey'; - $App->setThemeVariables($variables); - - # Redirect the user if already logged in. - $Sitelogin->verifyUserStatus(); - - ob_start(); - include("content/en_" . $App->getScriptName()); - $html = ob_get_clean(); - - $App->setGoogleAnalyticsTrackingCode(NULL); - # Generate the web page - $App->generatePage($theme, $Menu, NULL, $pageAuthor, $pageKeywords, $pageTitle, $html); + $url = 'https://accounts.eclipse.org'; + if (!empty($_GET['takemeback']) && filter_var($_GET['takemeback'], FILTER_VALIDATE_URL) !== FALSE) { + $url .= '?takemeback=' . urlencode($_GET['takemeback']); + } + header("Location: " . $url, 301); + exit(); diff --git a/site_login/logout.php b/site_login/logout.php index 40c2b9d..5aaff14 100644 --- a/site_login/logout.php +++ b/site_login/logout.php @@ -9,41 +9,5 @@ * Contributors: * Christopher Guindon (Eclipse Foundation) - Initial implementation *******************************************************************************/ - header('Content-Type: text/html; charset=utf-8'); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/users/siteLogin.class.php"); - - $App = new App(); - $Nav = new Nav(); - $Menu = new Menu(); - $Sitelogin = new Sitelogin(); - - $App->preventCaching(); - - include("_projectCommon.php"); - - header("Content-type: text/html; charset=utf-8"); - $pageTitle = "Log out"; - $pageKeywords = "eclipse, friends, logout ,account, signon, sign-on"; - $pageAuthor = "Eclipse Foundation, Inc."; - - $var_logout = $Sitelogin->getVariables('logout'); - - $redirect = $Sitelogin->logout(); - - if ($var_logout['password_update']) { - $Sitelogin->password_update(); - $redirect = 'https://dev.eclipse.org/site_login/'; - } - - // Place your html content in a file called content/en_pagename.php - ob_start(); - include("content/en_" . $App->getScriptName()); - $html = ob_get_clean(); - - - $App->AddExtraHtmlHeader('<meta http-equiv="refresh" content="4;url=' . $redirect . '"> '); - $App->setGoogleAnalyticsTrackingCode(NULL); - $App->generatePage($theme, $Menu, NULL, $pageAuthor, $pageKeywords, $pageTitle, $html); + header("Location: https://accounts.eclipse.org/user/logout", 301); + exit();
\ No newline at end of file diff --git a/site_login/myaccount.php b/site_login/myaccount.php index 9065ff0..12ac0a2 100755 --- a/site_login/myaccount.php +++ b/site_login/myaccount.php @@ -10,38 +10,5 @@ * Denis Roy (Eclipse Foundation)- initial API and implementation * Christopher Guindon (Eclipse Foundation) - Bug 432355 - Update l&f of the Eclipse site login *******************************************************************************/ - header('Content-Type: text/html; charset=utf-8'); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/users/siteLogin.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/users/infraBlock.class.php"); - - $App = new App(); - $Nav = new Nav(); - $Menu = new Menu(); - $Sitelogin = new Sitelogin(); - $InfraBlock = new InfraBlock(); - $Cla = $App->getCla(); - $App->preventCaching(); - - $App->useSession(TRUE); - - include("_projectCommon.php"); - - $pageTitle = "My Eclipse account"; - $pageKeywords = "eclipse,friends,login,account,signon,sign-on"; - $pageAuthor = "Eclipse Foundation, Inc."; - - // Custom theme variables - $variables = array(); - $variables['main_container_classes'] = 'container-full footer-offset breadcrumbs-offset background-grey'; - $App->setThemeVariables($variables); - - ob_start(); - include("content/en_" . $App->getScriptName()); - $html = ob_get_clean(); - $App->AddExtraJSFooter('<script type="text/javascript" src="control_hipp/hipp_control.jquery.js"></script>'); - - $App->setGoogleAnalyticsTrackingCode(NULL); - $App->generatePage(NULL, $Menu, NULL, $pageAuthor, $pageKeywords, $pageTitle, $html); + header("Location: https://accounts.eclipse.org/user", 301); + exit();
\ No newline at end of file diff --git a/site_login/package.json b/site_login/package.json deleted file mode 100644 index 906fe7d..0000000 --- a/site_login/package.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "name": "solstice", - "version": "0.0.1", - "description": "Solstice is a responsive theme for eclipse.org.", - "main": "Gruntfile.js", - "author": "Christopher Guindon", - "license": "EPL", - "bugs": { - "url": "https://bugs.eclipse.org/bugs/buglist.cgi?component=Website&list_id=8318814&product=Community&resolution=---" - }, - "scripts": { - "bower": "node_modules/.bin/bower", - "grunt": "node_modules/.bin/grunt" - }, - "readmeFilename": "README.md", - "devDependencies": { - "bower": "^1.4.1", - "grunt-cli": "^0.1.13", - "grunt-contrib-concat": "~0.3.0", - "grunt-contrib-copy": "~0.5.0", - "grunt-contrib-less": "~0.9.0", - "grunt-contrib-uglify": "~0.3.2", - "grunt-contrib-watch": "~0.5.3", - "grunt-phpunit": "~0.3.2" - } -} diff --git a/site_login/password_recovery.php b/site_login/password_recovery.php index 055a44e..d3b8650 100644 --- a/site_login/password_recovery.php +++ b/site_login/password_recovery.php @@ -10,50 +10,5 @@ * Denis Roy (Eclipse Foundation)- initial API and implementation * Christopher Guindon (Eclipse Foundation) - Bug 432355 - Update l&f of the Eclipse site login *******************************************************************************/ - header('Content-Type: text/html; charset=utf-8'); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.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"); - - $App = new App(); - $Sitelogin = new Sitelogin('password-recovery'); - $Captcha = new Captcha; - - $App->preventCaching(); - $Theme = $App->getThemeClass(); - - include("_projectCommon.php"); - - $pageTitle = "Eclipse - Password Recovery"; - $pageKeywords = "eclipse, password, recovery"; - $pageAuthor = "Eclipse Foundation, Inc."; - - $Theme->setPageAuthor($pageAuthor); - $Theme->setPageKeywords($pageKeywords); - $Theme->setPageTitle($pageTitle); - - // Custom theme variables - $variables = array(); - $variables['body_classes'] = 'background-grey'; - $variables['main_container_classes'] = 'container-full footer-offset breadcrumbs-offset'; - $App->setThemeVariables($variables); - - $Session = $App->useSession(); - if ($Session->isLoggedIn()) { - $Session->destroy(TRUE); - $App->setSystemMessage('logout', 'You have successfully been logged out.', 'success'); - } - $stage = $Sitelogin->getStage(); - - $var_reset = $Sitelogin->getVariables('reset'); - - ob_start(); - include("content/en_" . $App->getScriptName()); - $html = ob_get_clean(); - - $App->setGoogleAnalyticsTrackingCode(NULL); - # Generate the web page - $Theme->setHtml($html); - $Theme->setLayout('thin-with-footer-min'); - $Theme->setDisplayMore(FALSE); - $Theme->generatePage(); + header("Location: https://accounts.eclipse.org/user/password", 301); + exit();
\ No newline at end of file diff --git a/site_login/public/css/styles.min.css b/site_login/public/css/styles.min.css deleted file mode 100644 index 9eee5ee..0000000 --- a/site_login/public/css/styles.min.css +++ /dev/null @@ -1 +0,0 @@ -h1{margin-bottom:30px;margin-top:10px}.tab-content{background:#fff;padding-top:20px}.block-padding{padding:0 10px 10px 10px}.block-padding h4{font-weight:600;padding-bottom:2px;border-bottom:1px solid #ccc}.block-padding ul{padding-left:20px}.hipp-control-item{padding-bottom:10px}#sys_message{padding-top:20px}.position-static{position:static}
\ No newline at end of file diff --git a/site_login/public/js/script.min.js b/site_login/public/js/script.min.js deleted file mode 100644 index a2484f6..0000000 --- a/site_login/public/js/script.min.js +++ /dev/null @@ -1 +0,0 @@ -jQuery(document).ready(function(){settings={message:"This value is not valid.",container:"tooltip",submitButtons:'button[type="submit"]',feedbackIcons:{valid:"fa fa-check-square",invalid:"fa fa-minus-square",validating:"fa fa-refresh"}},settings_field_username={username:{validators:{notEmpty:{message:"Your email address doesn't appear valid!"},emailAddress:{message:"The is not a valid email address."}}}},settings_field_password_login={password:{message:"Your password is not valid",validators:{notEmpty:{message:"The password field is required and cannot be empty."}}}},settings_field_password={password1:{message:"Your password is not valid",validators:{notEmpty:{message:"The password field is required and cannot be empty."},regexp:{regexp:/(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/,message:"Your password is too simple. It must be at least 6 characters, contain one character and one number."},identical:{field:"password2",message:"Your passwords do not match!"}}}},settings_field_password2={password2:{message:"Your password is not valid",validators:{notEmpty:{message:"The password field is required and cannot be empty."},regexp:{regexp:/(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/,message:"Your password is too simple. It must be at least 6 characters, contain one character and one number."},identical:{field:"password1",message:"Your passwords do not match!"}}}},settings_field_account_password={password1:{message:"Your password is not valid",validators:{stringLength:{min:6,message:"Your password is too simple. It must be at least 6 characters, contain one character and one number."},regexp:{regexp:/(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/,message:"Your password is too simple. It must be at least 6 characters, contain one character and one number."}}}},settings_field_account_password2={password2:{message:"Your password is not valid",validators:{stringLength:{min:6,message:"Your password is too simple. It must be at least 6 characters, contain one character and one number."},identical:{field:"password1",message:"Your passwords do not match!"}}}},settings_field_first_name={fname:{message:"The first name is not valid.",validators:{notEmpty:{message:"The first name is required and cannot be empty."},stringLength:{min:2,max:30,message:"The first name must be more than 2 and less than 30 characters long."}}}},settings_field_last_name={lname:{message:"The last name is not valid",validators:{notEmpty:{message:"The last name is required and cannot be empty."},stringLength:{min:2,max:30,message:"The last name must be more than 2 and less than 30 characters long."}}}},settings_field_agree={agree:{message:"The last name is not valid",validators:{choice:{min:1,max:1,message:"Please agree to Eclipse.org Terms of Use."}}}},settings_changed_employer={changed_employer:{validators:{notEmpty:{message:"You must indicate if you have changed employers in order to save changes to your organization."}}}},settings_field_skill={skill:{message:"The last name is not valid",validators:{between:{min:16,max:16,message:"That is not the right answer!"}}}},settings_field_website={website:{message:"The last name is not valid",validators:{uri:{message:"The website address is not valid"}}}},settings_field_bio={bio:{validators:{stringLength:{max:2e3,message:"The bio must be less than 2000 characters"}}}},settings_field_organization={organization:{validators:{stringLength:{max:255,message:"The organization must be less than 255 characters"}}}},settings_field_jobtitle={jobtitle:{validators:{stringLength:{max:255,message:"The jobtitle must be less than 255 characters"}}}},settings_field_interests={interests:{validators:{stringLength:{max:255,message:"The interests must be less than 255 characters"}}}},settings_field_twitter_handle={twitter_handle:{validators:{stringLength:{max:255,message:"The twitter handle must be less than 255 characters"}}}},settings_field_github={githubid:{validators:{stringLength:{max:255,message:"The github must be less than 255 characters"},regexp:{regexp:/^[^\s+]+$/,message:"Your github ID must not contain any spaces."}}}},settings_field_country={country:{message:"Please select a country",validators:{notEmpty:{message:"The country is required and cannot be empty."},stringLength:{min:2,max:2,message:"The country must be 2 characters long."}}}},settings_field_cla_question_1={question_1:{message:"Question 1 is not valid",validators:{choice:{min:1,max:1,message:"You must accept Question 1."}}}},settings_field_cla_question_2={question_2:{message:"Question 2 is not valid",validators:{choice:{min:1,max:1,message:"You must accept Question 2."}}}},settings_field_cla_question_3={question_3:{message:"Question 3 is not valid",validators:{choice:{min:1,max:1,message:"You must accept Question 3."}}}},settings_field_cla_question_4={question_4:{message:"Question 4 is not valid",validators:{choice:{min:1,max:1,message:"You must accept Question 4."}}}},settings_field_cla_agree={cla_agree:{validators:{notEmpty:{message:'You must enter "I AGREE" in the Electronic Signature field.'},stringLength:{min:7,max:7,message:'You must enter "I AGREE" in the Electronic Signature field.'}}}},settings_field_cla_employer={employer:{validators:{notEmpty:{message:"You must enter your Employer."}}}},settings_field_cla_address={address:{validators:{notEmpty:{message:"You must enter your Address."}}}},form={fields:{}};frm_passwd_fields=form,$.extend(frm_passwd_fields.fields,settings_field_username),frm_login_settings=$.extend({},settings,frm_passwd_fields),$("#frm_passwd").bootstrapValidator(frm_login_settings);frm_create_account_fields=form,$.extend(frm_create_account_fields.fields,settings_field_country,settings_field_username,settings_field_password,settings_field_password2,settings_field_first_name,settings_field_last_name,settings_field_agree,settings_field_skill),frm_login_settings=$.extend({},settings,frm_create_account_fields),$("#frm_create_account").bootstrapValidator(frm_login_settings);frm_create_account_fields=form,$.extend(frm_create_account_fields.fields,settings_field_username,settings_changed_employer,settings_field_password_login,settings_field_account_password,settings_field_account_password2,settings_field_first_name,settings_field_last_name,settings_field_github),frm_login_settings=$.extend({},settings,frm_create_account_fields),$("#frm_accountsettings").bootstrapValidator(frm_login_settings);frm_profile_fields=form,$.extend(frm_profile_fields.fields,settings_field_country,settings_field_website,settings_field_bio,settings_changed_employer,settings_field_organization,settings_field_jobtitle,settings_field_interests,settings_field_twitter_handle),frm_login_settings=$.extend({},settings,frm_profile_fields),$("#frm_profile").bootstrapValidator(frm_login_settings);frm_cla_fields=form,$.extend(frm_cla_fields.fields,settings_field_cla_question_1,settings_field_cla_question_2,settings_field_cla_question_3,settings_field_cla_question_4,settings_field_cla_agree,settings_field_cla_employer,settings_field_cla_address),frm_cla_settings=$.extend({},settings,frm_cla_fields),$("#frm_cla").bootstrapValidator(frm_cla_settings)}),function($,document){$(document).on("shown.bs.tab",function(e){function subscription_form(){$("#subscription-form-submit").click(function(){var text=$(this).text().toLowerCase();$(this).html('<i class="fa fa-spinner fa-pulse"></i> '+text);var posting=$.post(url,{form_name:"mailchimp_form",stage:"mailchimp_"+text});posting.done(function(data){$(target_id).html(data).addClass("loaded"),subscription_form()})})}var target_id=$(e.target).attr("href");if("tab-subscriptions"==$(e.target).attr("id")&&$(target_id).attr("class").indexOf("loaded")<=0){var url=$(e.target).attr("data-url");(url.startsWith("https://dev.eclipse.org")||url.startsWith("https://dev.eclipse.local"))&&$.get(url,function(data){$(target_id).html(data).addClass("loaded"),subscription_form()})}})}(jQuery,document);
\ No newline at end of file diff --git a/site_login/src/js/subscriptions_tab.js b/site_login/src/js/subscriptions_tab.js deleted file mode 100644 index 6c415da..0000000 --- a/site_login/src/js/subscriptions_tab.js +++ /dev/null @@ -1,37 +0,0 @@ -(function($, document) { - - // When the user clicks on the Subscription tab, - // We load the list of newsletters only once. - // We prevent the data to be reloaded by adding a "loaded" class to the body - $(document).on('shown.bs.tab', function (e) { - function subscription_form(){ - $("#subscription-form-submit").click(function() { - var text = $(this).text().toLowerCase(); - $(this).html('<i class="fa fa-spinner fa-pulse"></i> ' + text); - var posting = $.post(url, { - form_name: 'mailchimp_form', - stage: 'mailchimp_' + text, - }); - - posting.done(function(data) { - $(target_id).html(data).addClass('loaded'); - subscription_form(); - }); - return; - }); - } - - var target_id = $(e.target).attr('href'); - if ($(e.target).attr('id') == 'tab-subscriptions' && $(target_id).attr('class').indexOf("loaded") <= 0) { - var url = $(e.target).attr('data-url'); - if (url.startsWith("https://dev.eclipse.org") || url.startsWith("https://dev.eclipse.local")) { - // load the URL's html to the target's body - $.get(url, function(data) { - $(target_id).html(data).addClass('loaded'); - subscription_form(); - }); - } - } - }); - -})(jQuery, document);
\ No newline at end of file diff --git a/site_login/src/js/validation.jquery.js b/site_login/src/js/validation.jquery.js deleted file mode 100644 index 3530a09..0000000 --- a/site_login/src/js/validation.jquery.js +++ /dev/null @@ -1,405 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2014-2016 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christopher Guindon (Eclipse Foundation) - * Eric Poirier (Eclipse Foundation) - *******************************************************************************/ -jQuery(document).ready(function() { - settings = { - message: 'This value is not valid.', - container: 'tooltip', - submitButtons: 'button[type="submit"]', - feedbackIcons: { - valid: 'fa fa-check-square', - invalid: 'fa fa-minus-square', - validating: 'fa fa-refresh' - }, - }; - - settings_field_username = { - username: { - validators: { - notEmpty: { - message: 'Your email address doesn\'t appear valid!' - }, - emailAddress: { - message: 'The is not a valid email address.' - } - } - } - }; - - settings_field_password_login = { - password: { - message: 'Your password is not valid', - validators: { - notEmpty: { - message: 'The password field is required and cannot be empty.' - } - } - } - }; - - settings_field_password = { - password1: { - message: 'Your password is not valid', - validators: { - notEmpty: { - message: 'The password field is required and cannot be empty.' - }, - regexp: { - regexp: /(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/, - message: 'Your password is too simple. It must be at least 6 characters, contain one character and one number.' - }, - identical: { - field: 'password2', - message: 'Your passwords do not match!' - } - } - } - }; - - settings_field_password2 = { - password2: { - message: 'Your password is not valid', - validators: { - notEmpty: { - message: 'The password field is required and cannot be empty.' - }, - regexp: { - regexp: /(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/, - message: 'Your password is too simple. It must be at least 6 characters, contain one character and one number.' - }, - identical: { - field: 'password1', - message: 'Your passwords do not match!' - } - } - } - }; - - settings_field_account_password = { - password1: { - message: 'Your password is not valid', - validators: { - stringLength: { - min: 6, - message: 'Your password is too simple. It must be at least 6 characters, contain one character and one number.' - }, - regexp: { - regexp: /(?=^.{6,}$)(?=.*[\d|\W])(?=.*[A-Za-z]).*$/, - message: 'Your password is too simple. It must be at least 6 characters, contain one character and one number.' - }, - } - } - }; - - settings_field_account_password2 = { - password2: { - message: 'Your password is not valid', - validators: { - stringLength: { - min: 6, - message: 'Your password is too simple. It must be at least 6 characters, contain one character and one number.' - }, - identical: { - field: 'password1', - message: 'Your passwords do not match!' - } - } - } - }; - - settings_field_first_name = { - fname: { - message: 'The first name is not valid.', - validators: { - notEmpty: { - message: 'The first name is required and cannot be empty.' - }, - stringLength: { - min: 2, - max: 30, - message: 'The first name must be more than 2 and less than 30 characters long.' - }, - } - } - } - - settings_field_last_name = { - lname: { - message: 'The last name is not valid', - validators: { - notEmpty: { - message: 'The last name is required and cannot be empty.' - }, - stringLength: { - min: 2, - max: 30, - message: 'The last name must be more than 2 and less than 30 characters long.' - }, - } - } - } - - settings_field_agree = { - agree: { - message: 'The last name is not valid', - validators: { - choice: { - min: 1, - max: 1, - message: 'Please agree to Eclipse.org Terms of Use.' - } - } - } - } - - settings_changed_employer = { - changed_employer: { - validators: { - notEmpty: { - message: 'You must indicate if you have changed employers in order to save changes to your organization.' - }, - } - } - } - - settings_field_skill = { - skill: { - message: 'The last name is not valid', - validators: { - between: { - min: 16, - max: 16, - message: 'That is not the right answer!' - } - } - } - } - - settings_field_website = { - website: { - message: 'The last name is not valid', - validators: { - uri: { - message: 'The website address is not valid' - } - } - } - } - - settings_field_bio = { - bio: { - validators: { - stringLength: { - max: 2000, - message: 'The bio must be less than 2000 characters' - } - } - } - } - - settings_field_organization = { - organization: { - validators: { - stringLength: { - max: 255, - message: 'The organization must be less than 255 characters' - } - } - } - } - - settings_field_jobtitle = { - jobtitle: { - validators: { - stringLength: { - max: 255, - message: 'The jobtitle must be less than 255 characters' - } - } - } - } - - settings_field_interests = { - interests: { - validators: { - stringLength: { - max: 255, - message: 'The interests must be less than 255 characters' - } - } - } - } - - settings_field_twitter_handle = { - twitter_handle: { - validators: { - stringLength: { - max: 255, - message: 'The twitter handle must be less than 255 characters' - } - } - } - } - settings_field_github = { - githubid: { - validators: { - stringLength: { - max: 255, - message: 'The github must be less than 255 characters' - }, - regexp: { - regexp: /^[^\s+]+$/, - message: 'Your github ID must not contain any spaces.' - } - } - } - } - - settings_field_country = { - country: { - message: 'Please select a country', - validators: { - notEmpty: { - message: 'The country is required and cannot be empty.' - }, - stringLength: { - min: 2, - max: 2, - message: 'The country must be 2 characters long.' - }, - } - } - } - - settings_field_cla_question_1 = { - question_1: { - message: 'Question 1 is not valid', - validators: { - choice: { - min: 1, - max: 1, - message: 'You must accept Question 1.' - } - } - } - } - - settings_field_cla_question_2 = { - question_2: { - message: 'Question 2 is not valid', - validators: { - choice: { - min: 1, - max: 1, - message: 'You must accept Question 2.' - } - } - } - } - - settings_field_cla_question_3 = { - question_3: { - message: 'Question 3 is not valid', - validators: { - choice: { - min: 1, - max: 1, - message: 'You must accept Question 3.' - } - } - } - } - - settings_field_cla_question_4 = { - question_4: { - message: 'Question 4 is not valid', - validators: { - choice: { - min: 1, - max: 1, - message: 'You must accept Question 4.' - } - } - } - } - - settings_field_cla_agree = { - cla_agree: { - validators: { - notEmpty: { - message: 'You must enter "I AGREE" in the Electronic Signature field.' - }, - stringLength: { - min: 7, - max: 7, - message: 'You must enter "I AGREE" in the Electronic Signature field.' - } - } - } - } - - settings_field_cla_employer = { - employer: { - validators: { - notEmpty: { - message: 'You must enter your Employer.' - }, - } - } - } - - settings_field_cla_address = { - address: { - validators: { - notEmpty: { - message: 'You must enter your Address.' - }, - } - } - } - - form = { - fields: {} - }; - - // Forgot my password form - var frm_login_fields = {}; - frm_passwd_fields = form; - $.extend(frm_passwd_fields.fields, settings_field_username); - frm_login_settings = $.extend({}, settings, frm_passwd_fields); - $('#frm_passwd').bootstrapValidator(frm_login_settings); - - // Create a New Account form - var frm_login_fields = {}; - frm_create_account_fields = form; - $.extend(frm_create_account_fields.fields, settings_field_country, settings_field_username, settings_field_password, settings_field_password2, settings_field_first_name, settings_field_last_name, settings_field_agree, settings_field_skill); - frm_login_settings = $.extend({}, settings, frm_create_account_fields); - $('#frm_create_account').bootstrapValidator(frm_login_settings); - - var frm_login_fields = {}; - frm_create_account_fields = form; - $.extend(frm_create_account_fields.fields, settings_field_username, settings_changed_employer, settings_field_password_login, settings_field_account_password, settings_field_account_password2, settings_field_first_name, settings_field_last_name, settings_field_github); - frm_login_settings = $.extend({}, settings, frm_create_account_fields); - $('#frm_accountsettings').bootstrapValidator(frm_login_settings); - - var frm_login_fields = {}; - frm_profile_fields = form; - $.extend(frm_profile_fields.fields, settings_field_country, settings_field_website, settings_field_bio, settings_changed_employer, settings_field_organization, settings_field_jobtitle, settings_field_interests, settings_field_twitter_handle); - frm_login_settings = $.extend({}, settings, frm_profile_fields); - $('#frm_profile').bootstrapValidator(frm_login_settings); - - var frm_login_fields = {}; - frm_cla_fields = form; - $.extend(frm_cla_fields.fields, settings_field_cla_question_1, settings_field_cla_question_2, settings_field_cla_question_3, settings_field_cla_question_4, settings_field_cla_agree, settings_field_cla_employer, settings_field_cla_address); - frm_cla_settings = $.extend({}, settings, frm_cla_fields); - $('#frm_cla').bootstrapValidator(frm_cla_settings); - -});
\ No newline at end of file diff --git a/site_login/src/less/styles.less b/site_login/src/less/styles.less deleted file mode 100644 index 693664f..0000000 --- a/site_login/src/less/styles.less +++ /dev/null @@ -1,37 +0,0 @@ -/*Default Variables*/ - -@import './bower_components/solstice-assets/stylesheets/_mixins.less'; -@import "./bower_components/bootstrap/less/variables.less"; -@import "./bower_components/solstice-assets/stylesheets/_variables.less"; -h1{ - margin-bottom:30px; - margin-top:10px; -} -.tab-content{ - background:#fff; - padding-top:20px; -} - -.block-padding{ - padding:0 10px 10px 10px; - h4{ - font-weight:600; - padding-bottom:2px; - border-bottom:1px solid #ccc; - } - ul{ - padding-left:20px; - } -} - -.hipp-control-item{ - padding-bottom:10px; -} - -#sys_message{ - padding-top:20px; -} - -.position-static{ - position:static; -}
\ No newline at end of file diff --git a/site_login/subscriptions.php b/site_login/subscriptions.php deleted file mode 100644 index 3cdccdd..0000000 --- a/site_login/subscriptions.php +++ /dev/null @@ -1,19 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2016 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christopher Guindon (Eclipse Foundation) - initial API and implementation - *******************************************************************************/ -header('Content-Type: text/html; charset=utf-8'); -require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); - -$App = new App(); -$App->useSession(TRUE); - -$Subscriptions = $App->getSubscriptions(); -print $Subscriptions->output(); diff --git a/site_login/tests/content/en_validate.takemeback.php b/site_login/tests/content/en_validate.takemeback.php deleted file mode 100644 index 0105386..0000000 --- a/site_login/tests/content/en_validate.takemeback.php +++ /dev/null @@ -1,52 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2014-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Denis Roy (Eclipse Foundation)- initial API and implementation - * Christopher Guindon (Eclipse Foundation) - Bug 432355 - Update l&f of the Eclipse site login - *******************************************************************************/ - -//if name of the file requested is the same as the current file, the script will exit directly. -if(basename(__FILE__) == basename($_SERVER['PHP_SELF'])){exit();} - -?> -<div class="container padding-bottom" style="padding-top:2em;"> - <div class="col-md-24"> - <h1><?php print $pageTitle;?></h1> - <ul> - <?php - $domains = array( - 'https://testeclipse.org/', - 'https://www.testeclipse.org', - 'https://eclipse.org.testeclipse.org', - 'https://eclipse.org', - 'https://eclipse.org/', - 'https://eclipse.local:50243', - 'https://eclipse.local:50243/', - 'https://marketplace.eclipse.org/', - 'https://marketplace.eclipse.org', - 'https://www.marketplace.eclipse.org', - 'https://marketplace.eclipse.local:50043', - 'https://marketplace.eclipse.local:50043/', - 'https://polarsys.org', - 'https://polarsys.org/', - 'https://www.polarsys.org', - 'https://bugs.polarsys.org', - 'https://bugs.polarsys.org/dsfdsfdsf.dsfom', - 'http://www.eclipse.org.someevilsite.com/nasty.php' - ); - - foreach ($domains as $d) { - $class = ($Sitelogin->validateTakemebackUrl($d)) ? 'green' : 'red'; - print '<li class="' . $class . '">' . $d . '</li>'; - } - ?> - </ul> - </div> -</div> - diff --git a/site_login/tests/validate.takemeback.php b/site_login/tests/validate.takemeback.php deleted file mode 100644 index 57f3db2..0000000 --- a/site_login/tests/validate.takemeback.php +++ /dev/null @@ -1,44 +0,0 @@ -<?php -/******************************************************************************* - * Copyright (c) 2014-2015 Eclipse Foundation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Christopher Guindon (Eclipse Foundation) - initial API and implementation - *******************************************************************************/ - - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/classes/users/siteLogin.class.php"); - - $App = new App(); - $Nav = new Nav(); - $Menu = new Menu(); - $Sitelogin = new Sitelogin(); - - $App->preventCaching(); - - include("../_projectCommon.php"); - - $pageTitle = "Test \$Sitelogin->validateTakemebackUrl()"; - $pageKeywords = ""; - $pageAuthor = "Eclipse Foundation, Inc."; - - // Custom theme variables - $variables = array(); - $variables['main_container_classes'] = 'container-full footer-offset breadcrumbs-offset background-grey'; - $App->setThemeVariables($variables); - - ob_start(); - include("content/en_" . $App->getScriptName()); - $html = ob_get_clean(); - - $App->setGoogleAnalyticsTrackingCode(NULL); - # Generate the web page - - $App->AddExtraHtmlHeader('<META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">'); - $App->generatePage($theme, $Menu, NULL, $pageAuthor, $pageKeywords, $pageTitle, $html); diff --git a/site_login/token.php b/site_login/token.php index a7d35d1..d74e4b5 100644 --- a/site_login/token.php +++ b/site_login/token.php @@ -10,37 +10,5 @@ * Denis Roy (Eclipse Foundation)- initial API and implementation * Christopher Guindon (Eclipse Foundation) - Bug 432355 - Update l&f of the Eclipse site login *******************************************************************************/ - header('Content-Type: text/html; charset=utf-8'); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/app.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/nav.class.php"); - require_once($_SERVER['DOCUMENT_ROOT'] . "/eclipse.org-common/system/menu.class.php"); - - $App = new App(); - $Nav = new Nav(); - $Menu = new Menu(); - - $App->preventCaching(); - $Session = $App->useSession(); - # Bug 443883 - [site_login] Password change should invalidate all active sessions - if ($Session->isLoggedIn()) { - $Session->destroy(TRUE); - } - - $token = $App->getHTTPParameter("t"); - $p = $App->getHTTPParameter("p"); - $url_suffix = ""; - - // Password reset stage 2. - if ($p == 'p') { - $url_suffix = '&p=p'; - } - $stage = $App->getHTTPParameter("stage"); - - $page = 'password_recovery'; - if ($stage == 'confirm'){ - $page = 'index'; - $url_suffix = '&stage=confirm'; - } - - $token = preg_replace("/[^a-zA-Z0-9]/", "", $token); - header("Location: " . $page . ".php?t=" . $token . $url_suffix, 302); + header("Location: https://accounts.eclipse.org/user/token/" . $token, 301); + exit();
\ No newline at end of file |
