BUGFIX Fixed call to Member function that didn't exist

MINOR Check if OldPassword data exists before running checkPassword()

git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@65135 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
Sean Harvey 2008-11-03 03:41:14 +00:00
parent 99589e626f
commit b93a8257f4

View File

@ -22,7 +22,7 @@ class ChangePasswordForm extends Form {
function __construct($controller, $name, $fields = null, $actions = null) { function __construct($controller, $name, $fields = null, $actions = null) {
if(!$fields) { if(!$fields) {
$fields = new FieldSet(); $fields = new FieldSet();
if(Member::currentUser() && (!isset($_REQUEST['h']) || !Member::member_from_autologin($_REQUEST['h']))) { if(Member::currentUser() && (!isset($_REQUEST['h']) || !Member::member_from_autologinhash($_REQUEST['h']))) {
$fields->push(new PasswordField("OldPassword",_t('Member.YOUROLDPASSWORD', "Your old password"))); $fields->push(new PasswordField("OldPassword",_t('Member.YOUROLDPASSWORD', "Your old password")));
} }
@ -47,7 +47,7 @@ class ChangePasswordForm extends Form {
function doChangePassword(array $data) { function doChangePassword(array $data) {
if($member = Member::currentUser()) { if($member = Member::currentUser()) {
// The user was logged in, check the current password // The user was logged in, check the current password
if($member->checkPassword($data['OldPassword']) == false) { if(isset($data['OldPassword']) && $member->checkPassword($data['OldPassword']) == false) {
$this->clearMessage(); $this->clearMessage();
$this->sessionMessage( $this->sessionMessage(
_t('Member.ERRORPASSWORDNOTMATCH', "Your current password does not match, please try again"), _t('Member.ERRORPASSWORDNOTMATCH', "Your current password does not match, please try again"),