4 Replies - 1143 Views - Last Post: 28 September 2012 - 06:56 PM Rate Topic: -----

#1 lamsen  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 13
  • Joined: 21-September 12

help how to"password strength"

Posted 28 September 2012 - 08:23 AM

good day, i need a help with my project,
i want my textbox to check its value every time i press a letter or number on my keyboard,
if my textbox has only number or letter my label1.caption=low pw strength
else if my textbox has numbers and letters label1.caption=medium pw strength
else if my textbox has numbers, letters and special char label1.caption=high pw strength
hope you can help me,
thanks in advance :)

Is This A Good Question/Topic? 0
  • +

Replies To: help how to"password strength"

#2 maj3091  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 299
  • View blog
  • Posts: 1,768
  • Joined: 26-March 09

Re: help how to"password strength"

Posted 28 September 2012 - 09:12 AM

Post what code you already have and explain what problems you have.
Was This Post Helpful? 0
  • +
  • -

#3 Nullified  Icon User is offline

  • New D.I.C Head

Reputation: 13
  • View blog
  • Posts: 49
  • Joined: 18-September 12

Re: help how to"password strength"

Posted 28 September 2012 - 10:27 AM

You could use jquery .keyup function to execute the check:
jQuery(document).ready(function(){
    jQuery("#password").keyup(function () {
        var pwvalue = jQuery("#password").val();
        var pwstrength = getPasswordStrength(pwvalue);
        jQuery("#pwstrength").html("Strong");
        jQuery("#pwstrengthpos").css("background-color","#33CC00");
        if (pwstrength<75) {
            jQuery("#pwstrength").html("Moderate");
        }
        if (pwstrength<30) {
            jQuery("#pwstrength").html("Weak");
        }
    });
});
function getPasswordStrength(pw){
    var pwlength=(pw.length);
    if(pwlength>5){pwlength=5;}
    var numnumeric=pw.replace(/[0-9]/g,"");
    var numeric=(pw.length-numnumeric.length);
    if(numeric>3){numeric=3;}
    var symbols=pw.replace(/\W/g,"");
    var numsymbols=(pw.length-symbols.length);
    if(numsymbols>3){numsymbols=3;}
    var numupper=pw.replace(/[A-Z]/g,"");
    var upper=(pw.length-numupper.length);
    if(upper>3){upper=3;}
    var pwstrength=((pwlength*10)-20)+(numeric*10)+(numsymbols*15)+(upper*10);
    if(pwstrength<0){pwstrength=0;}
    if(pwstrength>100){pwstrength=100;}
    return pwstrength;
}


Was This Post Helpful? 0
  • +
  • -

#4 lamsen  Icon User is offline

  • New D.I.C Head

Reputation: 2
  • View blog
  • Posts: 13
  • Joined: 21-September 12

Re: help how to"password strength"

Posted 28 September 2012 - 04:31 PM

here's what I got so far
Private Sub Text2_KeyPress(KeyAscii As Integer)
Dim alpha As String
Dim num As String
alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
num = "0123456789"
If InStr(1, aplha + num, Text2.Text, 1) <> 0 Then Label6.Caption = "medium pw strength"
End Sub


label6 always show "medium pw stregnth" even if I put special char, a single number and a single letter,
Was This Post Helpful? 0
  • +
  • -

#5 Nullified  Icon User is offline

  • New D.I.C Head

Reputation: 13
  • View blog
  • Posts: 49
  • Joined: 18-September 12

Re: help how to"password strength"

Posted 28 September 2012 - 06:56 PM

Well excuse me for posting jquery functions because I am too retarded to read the forum this was posted in. Your reference to caption should have turned on a light bulb for me since I am familiar with vb.

/FAIL (EPICALLY)

This post has been edited by Nullified: 28 September 2012 - 06:56 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1