Adding passwordless message instead of throwing an exception

This commit is contained in:
Will Morgan 2013-05-30 14:16:12 +01:00 committed by Ingo Schommer
parent 92135acc14
commit 1c0ae76f8e

View File

@ -210,6 +210,11 @@ class Member extends DataObject implements TemplateGlobalProvider {
public function checkPassword($password) { public function checkPassword($password) {
$result = $this->canLogIn(); $result = $this->canLogIn();
if(empty($this->Password) && $this->exists()) {
$result->error(_t('Member.NoPassword','There is no password on this member.'));
return $result;
}
$e = PasswordEncryptor::create_for_algorithm($this->PasswordEncryption); $e = PasswordEncryptor::create_for_algorithm($this->PasswordEncryption);
if(!$e->check($this->Password, $password, $this->Salt, $this)) { if(!$e->check($this->Password, $password, $this->Salt, $this)) {
$result->error(_t ( $result->error(_t (