Skip to content
This repository has been archived by the owner on Jan 20, 2024. It is now read-only.

Commit

Permalink
Fixed issues with contexts and a false return value in Login() method…
Browse files Browse the repository at this point in the history
… of Login component.
  • Loading branch information
mchisari authored and The Appleseed Project committed Oct 5, 2010
1 parent 377b792 commit ad1aa59
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions components/login/controllers/login.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function Display ( $pView = null, $pData = array ( ) ) {
}


$this->GetSys ( 'Session' )->Context ( $this->Get ( 'Context' ) );
$this->GetSys ( 'Session' )->Context ( "login.login.(.*)." . $pView );
$sessionData['Identity'] = $this->GetSys ( 'Session' )->Get( 'Identity' );
$this->GetSys ( 'Session' )->Delete ( 'Identity' );

Expand Down Expand Up @@ -139,7 +139,7 @@ private function _PrepareMessages ( $pScope ) {

$id = $pScope . "-login-message";

$this->GetSys ( "Session" )->Context ( $this->Get ( "Context" ) );
$this->GetSys ( "Session" )->Context ( "login.login.(.*)." . $pScope );
$message = $this->GetSys ( "Session" )->Get ( "Message" );
$error = $this->GetSys ( "Session" )->Get ( "Error" );

Expand Down Expand Up @@ -199,14 +199,15 @@ function Login () {

$this->Login->Display();

return ( false );
return ( true );
}
}

private function _SetContexts ( ) {
// Set the context for all of the forms.
$hiddenContexts = $this->Login->Find( "input[name=Context]" );
foreach ( $hiddenContexts as $hiddenContext ) {
// @todo Find a better way to find and modify contexts
$hiddenContext->value = $this->_Context;
}
}
Expand Down Expand Up @@ -254,7 +255,7 @@ private function _SetLogin ( $pUserID, $pRemember = false ) {
function Join ( ) {

$session = $this->GetSys ( "Session" );
$session->Context ( $this->Get ( "Context" ) );
$session->Context ( "login.login.(.*).join" );

$config = $this->Get ( "Config" );
$invites = $config['invites'];
Expand Down Expand Up @@ -410,7 +411,7 @@ function Forgot ( $pView = null, $pData = null ) {

if ( !$username ) {

$this->GetSys ( "Session" )->Context ( $this->Get ( "Context" ) );
$this->GetSys ( "Session" )->Context ( "login.login.(.*).login" );
$this->GetSys ( "Session" )->Set ( "Message", "Invalid Username" );
$this->GetSys ( "Session" )->Set ( "Error", 1 );

Expand All @@ -425,7 +426,7 @@ function Forgot ( $pView = null, $pData = null ) {

$userAuth->Retrieve ( array ( "Username" => $username ) );
if (! $userAuth->Fetch() ) {
$this->GetSys ( "Session" )->Context ( $this->Get ( "Context" ) );
$this->GetSys ( "Session" )->Context ( "login.login.(.*).login" );
$this->GetSys ( "Session" )->Set ( "Message", __( "Username Not Found", array ( "username" => $username ) ) );
$this->GetSys ( "Session" )->Set ( "Error", 1 );
return ( $this->Display ( $pView, $pData ) );
Expand Down Expand Up @@ -453,14 +454,14 @@ function Forgot ( $pView = null, $pData = null ) {

if ( !$this->Mailer->Send ( $from, $fromName, $to, $toName, $subject, $body ) ) {
// Couldn't send out the message, so error without resetting the pw.
$this->GetSys ( "Session" )->Context ( $this->Get ( "Context" ) );
$this->GetSys ( "Session" )->Context ( "login.login.(.*).login" );
$this->GetSys ( "Session" )->Set ( "Message", "Error Sending Message" );
$this->GetSys ( "Session" )->Set ( "Error", 1 );
} else {
// Reset the pw.
$userAuth->Set ( "Pass", $newpass );
$userAuth->Save();
$this->GetSys ( "Session" )->Context ( $this->Get ( "Context" ) );
$this->GetSys ( "Session" )->Context ( "login.login.(.*).login" );
$this->GetSys ( "Session" )->Set ( "Message", __( "Password Has Been Reset", array ( "email" => $to ) ) );
$this->GetSys ( "Session" )->Set ( "Error", 0 );
}
Expand Down

0 comments on commit ad1aa59

Please sign in to comment.