Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFC: Identify and fix Authentication issue(s). #1221

Merged
merged 23 commits into from
Jun 5, 2015
Merged

RFC: Identify and fix Authentication issue(s). #1221

merged 23 commits into from
Jun 5, 2015

Conversation

tommyvdv
Copy link

@tommyvdv tommyvdv commented Jun 2, 2015

  • Identify and resolve issues causing unexpected login results.
  • Add functionality to the users edit action to allow a user access even without an id parameter or index rights.
  • Coming from the login form, the edit action will now edit "self" instead of redirecting to an error page. (d9194b1)
  • Add more tests. (One of which fails due to an unexpected redirect. 7a52608)

resolves #1175

Tommy Van de Velde added 10 commits May 21, 2015 13:44
Not setting this results in false information within the same cycle.
The foreach loop sets the module variable each time.
If no valid module is present, the last module will find its way to the
redirect. Since it is not a valid module for this user, the "no rights"
error will appear.
The class retains values in the test and pollutes one login attempt with
previously set credentials. The introduction of the tearDown function
allows us to "reset" the class in the case that any one process would
log in, out and in again with different users.

This probably wont be a common real world scenario.
Prepare for the next test.
The test fails. It seems the getParameter method and the lack of GET
parameters could have something to do with it.
Perform both authentication checks in the same fashion to avoid
confusion. Include the allowed action in the redirect.
The action can be seperately enabled by the admin (in groups). If this
is the first available action for the user, it would break.

The added checks let the user edit 'self'.
@@ -427,6 +427,9 @@ public static function loginUser($login, $password)
\SpoonSession::set('backend_logged_in', true);
\SpoonSession::set('backend_secret_key', $session['secret_key']);

// Update/instantiate the value for the logged_in container.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we never start comments with capital letters.

$form = $crawler->selectButton('login')->form();
$this->submitForm($client, $form, array(
'form' => 'authenticationIndex',
'backend_email' => 'users-edit-user@fork-cms.com',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think these credentials are correct. They are not available in the test database. The tests fail with this error: "Your e-mail and password combination is incorrect."

The correct credentials for the user in the testdatabase are user noreply@fork-cms.com with password fork (as tested in the first passing test in this class).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fixed now 👍

if (BackendAuthentication::getUser()->isAuthenticated()) {
$this->redirect($this->getParameter('querystring', 'string', BackendModel::createUrlForAction(null, 'Dashboard')));
if (BackendAuthentication::getUser()->isAuthenticated())
{
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please change this to one line?

if (BackendAuthentication::getUser()->isAuthenticated()) {

@WouterSioen WouterSioen merged commit 4fcd432 into forkcms:master Jun 5, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Backend Bug for User who logs out.
3 participants