/** * Constructor * */ public function __construct($user_instance) { $this->user = $user_instance; $this->formKey = $this->generateKey(); //Store the form key in the session $_SESSION['formKey'] = $this->formKey; //$this->old_formKey = $_SESSION['formKey']; //We need the previous key so we store it if (isset($_SESSION['formKey'])) { $this->old_formKey = $_SESSION['formKey']; } parent::__construct([], ["formKey" => ["type" => "hidden", "value" => $this->formKey], "username" => ["type" => "text", "label" => "Username"], "password" => ["type" => "password", "label" => "Password"], "submit" => ["type" => "submit", "value" => "Log in", "callback" => [$this, "callbackSubmit"]]]); }
/** * Constructor * */ public function __construct() { parent::__construct([], ['username' => ['type' => 'text', 'label' => 'Username', 'required' => true, 'placeholder' => 'Username', 'maxlength' => 255, 'validation' => ['not_empty']], 'fullname' => ['type' => 'text', 'label' => 'Full name', 'required' => true, 'maxlength' => 255, 'placeholder' => 'Full name', 'validation' => ['not_empty']], 'email' => ['type' => 'email', 'label' => 'Email', 'required' => true, 'placeholder' => 'email address', 'validation' => ['not_empty', 'email_adress']], 'profile' => ['type' => 'textarea', 'label' => 'Profile', 'required' => true, 'placeholder' => 'User profile', 'validation' => ['not_empty']], 'password' => ['type' => 'password', 'label' => 'Password', 'required' => true, 'validation' => ['not_empty']], 'passwordAgain' => ['type' => 'password', 'label' => 'Password again', 'required' => true, 'validation' => ['match' => 'password', 'not_empty']], 'agreement' => ['type' => 'checkbox', 'label' => 'I agree', 'required' => true, 'validation' => ['must_accept']], 'submit' => ['type' => 'submit', 'value' => 'Create user', 'callback' => [$this, 'callbackSubmit']]]); }