|
From: <al...@us...> - 2007-09-05 00:23:27
|
Revision: 551
http://sciret.svn.sourceforge.net/sciret/?rev=551&view=rev
Author: alpeb
Date: 2007-09-04 17:23:25 -0700 (Tue, 04 Sep 2007)
Log Message:
-----------
handle special authentication case for upgrade
Modified Paths:
--------------
branches/release-candidates/sciret-1.2/actions/Upgrade.php
branches/release-candidates/sciret-1.2/models/UserGateway.php
Modified: branches/release-candidates/sciret-1.2/actions/Upgrade.php
===================================================================
--- branches/release-candidates/sciret-1.2/actions/Upgrade.php 2007-09-04 00:04:01 UTC (rev 550)
+++ branches/release-candidates/sciret-1.2/actions/Upgrade.php 2007-09-05 00:23:25 UTC (rev 551)
@@ -17,7 +17,7 @@
function dispatch() {
require 'models/UserGateway.php';
$this->userGateway = new UserGateway;
- if (!($user = $this->userGateway->getValidatedUser($_POST['username'], $_POST['password'])) || !$user->isAdmin()) {
+ if (!($user = $this->userGateway->getValidatedUser($_POST['username'], $_POST['password'], $this->configuration)) || !$user->isAdmin()) {
$_SESSION['message'] = $this->user->lang('Wrong Username or Password');
Library::redirect(Library::getLink(array('view' => 'Upgrade')));
}
Modified: branches/release-candidates/sciret-1.2/models/UserGateway.php
===================================================================
--- branches/release-candidates/sciret-1.2/models/UserGateway.php 2007-09-04 00:04:01 UTC (rev 550)
+++ branches/release-candidates/sciret-1.2/models/UserGateway.php 2007-09-05 00:23:25 UTC (rev 551)
@@ -14,8 +14,12 @@
class UserGateway extends Model {
- function getValidatedUser($username, $password) {
- $query = 'SELECT user_id, firstname, lastname, username, email, password_changed, admin FROM users WHERE username=? AND password=MD5(?)';
+ function getValidatedUser($username, $password, $configuration) {
+ if (in_array($configuration->getConfigValue('version'), array(0, '1.1.0'))) {
+ $query = 'SELECT user_id, firstname, lastname, username, email, admin FROM users WHERE username=? AND password=MD5(?)';
+ } else {
+ $query = 'SELECT user_id, firstname, lastname, username, email, password_changed, admin FROM users WHERE username=? AND password=MD5(?)';
+ }
$result = $this->db->query($query, $username, $password);
if ($row = $result->fetch()) {
$user = new User;
@@ -24,7 +28,9 @@
$user->setLastName($row['lastname']);
$user->setUserName($row['username']);
$user->setEmail($row['email']);
- $user->setPasswordChanged($row['password_changed']);
+ if (!in_array($configuration->getConfigValue('version'), array(0, '1.1.0'))) {
+ $user->setPasswordChanged($row['password_changed']);
+ }
$user->setAdmin($row['admin']);
return $user;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|