ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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 ($a_title="", $a_postvar="")
 Constructor. More...
 
 setValue ($a_value)
 Set Value. More...
 
 getValue ()
 Get Value. More...
 
 setRetype ($a_val)
 Set retype on/off. More...
 
 getRetype ()
 Get retype on/off. More...
 
 setRetypeValue ($a_retypevalue)
 Set Retype Value. More...
 
 getRetypeValue ()
 Get Retype Value. More...
 
 setMaxLength ($a_maxlength)
 Set Max Length. More...
 
 getMaxLength ()
 Get Max Length. More...
 
 setSize ($a_size)
 Set Size. More...
 
 setValueByArray ($a_values)
 Set value by array. More...
 
 getSize ()
 Get Size. More...
 
 setValidateAuthPost ($a_validateauthpost)
 Set Validate required status against authentication POST var. More...
 
 getValidateAuthPost ()
 Get Validate required status against authentication POST var. More...
 
 setRequiredOnAuth ($a_requiredonauth)
 Set input required, if authentication mode allows password setting. More...
 
 getRequiredOnAuth ()
 Get input required, if authentication mode allows password setting. More...
 
 setSkipSyntaxCheck ($a_val)
 Set skip syntax check. More...
 
 getSkipSyntaxCheck ()
 Get skip syntax check. More...
 
 setDisableHtmlAutoComplete ($a_value)
 Set autocomplete. More...
 
 isHtmlAutoCompleteDisabled ()
 Get autocomplete. More...
 
 setUseStripSlashes ($a_stat)
 En/disable use of stripslashes. More...
 
 getUseStripSlashes ()
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 render ()
 Render item. More...
 
 insert ($a_tpl)
 Insert property html. More...
 
- Public Member Functions inherited from ilSubEnabledFormPropertyGUI
 addSubItem ($a_item)
 Add Subitem. More...
 
 getSubItems ()
 Get Subitems. More...
 
 getSubInputItemsRecursive ()
 returns a flat array of possibly existing subitems recursively More...
 
 checkSubItemsInput ()
 Check SubItems. More...
 
 getSubForm ()
 Get sub form html. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
- Public Member Functions inherited from ilFormPropertyGUI
 __construct ($a_title="", $a_postvar="")
 Constructor. More...
 
 executeCommand ()
 Execute command. More...
 
 getType ()
 Get Type. More...
 
 setTitle ($a_title)
 Set Title. More...
 
 getTitle ()
 Get Title. More...
 
 setPostVar ($a_postvar)
 Set Post Variable. More...
 
 getPostVar ()
 Get Post Variable. More...
 
 getFieldId ()
 Get Post Variable. More...
 
 setInfo ($a_info)
 Set Information Text. More...
 
 getInfo ()
 Get Information Text. More...
 
 setAlert ($a_alert)
 Set Alert Text. More...
 
 getAlert ()
 Get Alert Text. More...
 
 setRequired ($a_required)
 Set Required. More...
 
 getRequired ()
 Get Required. More...
 
 setDisabled ($a_disabled)
 Set Disabled. More...
 
 getDisabled ()
 Get Disabled. More...
 
 checkInput ()
 Check input, strip slashes etc. More...
 
 setParentForm ($a_parentform)
 Set Parent Form. More...
 
 getParentForm ()
 Get Parent Form. More...
 
 setParent ($a_val)
 Set Parent GUI object. More...
 
 getParent ()
 Get Parent GUI object. More...
 
 getSubForm ()
 Get sub form html. More...
 
 hideSubForm ()
 Sub form hidden on init? More...
 
 setHiddenTitle ($a_val)
 Set hidden title (for screenreaders) More...
 
 getHiddenTitle ()
 Get hidden title. More...
 
 getItemByPostVar ($a_post_var)
 Get item by post var. More...
 
 serializeData ()
 serialize data More...
 
 unserializeData ($a_data)
 unserialize data More...
 
 writeToSession ()
 Write to session. More...
 
 clearFromSession ()
 Clear session value. More...
 
 readFromSession ()
 Read from session. More...
 
 getHiddenTag ($a_post_var, $a_value)
 Get hidden tag (used for disabled properties) More...
 
 setMulti ($a_multi, $a_sortable=false, $a_addremove=true)
 Set Multi. More...
 
 getMulti ()
 Get Multi. More...
 
 setMultiValues (array $a_values)
 Set multi values. More...
 
 getMultiValues ()
 Get multi values. More...
 
 getContentOutsideFormTag ()
 Get content that has to reside outside of the parent form tag, e.g. More...
 
 stripSlashesAddSpaceFallback ($a_str)
 Strip slashes with add space fallback, see https://www.ilias.de/mantis/view.php?id=19727. More...
 

Protected Attributes

 $value
 
 $size = 20
 
 $validateauthpost = ""
 
 $requiredonauth = false
 
 $maxlength = false
 
 $use_strip_slashes = true
 
 $autocomplete_disabled = true
 
- Protected Attributes inherited from ilSubEnabledFormPropertyGUI
 $sub_items = array()
 
- Protected Attributes inherited from ilFormPropertyGUI
 $ctrl
 
 $lng
 
 $type
 
 $title
 
 $postvar
 
 $info
 
 $alert
 
 $required = false
 
 $parentgui
 
 $parentform
 
 $hidden_title = ""
 
 $multi = false
 
 $multi_sortable = false
 
 $multi_addremove = true
 
 $multi_values
 

Additional Inherited Members

- Static Public Member Functions inherited from ilFormPropertyGUI
static removeProhibitedCharacters ($a_text)
 Remove prohibited characters see #19159. More...
 
- Protected Member Functions inherited from ilFormPropertyGUI
 setType ($a_type)
 Set Type. More...
 
 getMultiIconsHTML ()
 Get HTML for multiple value icons. More...
 

Detailed Description

This class represents a password property in a property form.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

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

Constructor & Destructor Documentation

◆ __construct()

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

Constructor.

Parameters
string$a_titleTitle
string$a_postvarPost Variable

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

References $DIC, setRetype(), and setSkipSyntaxCheck().

32  {
33  global $DIC;
34 
35  $this->lng = $DIC->language();
36  parent::__construct($a_title, $a_postvar);
37  $this->setRetype(true);
38  $this->setSkipSyntaxCheck(false);
39  }
global $DIC
Definition: saml.php:7
setRetype($a_val)
Set retype on/off.
setSkipSyntaxCheck($a_val)
Set skip syntax check.
+ 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.

Returns
boolean Input ok, true/false

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

References $_POST, $auth, ilFormPropertyGUI\$lng, ilAuthUtils\_allowPasswordModificationByAuthMode(), ilAuthUtils\_getAuthMode(), ilSubEnabledFormPropertyGUI\checkSubItemsInput(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getRequiredOnAuth(), getRetype(), getSkipSyntaxCheck(), getUseStripSlashes(), getValidateAuthPost(), ilUtil\isPassword(), ilFormPropertyGUI\setAlert(), and ilUtil\stripSlashes().

258  {
259  $lng = $this->lng;
260 
261  if ($this->getUseStripSlashes()) {
262  $_POST[$this->getPostVar()] = ilUtil::stripSlashes($_POST[$this->getPostVar()]);
263  $_POST[$this->getPostVar() . "_retype"] = ilUtil::stripSlashes($_POST[$this->getPostVar() . "_retype"]);
264  }
265  if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
266  $this->setAlert($lng->txt("msg_input_is_required"));
267 
268  return false;
269  }
270  if ($this->getValidateAuthPost() != "") {
272 
273  // check, if password is required dependent on auth mode
275  && trim($_POST[$this->getPostVar()]) == "") {
276  $this->setAlert($lng->txt("form_password_required_for_auth"));
277 
278  return false;
279  }
280 
281  // check, if password is allowed to be set for given auth mode
282  if (trim($_POST[$this->getPostVar()]) != "" &&
284  $this->setAlert($lng->txt("form_password_not_allowed_for_auth"));
285 
286  return false;
287  }
288  }
289  if ($this->getRetype() &&
290  ($_POST[$this->getPostVar()] != $_POST[$this->getPostVar() . "_retype"])) {
291  $this->setAlert($lng->txt("passwd_not_match"));
292 
293  return false;
294  }
295  if (!$this->getSkipSyntaxCheck() &&
296  !ilUtil::isPassword($_POST[$this->getPostVar()], $custom_error) &&
297  $_POST[$this->getPostVar()] != "") {
298  if ($custom_error != '') {
299  $this->setAlert($custom_error);
300  } else {
301  $this->setAlert($lng->txt("passwd_invalid"));
302  }
303 
304  return false;
305  }
306 
307  return $this->checkSubItemsInput();
308  }
$auth
Definition: metadata.php:48
getPostVar()
Get Post Variable.
getSkipSyntaxCheck()
Get skip syntax check.
getRetype()
Get retype on/off.
static _getAuthMode($a_auth_mode, $a_db_handler='')
static isPassword($a_passwd, &$customError=null)
validates a password public
setAlert($a_alert)
Set Alert Text.
static _allowPasswordModificationByAuthMode($a_auth_mode)
Allow password modification.
getValidateAuthPost()
Get Validate required status against authentication POST var.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
getRequiredOnAuth()
Get input required, if authentication mode allows password setting.
$_POST["username"]
+ Here is the call graph for this function:

◆ getMaxLength()

ilPasswordInputGUI::getMaxLength ( )

Get Max Length.

Returns
int Max Length

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

References $maxlength.

Referenced by render().

117  {
118  return $this->maxlength;
119  }
+ Here is the caller graph for this function:

◆ getRequiredOnAuth()

ilPasswordInputGUI::getRequiredOnAuth ( )

Get input required, if authentication mode allows password setting.

Returns
boolean require input

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

References $requiredonauth.

Referenced by checkInput().

188  {
189  return $this->requiredonauth;
190  }
+ Here is the caller graph for this function:

◆ getRetype()

ilPasswordInputGUI::getRetype ( )

Get retype on/off.

Returns
boolean retype

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

Referenced by checkInput(), and render().

77  {
78  return $this->retype;
79  }
+ Here is the caller graph for this function:

◆ getRetypeValue()

ilPasswordInputGUI::getRetypeValue ( )

Get Retype Value.

Returns
string Retype Value

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

Referenced by render().

97  {
98  return $this->retypevalue;
99  }
+ Here is the caller graph for this function:

◆ getSize()

ilPasswordInputGUI::getSize ( )

Get Size.

Returns
int Size

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

References $size.

Referenced by render().

148  {
149  return $this->size;
150  }
+ Here is the caller graph for this function:

◆ getSkipSyntaxCheck()

ilPasswordInputGUI::getSkipSyntaxCheck ( )

Get skip syntax check.

Returns
boolean skip syntax check

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

Referenced by checkInput().

208  {
209  return $this->skip_syntax_check;
210  }
+ Here is the caller graph for this function:

◆ getUseStripSlashes()

ilPasswordInputGUI::getUseStripSlashes ( )
Returns
type

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

References $use_strip_slashes.

Referenced by checkInput().

248  {
250  }
+ Here is the caller graph for this function:

◆ getValidateAuthPost()

ilPasswordInputGUI::getValidateAuthPost ( )

Get Validate required status against authentication POST var.

Returns
string POST var

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

References $validateauthpost.

Referenced by checkInput().

168  {
170  }
+ Here is the caller graph for this function:

◆ getValue()

ilPasswordInputGUI::getValue ( )

Get Value.

Returns
string Value

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

References $value.

Referenced by render().

57  {
58  return $this->value;
59  }
+ Here is the caller graph for this function:

◆ insert()

ilPasswordInputGUI::insert (   $a_tpl)

Insert property html.

Returns
int Size

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

References $html, and render().

376  {
377  $html = $this->render();
378 
379  $a_tpl->setCurrentBlock("prop_generic");
380  $a_tpl->setVariable("PROP_GENERIC", $html);
381  $a_tpl->parseCurrentBlock();
382  }
$html
Definition: example_001.php:87
+ Here is the call graph for this function:

◆ isHtmlAutoCompleteDisabled()

ilPasswordInputGUI::isHtmlAutoCompleteDisabled ( )

Get autocomplete.

Returns
bool Value

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

References $autocomplete_disabled.

Referenced by render().

+ Here is the caller graph for this function:

◆ render()

ilPasswordInputGUI::render ( )

Render item.

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

References ilFormPropertyGUI\$lng, ilFormPropertyGUI\getDisabled(), ilFormPropertyGUI\getFieldId(), getMaxLength(), ilFormPropertyGUI\getPostVar(), ilFormPropertyGUI\getRequired(), getRetype(), getRetypeValue(), getSize(), getValue(), isHtmlAutoCompleteDisabled(), and ilUtil\prepareFormOutput().

Referenced by insert().

314  {
315  $lng = $this->lng;
316 
317  $ptpl = new ilTemplate("tpl.prop_password.html", true, true, "Services/Form");
318 
319  if ($this->getRetype()) {
320  $ptpl->setCurrentBlock("retype");
321  $ptpl->setVariable("RSIZE", $this->getSize());
322  $ptpl->setVariable("RID", $this->getFieldId());
323  $ptpl->setVariable("RMAXLENGTH", $this->getMaxLength());
324  $ptpl->setVariable("RPOST_VAR", $this->getPostVar());
325 
326  if ($this->isHtmlAutoCompleteDisabled()) {
327  $ptpl->setVariable("RAUTOCOMPLETE", "autocomplete=\"off\"");
328  }
329 
330  // this is creating an "auto entry" in the setup, if the retype is missing
331  /*$retype_value = ($this->getRetypeValue() != "")
332  ? $this->getRetypeValue()
333  : $this->getValue();*/
334  $retype_value = $this->getRetypeValue();
335  $ptpl->setVariable("PROPERTY_RETYPE_VALUE", ilUtil::prepareFormOutput($retype_value));
336  if ($this->getDisabled()) {
337  $ptpl->setVariable(
338  "RDISABLED",
339  " disabled=\"disabled\""
340  );
341  }
342  $ptpl->setVariable("TXT_RETYPE", $lng->txt("form_retype_password"));
343  $ptpl->parseCurrentBlock();
344  }
345 
346  if (strlen($this->getValue())) {
347  $ptpl->setCurrentBlock("prop_password_propval");
348  $ptpl->setVariable("PROPERTY_VALUE", ilUtil::prepareFormOutput($this->getValue()));
349  $ptpl->parseCurrentBlock();
350  }
351  $ptpl->setVariable("POST_VAR", $this->getPostVar());
352  $ptpl->setVariable("ID", $this->getFieldId());
353  $ptpl->setVariable("SIZE", $this->getSize());
354  $ptpl->setVariable("MAXLENGTH", $this->getMaxLength());
355  if ($this->getDisabled()) {
356  $ptpl->setVariable(
357  "DISABLED",
358  " disabled=\"disabled\""
359  );
360  }
361  if ($this->isHtmlAutoCompleteDisabled()) {
362  $ptpl->setVariable("AUTOCOMPLETE", "autocomplete=\"off\"");
363  }
364  if ($this->getRequired()) {
365  $ptpl->setVariable("REQUIRED", "required=\"required\"");
366  }
367  return $ptpl->get();
368  }
getMaxLength()
Get Max Length.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
getPostVar()
Get Post Variable.
getRetypeValue()
Get Retype Value.
getRetype()
Get retype on/off.
isHtmlAutoCompleteDisabled()
Get autocomplete.
getFieldId()
Get Post Variable.
special template class to simplify handling of ITX/PEAR
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setDisableHtmlAutoComplete()

ilPasswordInputGUI::setDisableHtmlAutoComplete (   $a_value)

Set autocomplete.

Parameters
bool$a_valueValue

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

218  {
219  $this->autocomplete_disabled = (bool) $a_value;
220  }

◆ setMaxLength()

ilPasswordInputGUI::setMaxLength (   $a_maxlength)

Set Max Length.

Parameters
int$a_maxlengthMax Length

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

107  {
108  $this->maxlength = $a_maxlength;
109  }

◆ setRequiredOnAuth()

ilPasswordInputGUI::setRequiredOnAuth (   $a_requiredonauth)

Set input required, if authentication mode allows password setting.

Parameters
boolean$a_requiredonauthrequire input

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

178  {
179  $this->requiredonauth = $a_requiredonauth;
180  }

◆ setRetype()

ilPasswordInputGUI::setRetype (   $a_val)

Set retype on/off.

Parameters
booleanretype

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

Referenced by __construct(), and ilPersonalSettingsGUI\initPasswordForm().

67  {
68  $this->retype = $a_val;
69  }
+ Here is the caller graph for this function:

◆ setRetypeValue()

ilPasswordInputGUI::setRetypeValue (   $a_retypevalue)

Set Retype Value.

Parameters
string$a_retypevalueRetype Value

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

Referenced by setValueByArray().

87  {
88  $this->retypevalue = $a_retypevalue;
89  }
+ Here is the caller graph for this function:

◆ setSize()

ilPasswordInputGUI::setSize (   $a_size)

Set Size.

Parameters
int$a_sizeSize

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

References size.

Referenced by ilSetupGUI\initClientLoginForm(), and ilSetupGUI\initMasterLoginForm().

127  {
128  $this->size = $a_size;
129  }
Set page orientation and size
Definition: 04printing.php:77
+ Here is the caller graph for this function:

◆ setSkipSyntaxCheck()

ilPasswordInputGUI::setSkipSyntaxCheck (   $a_val)

Set skip syntax check.

Parameters
booleanskip syntax check

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

Referenced by __construct().

198  {
199  $this->skip_syntax_check = $a_val;
200  }
+ Here is the caller graph for this function:

◆ setUseStripSlashes()

ilPasswordInputGUI::setUseStripSlashes (   $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.

Parameters
type$a_stat

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

Referenced by ilUserProfile\addStandardFieldsToForm(), ilObjUserGUI\getValues(), and ilStartUpGUI\initStandardLoginForm().

239  {
240  $this->use_strip_slashes = $a_stat;
241  }
+ Here is the caller graph for this function:

◆ setValidateAuthPost()

ilPasswordInputGUI::setValidateAuthPost (   $a_validateauthpost)

Set Validate required status against authentication POST var.

Parameters
string$a_validateauthpostPOST var

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

158  {
159  $this->validateauthpost = $a_validateauthpost;
160  }

◆ setValue()

ilPasswordInputGUI::setValue (   $a_value)

Set Value.

Parameters
string$a_valueValue

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

Referenced by setValueByArray().

47  {
48  $this->value = $a_value;
49  }
+ Here is the caller graph for this function:

◆ setValueByArray()

ilPasswordInputGUI::setValueByArray (   $a_values)

Set value by array.

Parameters
array$a_valuesvalue array

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

References ilFormPropertyGUI\getPostVar(), setRetypeValue(), and setValue().

137  {
138  $this->setValue($a_values[$this->getPostVar()]);
139  $this->setRetypeValue($a_values[$this->getPostVar() . "_retype"]);
140  }
getPostVar()
Get Post Variable.
setRetypeValue($a_retypevalue)
Set Retype Value.
setValue($a_value)
Set Value.
+ Here is the call graph for this function:

Field Documentation

◆ $autocomplete_disabled

ilPasswordInputGUI::$autocomplete_disabled = true
protected

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

Referenced by isHtmlAutoCompleteDisabled().

◆ $maxlength

ilPasswordInputGUI::$maxlength = false
protected

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

Referenced by getMaxLength().

◆ $requiredonauth

ilPasswordInputGUI::$requiredonauth = false
protected

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

Referenced by getRequiredOnAuth().

◆ $size

ilPasswordInputGUI::$size = 20
protected

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

Referenced by getSize().

◆ $use_strip_slashes

ilPasswordInputGUI::$use_strip_slashes = true
protected

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

Referenced by getUseStripSlashes().

◆ $validateauthpost

ilPasswordInputGUI::$validateauthpost = ""
protected

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

Referenced by getValidateAuthPost().

◆ $value

ilPasswordInputGUI::$value
protected

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

Referenced by getValue().


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