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

Move default admin #7026

Merged
merged 3 commits into from
Jun 15, 2017
Merged

Conversation

Firesphere
Copy link
Contributor

@Firesphere Firesphere commented Jun 14, 2017

Required for #6387

…thenticator, unifying and removing duplicate code.
->first();
}

// Validate against member if possible
if ($member && !$asDefaultAdmin) {
$result = $member->checkPassword($data['Password']);
$member->checkPassword($data['Password'], $result);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

$this->checkPassword()

@@ -350,8 +308,17 @@ public function checkPassword($password)
*/
public function isDefaultAdmin()
{
return Security::has_default_admin()
&& $this->Email === Security::default_admin_username();
return DefaultAdminService::isDefaultAdmin($this->Email);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should have a deprecation notice?

Copy link
Contributor

Choose a reason for hiding this comment

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

It's probably ok.

* @param ValidationResult $result
* @return ValidationResult
*/
public function checkPassword(Member $member, $password, ValidationResult $result = null)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

$result is immediately overwritten

Copy link
Contributor

Choose a reason for hiding this comment

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

It's also passed into validateCanLogin() before being overwritten, so it's safe.

@Firesphere
Copy link
Contributor Author

Aside from a little change I requested on Damian's update, this looks good for me to go and would wrap up everything on possible Authentication improvements.

API Improve validation of authentication process
"The provided details don't seem to be correct. Please try again."
));
$member = DefaultAdminService::singleton()->findOrCreateDefaultAdmin();
$member->validateCanLogin($result);
Copy link
Contributor

Choose a reason for hiding this comment

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

$result = $member->validateCanLogin($result);?
I'm not sure if this call does anything otherwise

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe it should indeed be that.

Copy link
Contributor

Choose a reason for hiding this comment

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

Damian has refactored validateCanLogin(&$result) which was pretty much what I had asked :D a consistent method signature

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, right. Agreed, I'm good :)

@flamerohr
Copy link
Contributor

After Damian makes the signature update, I'm happy to merge (or he can if it's green before I get home)

@tractorcow
Copy link
Contributor

Ok, pushed up fix with your feedback @flamerohr

@tractorcow tractorcow merged commit 22e084f into silverstripe:master Jun 15, 2017
@Firesphere Firesphere deleted the move_default_admin branch June 15, 2017 09:05
@@ -0,0 +1,4 @@
Stack trace:
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this file really needed ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

hey...! did not notice it :(

Copy link
Contributor

@dhensby dhensby Jun 15, 2017

Choose a reason for hiding this comment

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

Hmm - it looks like it's been removed at some point from the main repo - so all good

Copy link
Contributor

Choose a reason for hiding this comment

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

I removed it manually, sorry for the mistake!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That was my mistake, swiftly pushing because Damian wanted to take over. Sorry!

Copy link
Contributor

Choose a reason for hiding this comment

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

no problem - it's gone now so allllll good. :)

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.

None yet

4 participants