-
Notifications
You must be signed in to change notification settings - Fork 821
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
Move default admin #7026
Conversation
…thenticator, unifying and removing duplicate code.
19a175a
to
ff0b704
Compare
->first(); | ||
} | ||
|
||
// Validate against member if possible | ||
if ($member && !$asDefaultAdmin) { | ||
$result = $member->checkPassword($data['Password']); | ||
$member->checkPassword($data['Password'], $result); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$this->checkPassword()
ff0b704
to
a549b70
Compare
@@ -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); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$result is immediately overwritten
There was a problem hiding this comment.
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.
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
a549b70
to
62d0953
Compare
"The provided details don't seem to be correct. Please try again." | ||
)); | ||
$member = DefaultAdminService::singleton()->findOrCreateDefaultAdmin(); | ||
$member->validateCanLogin($result); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 :)
After Damian makes the signature update, I'm happy to merge (or he can if it's green before I get home) |
Ok, pushed up fix with your feedback @flamerohr |
@@ -0,0 +1,4 @@ | |||
Stack trace: |
There was a problem hiding this comment.
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 ;)
There was a problem hiding this comment.
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 :(
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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!
There was a problem hiding this comment.
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. :)
Required for #6387