EspañolEnglish

chuso.net

 
   
Informáticos en huegla por el reconocimiento de nuestras atribuciones
This site is being redeveloped and some features may not work properly
        Pages: 1 2 3 4 5 6 7 8 9Next

Fighting the Firefox password reminder

 Comment

The situation is as follows: a website which, after logging in with an username and a password, allows you to register new users and a Mozilla Firefox user with the option to remember passwords enabled.

The case: the user adds a new account or logs in with an account and then edits this account from another account.

The problem: When the user is adding the new account Firefox will fill the fields with the user and password of the current account. When the user is editing an existing account Firefox will fill the fields with the username and password from the account being edited, which is also in password reminder, if the user is not editing the account with the intent to change its password will not notice that only the first of the two fields "Password" and "Repeat password" is filled, so when the user tries to save it will display "Passwords don't match" error.

Solution:

  • First attempt: rename the password field on the edit form so it doesn't have the same name as the password field in the login form:

    Log in:

    <tr>
      <td><label for="user">Username:</label></td>
      <td><input name="user" id="user" type="text"></td>
    </tr>
    <tr>
      <td><label for="pass">Password:</label></td>
      <td><input name="pass" id="pass" type="password"></td>
    </tr>
    

    Add/edit user:

    <tr>
      <td><label for="edituser">Username:</label></td>
      <td><input name="edituser" id="edituser" type="text"></td>
    </tr>
    <tr>
      <td><label for="editpass">Password:</label></td>
      <td><input name="editpass" id="editpass" type="password"></td>
    </tr>
    <tr>
      <td><label for="editpass2">Repeat Password:</label></td>
      <td><input name="editpass2" id="editpass2" type="password"></td>
    </tr>
    

    Problem: same result, field name is not the reason why Firefox only fills first password field but not the second one, it seems that it only looks for the first password field.

  • Second attempt: hiding password fields and instead show a link to change password that, when clicked, shows the password fields.

    <script type="text/javascript;">
    <!--
      function show_pass()
      {
        document.getElementById('tr_chpass').style.display = 'none';
        document.getElementById('tr_pass').style.display = 'table-row';
        document.getElementById('tr_pass2').style.display = 'table-row';
      }
    //-->
    </script>
    
    <!-- ... -->
    
    <tr>
      <td><label for="user">Username:</label></td>
      <td><input name="user" id="user" type="text"></td>
    </tr>
    <tr id="tr_chpass">
      <td><label for="chpass">Password:</label></td>
      <td><span
          id="chpass"
          style="cursor: pointer; color: blue; border-bottom: 1px dotted blue;"
          onclick="show_pass();">
          Change password</span>
      </td>
    </tr>
    <tr style="display: none;" id="tr_pass">
      <td><label for="pass">Password:</label></td>
      <td><input name="pass" id="pass" type="password"></td>
    </tr>
    <tr style="display: none;" id="tr_pass2">
      <td><label for="pass2">Repeat password:</label></td>
      <td><input name="pass2" id="pass2" type="password"></td>
    </tr>
    

    Problem: same result.

  • Third attempt: not including password field in form, create it with JavaScript adding them with element.innerHTML.

    <script type="text/javascript;">
    <!--
      function show_pass()
      {
        var tr_chpass = document.getElementById("tr_chpass");
        tr_chpass.style.display = "none";
        var tr_pass = document.createElement('tr');
        tr_pass.innerHTML =
            "<td><label for='pass'>Password:<\/label><\/td>" +
            "<td><input type='password' name='pass' id='pass'><\/td>";
        var tr_pass2 = document.createElement('tr');
        tr_pass2.innerHTML =
            "<td><label for='pass2'>Repeat Password:<\/label><\/td>" +
            "<td><input type='password' name='pass2' id='pass2'><\/td>";
        var parent_table = tr_chpass.parentNode;
        parent_table.insertBefore(tr_pass, tr_chpass);
        parent_table.insertBefore(tr_pass2, tr_chpass);
      }
    //-->
    </script>
    
    <!-- ... -->
    
    <tr>
      <td><label for="user">Username:</label></td>
      <td><input name="user" id="user" type="text"></td>
    </tr>
    <tr id="tr_chpass">
      <td><label for="chpass">Password:</label></td>
      <td><span
          id="chpass"
          style="cursor: pointer; color: blue; border-bottom: 1px dotted blue;"
          onclick="show_pass();">
          Change password</span>
      </td>
    </tr>
    

    Problem: it seems that Firefox doesn't render correctly tables created with innerHTML since the resulting table seems like this:

  • Fourth and last attempt: not including password field in form, create it with JavaScript adding them with element.insertBefore()

    <script type="text/javascript;">
    <!--
      function show_pass()
      {
        document.getElementById("tr_chpass").style.display = "none";
        var tr_pass = document.createElement('tr');
        var tr_pass2 = document.createElement('tr');
        var td_label_pass = document.createElement('td');
        td_label_pass.innerHTML = "<label for='pass'>Password:<\/label>";
        var td_input_pass = document.createElement('td');
        td_input_pass.innerHTML = "<input type='password' name='pass' id='pass'>";
        var td_label_pass2 = document.createElement('td');
        td_label_pass2.innerHTML = "<label for='pass2'>Repeat Password:<\/label>";
        var td_label_pass2 = document.createElement('td');
        tr2td2.innerHTML = "<input type='password' name='pass2' id='pass2'>";
        tr_pass.insertBefore(td_label_pass, null);
        tr_pass.insertBefore(td_input_pass, null);
        tr_pass2.insertBefore(td_label_pass2, null);
        tr_pass2.insertBefore(td_input_pass2, null);
        var tr_chpass = document.getElementById("chpass_row");
        var parent_table = tr_chpass.parentNode;
        parent_table.insertBefore(tr_pass, tr_chpass);
        parent_table.insertBefore(tr_pass2, tr_chpass);
      }
    //-->
    </script>
    
    <!-- ... -->
    
    <tr>
      <td><label for="user">Username:</label></td>
      <td><input name="user" id="user" type="text"></td>
    </tr>
    <tr id="tr_chpass">
      <td><label for="chpass">Password:</label></td>
      <td><span
          id="chpass"
          style="cursor: pointer; color: blue; border-bottom: 1px dotted blue;"
          onclick="show_pass();">
          Change password</span>
      </td>
    </tr>
    

