Toggle to set password visible

This commit is contained in:
Phyks 2013-09-04 23:04:05 +02:00
parent 6e774619c1
commit c29104ba83
8 changed files with 22 additions and 6 deletions

1
TODO
View File

@ -18,6 +18,7 @@ TODO :
* Add / Edit a bill * Add / Edit a bill
* JSON output * JSON output
* Arrow to toggle visible password * Arrow to toggle visible password
* Change tpl easily
To test : To test :
========= =========

View File

@ -10,6 +10,7 @@
require_once('inc/CSRF.inc.php'); require_once('inc/CSRF.inc.php');
raintpl::$tpl_dir = 'tpl/'; raintpl::$tpl_dir = 'tpl/';
raintpl::$cache_dir = 'tmp/'; raintpl::$cache_dir = 'tmp/';
raintpl::configure('base_url', htmlspecialchars(BASE_URL));
// Define raintpl instance // Define raintpl instance
$tpl = new raintpl(); $tpl = new raintpl();
@ -20,6 +21,9 @@
$tpl->assign('base_url', htmlspecialchars(BASE_URL)); $tpl->assign('base_url', htmlspecialchars(BASE_URL));
$tpl->assign('currency', htmlspecialchars(CURRENCY)); $tpl->assign('currency', htmlspecialchars(CURRENCY));
$tpl->assign('email_webmaster', htmlspecialchars(EMAIL_WEBMASTER)); $tpl->assign('email_webmaster', htmlspecialchars(EMAIL_WEBMASTER));
// TODO : Avoid a bug in rainTPL with img near input
$tpl->configure('path_replace_list', array('a', 'img', 'link', 'script'));
// Set sessions parameters // Set sessions parameters
ini_set('session.use_cookies', 1); ini_set('session.use_cookies', 1);

View File

@ -139,7 +139,7 @@
<p><label for="mysql_host">MySQL host : </label><input type="text" name="mysql_host" id="mysql_host" value="<?php echo (!empty($_POST['mysql_host'])) ? htmlspecialchars($_POST['mysql_host']) : 'localhost';?>"/></p> <p><label for="mysql_host">MySQL host : </label><input type="text" name="mysql_host" id="mysql_host" value="<?php echo (!empty($_POST['mysql_host'])) ? htmlspecialchars($_POST['mysql_host']) : 'localhost';?>"/></p>
<p><label for="mysql_login">MySQL login : </label><input type="text" name="mysql_login" id="mysql_login" value="<?php echo (!empty($_POST['mysql_login'])) ? htmlspecialchars($_POST['mysql_login']) : '';?>"/></p> <p><label for="mysql_login">MySQL login : </label><input type="text" name="mysql_login" id="mysql_login" value="<?php echo (!empty($_POST['mysql_login'])) ? htmlspecialchars($_POST['mysql_login']) : '';?>"/></p>
<p><label for="mysql_password">MySQL password : </label><input type="password" name="mysql_password" id="mysql_password"/> <a href="" onclick="toggle_password('mysql_password'); return false;"><img src="img/toggle_password.jpg" alt="Toggle visible"/></a></p> <p><label for="mysql_password">MySQL password : </label><input type="password" name="mysql_password" id="mysql_password"/> <a href="" onclick="toggle_password('mysql_password'); return false;"><img src="tpl/img/toggleVisible.png" alt="Toggle visible"/></a></p>
<p> <p>
<label for="mysql_db">Name of the MySQL database to use : </label><input type="text" name="mysql_db" id="mysql_db" value="<?php echo (!empty($_POST['mysql_db'])) ? htmlspecialchars($_POST['mysql_db']) : 'Bouffe@Ulm';?>"/><br/> <label for="mysql_db">Name of the MySQL database to use : </label><input type="text" name="mysql_db" id="mysql_db" value="<?php echo (!empty($_POST['mysql_db'])) ? htmlspecialchars($_POST['mysql_db']) : 'Bouffe@Ulm';?>"/><br/>
<em>Note :</em> You <em>must</em> create this database first. <em>Note :</em> You <em>must</em> create this database first.
@ -165,7 +165,7 @@
<legend>Administrator</legend> <legend>Administrator</legend>
<p><label for="admin_login">Username of the admin : </label><input type="text" name="admin_login" id="admin_login" <?php echo (!empty($_POST['admin_login'])) ? 'value="'.htmlspecialchars($_POST['admin_login']).'"' : '';?>/></p> <p><label for="admin_login">Username of the admin : </label><input type="text" name="admin_login" id="admin_login" <?php echo (!empty($_POST['admin_login'])) ? 'value="'.htmlspecialchars($_POST['admin_login']).'"' : '';?>/></p>
<p><label for="admin_display_name">Displayed name for admin user : </label><input type="text" name="admin_display_name" id="admin_display_name" <?php echo (!empty($_POST['admin_display_name']) ? 'value="'.htmlspecialchars($_POST['admin_display_name']).'"' : '');?>/></p> <p><label for="admin_display_name">Displayed name for admin user : </label><input type="text" name="admin_display_name" id="admin_display_name" <?php echo (!empty($_POST['admin_display_name']) ? 'value="'.htmlspecialchars($_POST['admin_display_name']).'"' : '');?>/></p>
<p><label for="admin_password">Password for the admin : </label><input type="password" name="admin_password" id="admin_password"/> <a href="" onclick="toggle_password('admin_password'); return false;"><img src="img/toggle_password.jpg" alt="Toggle visible"/></a></p> <p><label for="admin_password">Password for the admin : </label><input type="password" name="admin_password" id="admin_password"/> <a href="" onclick="toggle_password('admin_password'); return false;"><img src="tpl/img/toggleVisible.jpg" alt="Toggle visible"/></a></p>
</fieldset> </fieldset>
<p class="center"><input <?php echo (!empty($block_form)) ? 'disabled ' : '';?>type="submit" value="Install"><input type="hidden" name="token" value="<?php echo generate_token('install');?>"/></p> <p class="center"><input <?php echo (!empty($block_form)) ? 'disabled ' : '';?>type="submit" value="Install"><input type="hidden" name="token" value="<?php echo generate_token('install');?>"/></p>
</form> </form>

View File

@ -4,7 +4,7 @@
<form method="post" action="index.php?do=connect" id="connexion_form"> <form method="post" action="index.php?do=connect" id="connexion_form">
<p><label for="login" class="label-block">Username : </label><input type="text" name="login" id="login" value="{$user_post}"/></p> <p><label for="login" class="label-block">Username : </label><input type="text" name="login" id="login" value="{$user_post}"/></p>
<p><label for="password" class="label-block">Password : </label><input type="password" name="password" id="password"/></p> <p><label for="password" class="label-block">Password : </label><input type="password" name="password" id="password"/> <a href="" onclick="toggle_password('password'); return false;"><img src="img/toggleVisible.png" alt="Toggle visible"/></a></p>
<p><input type="checkbox" name="remember_me" id="remember_me" value="1"/><label for="remember_me"> Remember me ?</label></p> <p><input type="checkbox" name="remember_me" id="remember_me" value="1"/><label for="remember_me"> Remember me ?</label></p>
<p><input type="submit" value="Connect"/><input type="hidden" name="token" value="{$token}"/></p> <p><input type="submit" value="Connect"/><input type="hidden" name="token" value="{$token}"/></p>
<p><a href="mailto:{$email_webmaster}?subject={$instance_title}%20password">Forgotten password ?</a></p> <p><a href="mailto:{$email_webmaster}?subject={$instance_title}%20password">Forgotten password ?</a></p>

View File

@ -15,6 +15,17 @@ fieldset {
margin-bottom: 1em; margin-bottom: 1em;
} }
form a {
position: relative;
}
form img {
height: 1.5em;
vertical-align: middle;
position: absolute;
left: .5em;
}
table { table {
margin: auto; margin: auto;
text-align: center; text-align: center;

View File

@ -37,7 +37,7 @@
<label for="display_name" class="label-block">Displayed name : </label><input type="text" name="display_name" id="display_name" {if condition="$display_name_post != ''"} value="{$display_name_post}" {else} {$user_id != -1 ? 'value="'.$user_data->getDisplayName().'"' : ''} {/if}/> <label for="display_name" class="label-block">Displayed name : </label><input type="text" name="display_name" id="display_name" {if condition="$display_name_post != ''"} value="{$display_name_post}" {else} {$user_id != -1 ? 'value="'.$user_data->getDisplayName().'"' : ''} {/if}/>
</p> </p>
<p> <p>
<label for="password" class="label-block">Password : </label><input type="password" name="password" id="password"/> <label for="password" class="label-block">Password : </label><input type="password" name="password" id="password"/> <a href="" onclick="toggle_password('password'); return false;"><img src="img/toggleVisible.png" alt="Toggle visible"/></a>
{if condition="$user_id != -1"} {if condition="$user_id != -1"}
<br/><em>Note :</em> Leave blank this field if you don't want to edit password. <br/><em>Note :</em> Leave blank this field if you don't want to edit password.
{/if} {/if}
@ -58,7 +58,7 @@
<h2>Edit your password</h2> <h2>Edit your password</h2>
<form method="post" action="index.php?do=password" id="edit_password_form"> <form method="post" action="index.php?do=password" id="edit_password_form">
<p><label for="password" class="label-block">New password : </label><input type="password" id="password" name="password"/></p> <p><label for="password" class="label-block">New password : </label><input type="password" id="password" name="password"/></p>
<p><label for="password_confirm" class="label-block">Confirm new password : </label><input type="password" id="password_confirm" name="password_confirm"/></p> <p><label for="password_confirm" class="label-block">Confirm new password : </label><input type="password" id="password_confirm" name="password_confirm"/> <a href="" onclick="toggle_password('password_confirm'); return false;"><img src="img/toggleVisible.png" alt="Toggle visible"/></a></p>
<p class="center"><input type="submit" value="Update"/><input type="hidden" name="token" value="{$token}"</p> <p class="center"><input type="submit" value="Update"/><input type="hidden" name="token" value="{$token}"</p>
</form> </form>
{/if} {/if}

BIN
tpl/img/toggleVisible.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 490 B

View File

@ -26,7 +26,7 @@
<p><label for="mysql_login">MySQL login : </label><input type="text" name="mysql_login" id="mysql_login" value="{$mysql_login}"/></p> <p><label for="mysql_login">MySQL login : </label><input type="text" name="mysql_login" id="mysql_login" value="{$mysql_login}"/></p>
<p> <p>
<label for="mysql_password">MySQL password : </label><input type="password" name="mysql_password" id="mysql_password"/> <a href="" onclick="toggle_password('mysql_password'); return false;"><img src="img/toggle_password.jpg" alt="Toggle visible"/></a><br/> <label for="mysql_password">MySQL password : </label><input type="password" name="mysql_password" id="mysql_password"/> <a href="" onclick="toggle_password('mysql_password'); return false;"><img src="img/toggleVisible.png" alt="Toggle visible"/></a><br/>
<em>Note :</em> Leave the above field blank if you don't want to change your password. <em>Note :</em> Leave the above field blank if you don't want to change your password.
</p> </p>
<p> <p>