StefGuev
StefGuev

Reputation: 649

Silverstripe custom security check show custom error message

I try to create a custom validate function to add to $LoginForm.

1- All members in group "Client" must be validated before they can login.

2- They will be redirected to the $LoginForm and show a custom message if account is not validated.

Is it possible to do that or must I program a new login form? If possible what is the easiest way to do this.

Upvotes: 0

Views: 155

Answers (1)

StefGuev
StefGuev

Reputation: 649

Ok I found the solution. I have to extend DataExtension to Member object with :

public function canLogIn($result) {

        if(!$this->owner->Validation) {
            $result->error('You must validate your account before you can log in.');
        }
    }

And it work.

Upvotes: 2

Related Questions