Source of file PasswordForm.php
Size: 2,082 Bytes - Last Modified: 2021-12-24T06:47:29+00:00
/var/www/docs.ssmods.com/process/src/src/forms/PasswordForm.php
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677 | <?php namespace Firesphere\PartialUserforms\Forms; use Firesphere\PartialUserforms\Controllers\PartialUserFormVerifyController; use SilverStripe\Forms\FieldList; use SilverStripe\Forms\Form; use SilverStripe\Forms\FormAction; use SilverStripe\Forms\PasswordField; use SilverStripe\Forms\RequiredFields; use SilverStripe\Forms\Validator; class PasswordForm extends Form { public const PASSWORD_SESSION_KEY = 'PartialFormSession'; /** * PasswordForm constructor. * @param PartialUserFormVerifyController|null $controller * @param string $name * @param FieldList|null $fields * @param FieldList|null $actions * @param Validator|null $validator */ public function __construct( PartialUserFormVerifyController $controller = null, $name = self::DEFAULT_NAME, FieldList $fields = null, FieldList $actions = null, Validator $validator = null ) { if (!$fields) { $fields = $this->getFields(); } if (!$actions) { $actions = $this->getActions(); } if (!$validator) { $validator = $this->getFormValidator(); } parent::__construct($controller, $name, $fields, $actions, $validator); $this->setFormAction(sprintf('/verify/%s', $name)); // Add the userform class to the form, so it's can be styled similar to the actual userforms more easily $this->addExtraClass('userform'); } /** * @return FieldList */ protected function getFields() { return FieldList::create([ PasswordField::create('Password', _t(__CLASS__ . '.PasswordField', 'Password')) ]); } /** * @return FieldList */ protected function getActions() { return FieldList::create([ FormAction::create('doValidate', _t(__CLASS__ . '.Validate', 'Submit')) ]); } /** * @return RequiredFields */ public function getFormValidator() { return RequiredFields::create(['Password']); } } |