Comments: 0

Adiós Antonio

 Comment

Adiós Antonio

Las mejores canciones de Antonio Vega.

Programación del día de Radio 3 dedicada a Antonio Vega:

http://195.10.10.103/rtve/radio3.mp3

Comments: 1

Molina pírate

 Comment

Comments: 0

Linux kernel module that allows you to set events on pressed keys

 Comment

As a probe of the use of kprobes for Extension of Operating Systems I have made a Linux module that allows you to execute a command for every pressed key and see its keycode.

It includes some sample scripts that can be used as the command to be executed on every key pressed, these scripts are:

  • keylogger

    Registers every pressed key in a file.

  • printscr

    If framebuffer is enabled it allows to do a console screenshot using print screen key.

  • typewriter

    Plays a sound on every key pressed, sample sounds included imitate a typewriter.

The tarball includes more instructions and examples.

Download kbdevents

Comments: 4

Leopoldo Abadía explica la crisis financiera

 Comment

MP4 FLV

Buenafuente #509 (2008-10-08) y #533 (2008-11-19).

Comments: 0

No hay informáticos en España

 Comment

Así es, ya que tras mucho tiempo dándole vueltas, el Gobierno por fin ha decidido ir por donde todos temíamos y tirar la carrera a la basura: los informáticos españoles no tendremos competencias (que serán asumidas por telecomunicaciones) ni atribuciones en España.

Así que no hay informáticos en España, lo más parecido que hay son telecos y unos cuantos con el papel del váter más caro del mundo.

Gracias a KAI_Tite por los enlaces.

Actualización: E-mail del director de la Escuela Superior de Ingeniería Informática de la Universidad de Vigo explicando la situación.

Comments: 0

Portage sound notifications

 Comment

The context: you run emerge with --ask parameter and, since it can take some time to calculate dependencies, you do some other thing. After a while, when you've forgotten it, you discover that emerge have ended calculating dependencies time ago and it's waiting for your confirmation when it could be already done. Have this ever happened to you? Me too. This is why I added sound notifications to some Portage events.

The patch is configured in /etc/make.conf file with the following variables: PLAY_CMD which is the command that will play the sound, like play, aplay, artsplay, esdplay or paplay, and SOUND_<event> which is the sound file that will be played, events may be ASK, SUCCESS or FAILURE. Files may be in any format supported by PLAY_CMD, so you can use WAV, MP3, OggVorbis, AAC, WMA, ... using the suitable command.

Example:

# Sounds will be played with PulseAudio using command paplay
PLAY_CMD="paplay"
# Sound played when Portage asks you something (i.e., when you use --ask parameter)
SOUND_ASK="/home/fred/sounds/question.wav"
# Sound played when emerge exits successfully
SOUND_SUCCESS="/home/fred/sounds/correct.wav"
# Sound played when emerge exits with errors
SOUND_FAILURE="/home/fred/sounds/error.wav"

Download portage_sounds.diff

Comments: 0

George Parr explains financial crisis

 Comment

FLV

Comments: 0

D Crepes Maker

 Comment

Fonzu @ work.

Comments: 0

Chuso Gentoo Overlay

 Comment

The fact is that, with ebuilds for new packages that I submitted to Bugzilla, the ones I modified with patches of my interest, those removed from Portage, some I made for my scripts and others, I colleted a few ebuilds now I compile and release in an overlay for Portage.

Some of the included packages are:

In order to see the full list of packages and installation instructions visit the project web page.

Comments: 0

        Pages: 1 2 3 4 5 6 7 8 9Next
Google
   
links
News News feed
Mon Feb 2 15:19:48 2009 kbdevents version 1.1
Added option to kbdevents module that allows to choose which keycode triggers the event.
Mon Jun 23 18:53:31 2008 URLFilter.ini updated
Opera URL filter updated to include several RBN sites, badware and some ad server. Sources: Bharath's Security Blog, Jawewi's Anti-Malware Information and RBNExploit.
Sun Jun 1 10:11:55 2008 Rune: HOV server
I've just set up a Rune: Halls of Valhalla dedicated server with Arenas, special game types such as boxing and street fighting and anti cheat mods. Click here for more info.
Mon Feb 11 13:26:52 2008 URLFilter.ini updated
I've just updated my Opera URL filter to include some of the most common servers
Fri Feb 8 16:01:45 2008 Comments
It's now possible to send comments again.

Computers Blogs - Blog Top Sites

 

Copyright© 2006-2008 Jesús Pérez Rey
RSS RDF
Add to Google
Add to Yahoo!
Add to Technorati
Add to Bloglines
Add to Newsgator
Add to Newsburst