ILIAS  release_8 Revision v8.24
ilPasswordInputGUI Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilPasswordInputGUI:
+ Collaboration diagram for ilPasswordInputGUI:

Public Member Functions

 __construct (string $a_title="", string $a_postvar="")
 
 setValue (string $a_value)
 
 getValue ()
 
 setRetype (bool $a_val)
 
 getRetype ()
 
 setRetypeValue (string $a_retypevalue)
 
 getRetypeValue ()
 
 setMaxLength (int $a_maxlength)
 
 getMaxLength ()
 
 setSize (int $a_size)
 
 setValueByArray (array $a_values)
 
 getSize ()
 
 setValidateAuthPost (string $a_validateauthpost)
 
 getValidateAuthPost ()
 
 setRequiredOnAuth (bool $a_requiredonauth)
 
 getRequiredOnAuth ()
 
 setSkipSyntaxCheck (bool $a_val)
 
 getSkipSyntaxCheck ()
 
 setDisableHtmlAutoComplete (bool $a_value)
 
 isHtmlAutoCompleteDisabled ()
 
 setUseStripSlashes (bool $a_stat)
 En/disable use of stripslashes. More...
 
 getUseStripSlashes ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 getInput ()
 
 render ()
 
 insert (ilTemplate $a_tpl)
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem (ilFormPropertyGUI $a_item)
 
 getSubItems ()
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct (string $a_title="", string $a_postvar="")
 
 executeCommand ()
 
 getType ()
 
 setTitle (string $a_title)
 
 getTitle ()
 
 setPostVar (string $a_postvar)
 
 getPostVar ()
 
 getFieldId ()
 
 setInfo (string $a_info)
 
 getInfo ()
 
 setAlert (string $a_alert)
 
 getAlert ()
 
 setRequired (bool $a_required)
 
 getRequired ()
 
 setDisabled (bool $a_disabled)
 
 getDisabled ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm (ilPropertyFormGUI $a_parentform)
 
 getParentForm ()
 
 setParent (ilFormPropertyGUI $a_val)
 
 getParent ()
 
 getSubForm ()
 
 hideSubForm ()
 
 setHiddenTitle (string $a_val)
 
 getHiddenTitle ()
 
 getItemByPostVar (string $a_post_var)
 Get item by post var. More...
 
 serializeData ()
 
 unserializeData (string $a_data)
 
 setParentTable ($a_val)
 Set parent table. More...
 
 getParentTable ()
 Get parent table. More...
 
 writeToSession ()
 
 clearFromSession ()
 
 readFromSession ()
 
 getHiddenTag (string $a_post_var, string $a_value)
 
 setMulti (bool $a_multi, bool $a_sortable=false, bool $a_addremove=true)
 
 getMulti ()
 
 setMultiValues (array $a_values)
 
 getMultiValues ()
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback (string $a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 
 getTableFilterLabelFor ()
 Get label "for" attribute value for filter. More...
 
 getFormLabelFor ()
 Get label "for" attribute value for form. More...
 
 setRequestParam (string $key, $val)
 This writes the request (aka post) values. More...
 

Protected Attributes

bool $skip_syntax_check = false
 
string $value = ""
 
int $size = 20
 
string $validateauthpost = ""
 
bool $requiredonauth = false
 
int $maxlength = 0
 
bool $use_strip_slashes = true
 
bool $autocomplete_disabled = true
 
string $retypevalue = ""
 
bool $retype = false
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
array $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
array $set_params = []
 
ilTable2GUI $parent_table = null
 
ilFormPropertyGUI $parent_gui = null
 
ilCtrl $ctrl
 
ilLanguage $lng
 
string $type = ""
 
string $title = ""
 
string $postvar = ""
 
string $info = ""
 
string $alert = ""
 
bool $required = false
 
ilPropertyFormGUI $parentform = null
 
string $hidden_title = ""
 
bool $multi = false
 
bool $multi_sortable = false
 
bool $multi_addremove = true
 
array $multi_values = []
 
RequestInterface $request
 
HTTP Services $http
 
Refinery Factory $refinery = null
 
bool $disabled = false
 
ilGlobalTemplateInterface $global_tpl = null
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters (string $a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType (string $a_type)
 
 checkParentFormTable ()
 
 getSessionKey ()
 
 getMultiIconsHTML ()
 
 int ($key)
 
 intArray ($key)
 
 str ($key)
 
 raw ($key)
 
 strArray ($key)
 
 arrayArray ($key)
 
 isRequestParamArray (string $key)
 
 getRequestParam (string $key, Refinery\Transformation $t)
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning This class represents a password property in a property form.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de

Definition at line 26 of file class.ilPasswordInputGUI.php.

Constructor & Destructor Documentation

◆ __construct()

ilPasswordInputGUI::__construct ( string  $a_title = "",
string  $a_postvar = "" 
)

Reimplemented from ilFormPropertyGUI.

Definition at line 42 of file class.ilPasswordInputGUI.php.

45 {
46 global $DIC;
47
48 $this->lng = $DIC->language();
49 parent::__construct($a_title, $a_postvar);
50 $this->setRetype(true);
51 $this->setSkipSyntaxCheck(false);
52 }
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $DIC, ILIAS\GlobalScreen\Provider\__construct(), ILIAS\Repository\lng(), setRetype(), and setSkipSyntaxCheck().

+ Here is the call graph for this function:

Member Function Documentation

◆ checkInput()

ilPasswordInputGUI::checkInput ( )

Check input, strip slashes etc.

set alert, if input is not ok.

Reimplemented from ilFormPropertyGUI.

Definition at line 168 of file class.ilPasswordInputGUI.php.

168 : bool
169 {
171
172 $pass_value = $this->getInput();
173 $retype_value = ($this->getUseStripSlashes())
174 ? $this->str($this->getPostVar() . "_retype")
175 : $this->raw($this->getPostVar() . "_retype");
176
177 if ($this->getRequired() && trim($pass_value) == "") {
178 $this->setAlert($lng->txt("msg_input_is_required"));
179 return false;
180 }
181 if ($this->getValidateAuthPost() != "") {
183
184 // check, if password is required dependent on auth mode
186 && trim($pass_value) == "") {
187 $this->setAlert($lng->txt("form_password_required_for_auth"));
188 return false;
189 }
190
191 // check, if password is allowed to be set for given auth mode
192 if (trim($pass_value) != "" &&
194 $this->setAlert($lng->txt("form_password_not_allowed_for_auth"));
195 return false;
196 }
197 }
198 if ($this->getRetype() &&
199 ($pass_value != $retype_value)) {
200 $this->setAlert($lng->txt("passwd_not_match"));
201 return false;
202 }
203 if (!$this->getSkipSyntaxCheck() &&
204 !ilSecuritySettingsChecker::isPassword($pass_value, $custom_error) &&
205 $pass_value != "") {
206 if ($custom_error != '') {
207 $this->setAlert($custom_error);
208 } else {
209 $this->setAlert($lng->txt("passwd_invalid"));
210 }
211 return false;
212 }
213
214 return $this->checkSubItemsInput();
215 }
static _allowPasswordModificationByAuthMode($a_auth_mode)
Allow password modification.
static _getAuthMode(?string $a_auth_mode)
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
static isPassword(string $a_passwd, ?string &$customError=null)
$auth
Definition: metadata.php:76

References $auth, $lng, ilAuthUtils\_allowPasswordModificationByAuthMode(), ilAuthUtils\_getAuthMode(), ilSecuritySettingsChecker\isPassword(), ILIAS\Repository\raw(), and ILIAS\Repository\str().

+ Here is the call graph for this function:

◆ getInput()

ilPasswordInputGUI::getInput ( )

Definition at line 217 of file class.ilPasswordInputGUI.php.

217 : string
218 {
219 if ($this->getUseStripSlashes()) {
220 return $this->str($this->getPostVar());
221 }
222 return $this->raw($this->getPostVar());
223 }

References ILIAS\Repository\raw(), and ILIAS\Repository\str().

+ Here is the call graph for this function:

◆ getMaxLength()

ilPasswordInputGUI::getMaxLength ( )

Definition at line 90 of file class.ilPasswordInputGUI.php.

90 : int
91 {
92 return $this->maxlength;
93 }

◆ getRequiredOnAuth()

ilPasswordInputGUI::getRequiredOnAuth ( )

Definition at line 128 of file class.ilPasswordInputGUI.php.

128 : bool
129 {
131 }

◆ getRetype()

ilPasswordInputGUI::getRetype ( )

Definition at line 70 of file class.ilPasswordInputGUI.php.

70 : bool
71 {
72 return $this->retype;
73 }

◆ getRetypeValue()

ilPasswordInputGUI::getRetypeValue ( )

Definition at line 80 of file class.ilPasswordInputGUI.php.

80 : string
81 {
82 return $this->retypevalue;
83 }

◆ getSize()

ilPasswordInputGUI::getSize ( )

Definition at line 106 of file class.ilPasswordInputGUI.php.

106 : int
107 {
108 return $this->size;
109 }

◆ getSkipSyntaxCheck()

ilPasswordInputGUI::getSkipSyntaxCheck ( )

Definition at line 138 of file class.ilPasswordInputGUI.php.

138 : bool
139 {
141 }

◆ getUseStripSlashes()

ilPasswordInputGUI::getUseStripSlashes ( )

Definition at line 163 of file class.ilPasswordInputGUI.php.

163 : bool
164 {
166 }

◆ getValidateAuthPost()

ilPasswordInputGUI::getValidateAuthPost ( )

Definition at line 117 of file class.ilPasswordInputGUI.php.

117 : string
118 {
120 }

◆ getValue()

ilPasswordInputGUI::getValue ( )

Definition at line 60 of file class.ilPasswordInputGUI.php.

60 : string
61 {
62 return $this->value;
63 }

◆ insert()

ilPasswordInputGUI::insert ( ilTemplate  $a_tpl)

Definition at line 290 of file class.ilPasswordInputGUI.php.

290 : void
291 {
292 $html = $this->render();
293
294 $a_tpl->setCurrentBlock("prop_generic");
295 $a_tpl->setVariable("PROP_GENERIC", $html);
296 $a_tpl->parseCurrentBlock();
297 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:514
setCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)
parseCurrentBlock(string $part=ilGlobalTemplateInterface::DEFAULT_BLOCK)

References ilTemplate\parseCurrentBlock(), ilTemplate\setCurrentBlock(), and HTML_Template_IT\setVariable().

+ Here is the call graph for this function:

◆ isHtmlAutoCompleteDisabled()

ilPasswordInputGUI::isHtmlAutoCompleteDisabled ( )

Definition at line 148 of file class.ilPasswordInputGUI.php.

148 : bool
149 {
151 }

◆ render()

ilPasswordInputGUI::render ( )

Definition at line 225 of file class.ilPasswordInputGUI.php.

225 : string
226 {
228
229 $ptpl = new ilTemplate("tpl.prop_password.html", true, true, "Services/Form");
230
231 if ($this->getRetype()) {
232 $ptpl->setCurrentBlock("retype");
233 $ptpl->setVariable("RSIZE", $this->getSize());
234 $ptpl->setVariable("RID", $this->getFieldId());
235 if ($this->getMaxLength() > 0) {
236 $ptpl->setCurrentBlock("rmaxlength");
237 $ptpl->setVariable("RMAXLENGTH", $this->getMaxLength());
238 $ptpl->parseCurrentBlock();
239 }
240 $ptpl->setVariable("RPOST_VAR", $this->getPostVar());
241
242 if ($this->isHtmlAutoCompleteDisabled()) {
243 $ptpl->setVariable("RAUTOCOMPLETE", "autocomplete=\"off\"");
244 }
245
246 // this is creating an "auto entry" in the setup, if the retype is missing
247 /*$retype_value = ($this->getRetypeValue() != "")
248 ? $this->getRetypeValue()
249 : $this->getValue();*/
250 $retype_value = $this->getRetypeValue();
251 $ptpl->setVariable("PROPERTY_RETYPE_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($retype_value));
252 if ($this->getDisabled()) {
253 $ptpl->setVariable(
254 "RDISABLED",
255 " disabled=\"disabled\""
256 );
257 }
258 $ptpl->setVariable("TXT_RETYPE", $lng->txt("form_retype_password"));
259 $ptpl->parseCurrentBlock();
260 }
261
262 if (strlen($this->getValue())) {
263 $ptpl->setCurrentBlock("prop_password_propval");
264 $ptpl->setVariable("PROPERTY_VALUE", ilLegacyFormElementsUtil::prepareFormOutput($this->getValue()));
265 $ptpl->parseCurrentBlock();
266 }
267 $ptpl->setVariable("POST_VAR", $this->getPostVar());
268 $ptpl->setVariable("ID", $this->getFieldId());
269 $ptpl->setVariable("SIZE", $this->getSize());
270 if ($this->getMaxLength() > 0) {
271 $ptpl->setCurrentBlock("maxlength");
272 $ptpl->setVariable("MAXLENGTH", $this->getMaxLength());
273 $ptpl->parseCurrentBlock();
274 }
275 if ($this->getDisabled()) {
276 $ptpl->setVariable(
277 "DISABLED",
278 " disabled=\"disabled\""
279 );
280 }
281 if ($this->isHtmlAutoCompleteDisabled()) {
282 $ptpl->setVariable("AUTOCOMPLETE", "autocomplete=\"off\"");
283 }
284 if ($this->getRequired()) {
285 $ptpl->setVariable("REQUIRED", "required=\"required\"");
286 }
287 return $ptpl->get();
288 }
static prepareFormOutput($a_str, bool $a_strip=false)
special template class to simplify handling of ITX/PEAR

References $lng, ILIAS\UI\Implementation\Component\Input\getValue(), and ilLegacyFormElementsUtil\prepareFormOutput().

+ Here is the call graph for this function:

◆ setDisableHtmlAutoComplete()

ilPasswordInputGUI::setDisableHtmlAutoComplete ( bool  $a_value)

Definition at line 143 of file class.ilPasswordInputGUI.php.

143 : void
144 {
145 $this->autocomplete_disabled = $a_value;
146 }

◆ setMaxLength()

ilPasswordInputGUI::setMaxLength ( int  $a_maxlength)

Definition at line 85 of file class.ilPasswordInputGUI.php.

85 : void
86 {
87 $this->maxlength = $a_maxlength;
88 }

◆ setRequiredOnAuth()

ilPasswordInputGUI::setRequiredOnAuth ( bool  $a_requiredonauth)

Definition at line 123 of file class.ilPasswordInputGUI.php.

123 : void
124 {
125 $this->requiredonauth = $a_requiredonauth;
126 }

◆ setRetype()

ilPasswordInputGUI::setRetype ( bool  $a_val)

Definition at line 65 of file class.ilPasswordInputGUI.php.

65 : void
66 {
67 $this->retype = $a_val;
68 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setRetypeValue()

ilPasswordInputGUI::setRetypeValue ( string  $a_retypevalue)

Definition at line 75 of file class.ilPasswordInputGUI.php.

75 : void
76 {
77 $this->retypevalue = $a_retypevalue;
78 }

◆ setSize()

ilPasswordInputGUI::setSize ( int  $a_size)

Definition at line 95 of file class.ilPasswordInputGUI.php.

95 : void
96 {
97 $this->size = $a_size;
98 }

◆ setSkipSyntaxCheck()

ilPasswordInputGUI::setSkipSyntaxCheck ( bool  $a_val)

Definition at line 133 of file class.ilPasswordInputGUI.php.

133 : void
134 {
135 $this->skip_syntax_check = $a_val;
136 }

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setUseStripSlashes()

ilPasswordInputGUI::setUseStripSlashes ( bool  $a_stat)

En/disable use of stripslashes.

e.g on login screen. Otherwise passwords containing "<" are stripped and therefor authentication fails against external authentication services.

Definition at line 158 of file class.ilPasswordInputGUI.php.

158 : void
159 {
160 $this->use_strip_slashes = $a_stat;
161 }

◆ setValidateAuthPost()

ilPasswordInputGUI::setValidateAuthPost ( string  $a_validateauthpost)

Definition at line 112 of file class.ilPasswordInputGUI.php.

112 : void
113 {
114 $this->validateauthpost = $a_validateauthpost;
115 }

◆ setValue()

ilPasswordInputGUI::setValue ( string  $a_value)

Definition at line 54 of file class.ilPasswordInputGUI.php.

56 : void {
57 $this->value = $a_value;
58 }

◆ setValueByArray()

ilPasswordInputGUI::setValueByArray ( array  $a_values)

Definition at line 100 of file class.ilPasswordInputGUI.php.

100 : void
101 {
102 $this->setValue($a_values[$this->getPostVar()] ?? "");
103 $this->setRetypeValue($a_values[$this->getPostVar() . "_retype"] ?? "");
104 }
setRetypeValue(string $a_retypevalue)

Field Documentation

◆ $autocomplete_disabled

bool ilPasswordInputGUI::$autocomplete_disabled = true
protected

Definition at line 38 of file class.ilPasswordInputGUI.php.

◆ $maxlength

int ilPasswordInputGUI::$maxlength = 0
protected

Definition at line 33 of file class.ilPasswordInputGUI.php.

◆ $requiredonauth

bool ilPasswordInputGUI::$requiredonauth = false
protected

Definition at line 32 of file class.ilPasswordInputGUI.php.

◆ $retype

bool ilPasswordInputGUI::$retype = false
protected

Definition at line 40 of file class.ilPasswordInputGUI.php.

◆ $retypevalue

string ilPasswordInputGUI::$retypevalue = ""
protected

Definition at line 39 of file class.ilPasswordInputGUI.php.

◆ $size

int ilPasswordInputGUI::$size = 20
protected

Definition at line 30 of file class.ilPasswordInputGUI.php.

◆ $skip_syntax_check

bool ilPasswordInputGUI::$skip_syntax_check = false
protected

Definition at line 28 of file class.ilPasswordInputGUI.php.

◆ $use_strip_slashes

bool ilPasswordInputGUI::$use_strip_slashes = true
protected

Definition at line 34 of file class.ilPasswordInputGUI.php.

◆ $validateauthpost

string ilPasswordInputGUI::$validateauthpost = ""
protected

Definition at line 31 of file class.ilPasswordInputGUI.php.

◆ $value

string ilPasswordInputGUI::$value = ""
protected

Definition at line 29 of file class.ilPasswordInputGUI.php.


The documentation for this class was generated from the following file: