openrat-cms

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

commit 4fa98a38cc5063ed9c710ad71b6ae67358a2a54a
parent 56bfcef3ffce81325b24d0e35539e345d8af816a
Author: Jan Dankert <devnull@localhost>
Date:   Sun,  5 Nov 2017 22:59:02 +0100

Fieldsets mit Eingabefeldern können versteckt sein, werden aber bei Validierungsfehlern angezeigt. Beispielhaft umgesetzt für die Kennwort-Neuvergabe.

Diffstat:
auth/InternalAuth.class.php | 5+++--
themes/default/css/openrat.css.php | 6++++++
themes/default/include/elements.ini.php | 2+-
themes/default/include/html/group.inc.php | 2+-
themes/default/js/openrat.js | 4++--
themes/default/templates/login/login.tpl.src.xml | 15++++++++++++++-
6 files changed, 27 insertions(+), 7 deletions(-)

diff --git a/auth/InternalAuth.class.php b/auth/InternalAuth.class.php @@ -33,8 +33,8 @@ SQL if ( empty($row_user) ) // Benutzer ist nicht vorhanden return false; - // Pruefen ob Kennwort mit Datenbank uebereinstimmt - elseif ( $row_user['password_hash'] == $password ) + // Pruefen ob Kennwort mit Datenbank uebereinstimmt. + elseif ( Password::check(User::pepperPassword($password),$row_user['password_hash'],$row_user['password_algo']) && $row_user['password_algo'] == OR_PASSWORD_ALGO_PLAIN ) { // Kennwort stimmt mit Datenbank �berein, aber nur im Klartext. // Das Kennwort muss ge�ndert werden @@ -43,6 +43,7 @@ SQL // Login nicht erfolgreich return false; } + // Pruefen ob Kennwort mit Datenbank uebereinstimmt elseif ( Password::check(User::pepperPassword($password),$row_user['password_hash'],$row_user['password_algo']) ) { // Die Kennwort-Pruefsumme stimmt mit dem aus der Datenbank �berein. diff --git a/themes/default/css/openrat.css.php b/themes/default/css/openrat.css.php @@ -652,8 +652,14 @@ fieldset margin-left:0px; margin-right:0px; padding:10px; + display: none; +} + +fieldset.show { + display: block; } + fieldset > legend { margin-left:30px; diff --git a/themes/default/include/elements.ini.php b/themes/default/include/elements.ini.php @@ -15,7 +15,7 @@ form = action,subaction,id,name:,target:_self,method:post,enctype:applicatio frame = file,name,scrolling frameset = rows,columns frameset-page=menu -group = title,icon,open:true,class +group = title,icon,open:true,class,show:true hidden = name:*,default header = name:,views,back:false editor = name:*,type:*,mode diff --git a/themes/default/include/html/group.inc.php b/themes/default/include/html/group.inc.php @@ -1,5 +1,5 @@ <?php -?><fieldset class="<?php echo $attr_open?'open':'' ?>"><?php if(isset($attr_title)) { ?><legend><?php if(isset($attr_icon)) { ?>&nbsp;&nbsp;<img src="<?php echo $image_dir.'icon_'.$attr_icon.IMG_ICON_EXT ?>" align="left" border="0" /><?php } ?><div class="arrow-right closed" /><div class="arrow-down open" />&nbsp;&nbsp;<?php echo encodeHtml($attr_title) ?>&nbsp;&nbsp;</legend><?php } ?><div> +?><fieldset class="<?php echo $attr_open?'open':'' ?> <?php echo $attr_show?'show':'' ?>"><?php if(isset($attr_title)) { ?><legend><?php if(isset($attr_icon)) { ?>&nbsp;&nbsp;<img src="<?php echo $image_dir.'icon_'.$attr_icon.IMG_ICON_EXT ?>" align="left" border="0" /><?php } ?><div class="arrow-right closed" /><div class="arrow-down open" />&nbsp;&nbsp;<?php echo encodeHtml($attr_title) ?>&nbsp;&nbsp;</legend><?php } ?><div> diff --git a/themes/default/js/openrat.js b/themes/default/js/openrat.js @@ -1348,9 +1348,9 @@ function doResponse(data,status,element) setTimeout( function() { $(notice).fadeOut('slow').remove(); },timeoutSeconds*1000 ); }); + // Felder mit Fehleingaben markieren, ggf. das übergeordnete Fieldset aktivieren. $.each(data['errors'], function(idx,value) { - $('input[name='+value+']').addClass('error'); - $('input[name='+value+']').parent().addClass('error'); + $('input[name='+value+']').addClass('error').parent().addClass('error').parents('fieldset').addClass('show').addClass('open'); }); // Jetzt das erhaltene Dokument auswerten. diff --git a/themes/default/templates/login/login.tpl.src.xml b/themes/default/templates/login/login.tpl.src.xml @@ -88,7 +88,7 @@ <!-- <if true="property:mustChangePassword"> --> - <group title="message:USER_NEW_PASSWORD" open="false"> + <group title="message:USER_NEW_PASSWORD" open="false" show="false"> <part class="line"> <part class="label"> <label for="password1"> @@ -110,6 +110,19 @@ </part> </part> </group> + + <group title="message:USER_TOKEN" open="false" show="false"> + <part class="line"> + <part class="label"> + <label for="user_token"> + <text key="USER_TOKEN"></text> + </label> + </part> + <part class="input"> + <password name="user_token" default="" size="25"></password> + </part> + </part> + </group> <!-- </if> --> <!--