ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilPasswordInputGUI Class Reference

This class represents a password property in a property form. 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
 symbol ()
 
 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 class represents a password property in a property form.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Deprecated:
12 This component will be removed with ILIAS 12

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

Constructor & Destructor Documentation

◆ __construct()

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

Reimplemented from ilFormPropertyGUI.

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

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

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 169 of file class.ilPasswordInputGUI.php.

169 : bool
170 {
172
173 $pass_value = $this->getInput();
174 $retype_value = ($this->getUseStripSlashes())
175 ? $this->str($this->getPostVar() . "_retype")
176 : $this->raw($this->getPostVar() . "_retype");
177
178 if ($this->getRequired() && trim($pass_value) == "") {
179 $this->setAlert($lng->txt("msg_input_is_required"));
180 return false;
181 }
182 if ($this->getValidateAuthPost() != "") {
183 $auth = ilAuthUtils::_getAuthMode($this->str($this->getValidateAuthPost()));
184
185 // check, if password is required dependent on auth mode
187 && trim($pass_value) == "") {
188 $this->setAlert($lng->txt("form_password_required_for_auth"));
189 return false;
190 }
191
192 // check, if password is allowed to be set for given auth mode
193 if (trim($pass_value) != "" &&
195 $this->setAlert($lng->txt("form_password_not_allowed_for_auth"));
196 return false;
197 }
198 }
199 if ($this->getRetype() &&
200 ($pass_value != $retype_value)) {
201 $this->setAlert($lng->txt("passwd_not_match"));
202 return false;
203 }
204 if (!$this->getSkipSyntaxCheck() &&
205 !ilSecuritySettingsChecker::isPassword($pass_value, $custom_error) &&
206 $pass_value != "") {
207 if ($custom_error != '') {
208 $this->setAlert($custom_error);
209 } else {
210 $this->setAlert($lng->txt("passwd_invalid"));
211 }
212 return false;
213 }
214
215 return $this->checkSubItemsInput();
216 }
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)

References $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 218 of file class.ilPasswordInputGUI.php.

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

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

+ Here is the call graph for this function:

◆ getMaxLength()

ilPasswordInputGUI::getMaxLength ( )

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

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

◆ getRequiredOnAuth()

ilPasswordInputGUI::getRequiredOnAuth ( )

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

129 : bool
130 {
132 }

◆ getRetype()

ilPasswordInputGUI::getRetype ( )

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

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

◆ getRetypeValue()

ilPasswordInputGUI::getRetypeValue ( )

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

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

◆ getSize()

ilPasswordInputGUI::getSize ( )

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

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

◆ getSkipSyntaxCheck()

ilPasswordInputGUI::getSkipSyntaxCheck ( )

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

139 : bool
140 {
142 }

◆ getUseStripSlashes()

ilPasswordInputGUI::getUseStripSlashes ( )

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

164 : bool
165 {
167 }

◆ getValidateAuthPost()

ilPasswordInputGUI::getValidateAuthPost ( )

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

118 : string
119 {
121 }

◆ getValue()

ilPasswordInputGUI::getValue ( )

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

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

◆ insert()

ilPasswordInputGUI::insert ( ilTemplate  $a_tpl)

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

291 : void
292 {
293 $html = $this->render();
294
295 $a_tpl->setCurrentBlock("prop_generic");
296 $a_tpl->setVariable("PROP_GENERIC", $html);
297 $a_tpl->parseCurrentBlock();
298 }
setVariable($variable, $value='')
Sets a variable value.
Definition: IT.php:544
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 149 of file class.ilPasswordInputGUI.php.

149 : bool
150 {
152 }

◆ render()

ilPasswordInputGUI::render ( )

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

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

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

◆ setMaxLength()

ilPasswordInputGUI::setMaxLength ( int  $a_maxlength)

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

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

◆ setRequiredOnAuth()

ilPasswordInputGUI::setRequiredOnAuth ( bool  $a_requiredonauth)

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

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

◆ setRetype()

ilPasswordInputGUI::setRetype ( bool  $a_val)

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

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

Referenced by __construct().

+ Here is the caller graph for this function:

◆ setRetypeValue()

ilPasswordInputGUI::setRetypeValue ( string  $a_retypevalue)

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

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

◆ setSize()

ilPasswordInputGUI::setSize ( int  $a_size)

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

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

◆ setSkipSyntaxCheck()

ilPasswordInputGUI::setSkipSyntaxCheck ( bool  $a_val)

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

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

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 159 of file class.ilPasswordInputGUI.php.

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

◆ setValidateAuthPost()

ilPasswordInputGUI::setValidateAuthPost ( string  $a_validateauthpost)

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

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

◆ setValue()

ilPasswordInputGUI::setValue ( string  $a_value)

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

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

◆ setValueByArray()

ilPasswordInputGUI::setValueByArray ( array  $a_values)

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

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

Field Documentation

◆ $autocomplete_disabled

bool ilPasswordInputGUI::$autocomplete_disabled = true
protected

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

◆ $maxlength

int ilPasswordInputGUI::$maxlength = 0
protected

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

◆ $requiredonauth

bool ilPasswordInputGUI::$requiredonauth = false
protected

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

◆ $retype

bool ilPasswordInputGUI::$retype = false
protected

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

◆ $retypevalue

string ilPasswordInputGUI::$retypevalue = ""
protected

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

◆ $size

int ilPasswordInputGUI::$size = 20
protected

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

◆ $skip_syntax_check

bool ilPasswordInputGUI::$skip_syntax_check = false
protected

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

◆ $use_strip_slashes

bool ilPasswordInputGUI::$use_strip_slashes = true
protected

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

◆ $validateauthpost

string ilPasswordInputGUI::$validateauthpost = ""
protected

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

◆ $value

string ilPasswordInputGUI::$value = ""
protected

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


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