1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-20 04:32:01 +02:00

Fixed password-protected pages.

This commit is contained in:
Cameron 2015-02-07 01:45:36 -08:00
parent bbd28e5572
commit 572d66e77a
5 changed files with 56 additions and 13 deletions

View File

@ -20,6 +20,7 @@ e107::css('inline',"
");
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/lan_page.php');
$e_sub_cat = 'custom';
@ -468,10 +469,10 @@ class page_admin_ui extends e_admin_ui
// Options Tab.
'page_datestamp' => array('title'=> LAN_DATE, 'tab' => 1, 'type' => 'datestamp', 'data'=>'int', 'width' => 'auto','writeParms'=>'auto=1'),
'page_class' => array('title'=> LAN_USERCLASS, 'tab' => 1, 'type' => 'userclass', 'data'=>'int', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
'page_class' => array('title'=> LAN_VISIBILITY, 'tab' => 1, 'type' => 'userclass', 'data'=>'int', 'inline'=>true, 'width' => 'auto', 'filter' => true, 'batch' => true),
'page_rating_flag' => array('title'=> LAN_RATING, 'tab' => 1, 'type' => 'boolean', 'data'=>'int', 'width' => '5%', 'thclass' => 'center', 'class' => 'center' ),
'page_comment_flag' => array('title'=> ADLAN_114, 'tab' => 1, 'type' => 'boolean', 'data'=>'int', 'width' => '5%', 'thclass' => 'center', 'class' => 'center' ),
// 'page_password' => array('title'=> LXAN_USER_05, 'type' => 'text', 'width' => 'auto'),
'page_password' => array('title'=> LAN_PAGE_9, 'tab' => 1, 'type' => 'text', 'data'=>'str', 'width' => 'auto', 'writeParms'=>array('password'=>1, 'nomask'=>1, 'size' => 40, 'class' => 'tbox e-password', 'generate' => 1, 'strength' => 1)),
'page_sef' => array('title'=> LAN_SEFURL, 'tab' => 1, 'type' => 'text', 'inline'=>true, 'width' => 'auto', 'writeParms'=>'size=xxlarge'),
'page_metakeys' => array('title'=> LAN_KEYWORDS, 'tab' => 1, 'type' => 'tags', 'width' => 'auto'),
'page_metadscr' => array('title'=> CUSLAN_11, 'tab' => 1, 'type' => 'text', 'width' => 'auto', 'writeParms'=>'size=xxlarge'),

View File

@ -53,11 +53,20 @@ $sc_style['CPAGENAV|default']['post'] = '</div>';
// used only when password authorization is required
$PAGE_TEMPLATE['default']['authorize'] = '
<div class="cpage-restrict">
<div class="cpage-restrict ">
{message}
{form_open}
<h2>{caption}</h2>
<div clas="center">{label} {password} {submit}</div>
<div class="panel panel-default">
<div class="panel-heading">{caption}</div>
<div class="panel-body">
<div class="form-group">
<label class="col-sm-3 control-label">{label}</label>
<div class="col-sm-9">
{password} {submit}
</div>
</div>
</div>
</div>
{form_close}
</div>
';

View File

@ -1062,7 +1062,12 @@ class e_form
if(vartrue($options['generate']))
{
$gen = '&nbsp;<a href="#" class="btn btn-default btn-small e-tip" id="Spn_PasswordGenerator" title="Generate a password">Generate</a> <a class="btn btn-default btn-small e-tip" href="#" id="showPwd" title="Display the password">Show</a><br />';
$gen = '&nbsp;<a href="#" class="btn btn-default btn-small e-tip" id="Spn_PasswordGenerator" title="Generate a password">Generate</a> ';
if(empty($options['nomask']))
{
$gen .= '<a class="btn btn-default btn-small e-tip" href="#" id="showPwd" title="Display the password">Show</a><br />';
}
}
if(vartrue($options['strength']))
@ -1079,10 +1084,19 @@ class e_form
$options['class'] .= ' form-control';
}
if(vartrue($options['size']) && !is_numeric($options['size']))
{
$options['class'] .= " input-".$options['size'];
unset($options['size']); // don't include in html 'size='.
}
$type = empty($options['nomask']) ? 'password' : 'text';
$options = $this->format_options('text', $name, $options);
//never allow id in format name-value for text fields
$text = "<input type='password' name='{$name}' value='{$value}' maxlength='{$maxlength}'".$this->get_attributes($options, $name)." />";
$text = "<input type='".$type."' name='{$name}' value='{$value}' maxlength='{$maxlength}'".$this->get_attributes($options, $name)." />";
if(empty($gen) && empty($addon))
{
@ -2316,7 +2330,7 @@ class e_form
break;
case 'submit':
$def_options['class'] = 'button';
$def_options['class'] = 'button btn btn-primary';
unset($def_options['checked'], $def_options['selected'], $def_options['readonly']);
break;
@ -3570,11 +3584,28 @@ class e_form
break;
// case 'email':
case 'text':
case 'password': // encrypts to md5 when saved.
$maxlength = vartrue($parms['maxlength'], 255);
unset($parms['maxlength']);
$ret = vartrue($parms['pre']).$this->text($key, $value, $maxlength, $parms).vartrue($parms['post']); // vartrue($parms['__options']) is limited. See 'required'=>true
$ret = vartrue($parms['pre']).$this->password($key, $value, $maxlength, $parms).vartrue($parms['post']); // vartrue($parms['__options']) is limited. See 'required'=>true
break;
case 'text':
$maxlength = vartrue($parms['maxlength'], 255);
unset($parms['maxlength']);
if(!empty($parms['password'])) // password mechanism without the md5 storage.
{
$ret = vartrue($parms['pre']).$this->password($key, $value, $maxlength, $parms).vartrue($parms['post']);
}
else
{
$ret = vartrue($parms['pre']).$this->text($key, $value, $maxlength, $parms).vartrue($parms['post']); // vartrue($parms['__options']) is limited. See 'required'=>true
}
break;
case 'tags':

View File

@ -12,7 +12,7 @@ thead tr {
}
table.adminlist { border-left:1px solid #212121; border-right:1px solid #212121; border-bottom:1px solid #212121}
div.navbar-inner { border: 1px solid #212121; }
div.navbar-inner { border-bottom: 1px solid #212121; border-left: 1px solid #212121; border-right: 1px solid #212121; border-top:0px}
.adminlist tr > td {

View File

@ -743,11 +743,11 @@ class pageClass
$frm = e107::getForm();
$extend->caption = LAN_PAGE_8;
$extend->label = LAN_PAGE_9;
$extend->password = $frm->password('page_pw');
$extend->password = $frm->password('page_pw','',50,'size=xlarge&required=1');
$extend->icon = e_IMAGE_ABS.'generic/password.png';
$extend->submit = $frm->submit('submit_page_pw', LAN_PAGE_10);
// FIXME - add form open/close e_form methods
$extend->form_open = '<form method="post" action="'.e_REQUEST_URI.'" id="pwform">';
$extend->form_open = '<form method="post" class="form-inline" action="'.e_REQUEST_URI.'" id="pwform">';
$extend->form_close = '</form>';
$template = $tp->parseTemplate($this->template['start'], true).$this->template['authorize'].$tp->parseTemplate($this->template['end'] ,true);
$this->renderMode = 'cpage-authorize';
@ -952,6 +952,8 @@ class pageClass
if(isset($_POST['submit_page_pw']))
{
if($_POST['page_pw'] == $page_password)
{
$this->setPageCookie();