Commit ec7e73a8 authored by Fabrice Gangler's avatar Fabrice Gangler 🎨 Committed by Matthieu FAURE
Browse files

FIX(login form): redirection must be done on /<lang>/

Refs: #929
parent 82f2578e
Pipeline #10106 passed with stage
in 3 minutes and 50 seconds
......@@ -1147,7 +1147,8 @@ class UsersController extends AppController
$user["user_type"] = $this->Users->UserTypes->get($user["user_type_id"])->get("name");
$this->Auth->setUser($user);
$this->Flash->success(__d("Forms", "You are logged"));
return $this->redirect($this->Auth->redirectUrl("/"));
$lang = $this->selectedLanguage;
return $this->redirect($this->Auth->redirectUrl("/$lang/"));
}
$this->Flash->error(__d("Forms", "You are not logged"));
}
......
......@@ -35,6 +35,7 @@ class AcceptanceTester extends Actor
{
use _generated\AcceptanceTesterActions;
private $lang = 'en';
/**
* With $email as login,
......@@ -44,15 +45,17 @@ class AcceptanceTester extends Actor
* @param String $email Email of the user account
* @param String $password Password of the user account
* @param String $userName Name of the user account
* @param int|null $userId expected user ID, by default is null
*
* @return void
*/
public function loginMe($email, $password, $userName)
public function loginMe(string $email, string $password, string $userName, int $userId = null)
{
$lang = $this->lang;
$I = $this;
$I->amOnPage('/');
$I->amOnPage("/$lang/");
$I->click('//nav/ul[2]/li[3]/a');
$I->seeInCurrentUrl('/users/login');
$I->seeInCurrentUrl("/$lang/users/login");
$I->submitForm(
'#signinform',
[
......@@ -60,7 +63,11 @@ class AcceptanceTester extends Actor
'password' => $password
]
);
$I->canSeeLink($userName, ('/'));
if (is_null($userId)) {
$I->canSeeLink($userName, ("/$lang/users/"));
} else {
$I->canSeeLink($userName, ("/$lang/users/$userId"));
}
}
/**
......
......@@ -29,12 +29,18 @@ use App\TestSuite\Codeception\AcceptanceTester;
class UserAdministrationCheckActionsCest
{
private $lang = 'en';
private $userId = 284;
// @codingStandardsIgnoreStart
public function _before(AcceptanceTester $I)// @codingStandardsIgnoreEnd
{
$I->amOnPage('/');
$I->loginMe('dev-collectivite@comptoir-du-libre.org', 'comptoir', 'dev-collectivite');
$I->loginMe(
'dev-collectivite@comptoir-du-libre.org',
'comptoir',
'dev-collectivite',
$this->userId
);
$I->seeElement('div.message.success');
}
......
......@@ -28,12 +28,18 @@ use App\TestSuite\Codeception\AcceptanceTester;
class UserAssociationCheckActionsCest
{
private $lang = 'en';
private $userId = 287;
// @codingStandardsIgnoreStart
public function _before(AcceptanceTester $I)// @codingStandardsIgnoreEnd
{
$I->amOnPage('/');
$I->loginMe('dev-asso@comptoir-du-libre.org', 'comptoir', 'dev-asso');
$I->loginMe(
'dev-asso@comptoir-du-libre.org',
'comptoir',
'dev-asso',
$this->userId
);
$I->seeElement('div.message.success');
}
......
......@@ -29,12 +29,18 @@ use App\TestSuite\Codeception\AcceptanceTester;
class UserPersonCheckActionsCest
{
private $lang = 'en';
private $userId = 285;
// @codingStandardsIgnoreStart
public function _before(AcceptanceTester $I)// @codingStandardsIgnoreEnd
{
$I->amOnPage('/');
$I->loginMe('dev-individu@comptoir-du-libre.org', 'comptoir', 'dev-individu');
$I->loginMe(
'dev-individu@comptoir-du-libre.org',
'comptoir',
'dev-individu',
$this->userId
);
$I->seeElement('div.message.success');
}
......
......@@ -28,12 +28,18 @@ use App\TestSuite\Codeception\AcceptanceTester;
class UserProviderCheckActionsCest
{
private $lang = 'en';
private $userId = 286;
// @codingStandardsIgnoreStart
public function _before(AcceptanceTester $I)// @codingStandardsIgnoreEnd
{
$I->amOnPage('/');
$I->loginMe('dev-presta@comptoir-du-libre.org', 'comptoir', 'dev-presta');
$I->loginMe(
'dev-presta@comptoir-du-libre.org',
'comptoir',
'dev-presta',
$this->userId
);
$I->seeElement('div.message.success');
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment