1. #1
    Sencha User thenevermore's Avatar
    Join Date
    Nov 2012
    Location
    Bandung , Indonesia
    Posts
    10
    Vote Rating
    0
    thenevermore is on a distinguished road

      0  

    Default Answered: [ASK] Have a problem with My Password Validation - 2

    Answered: [ASK] Have a problem with My Password Validation - 2


    Dear all ,

    i have a problem with my password validation.

    my current validation is using vtype and has its own pattern like this (2 uppercase + upper/lowercase + number) -> PAssword90 or PAssWord99

    you will find this rule is not user friendly to be applied because user has to obey the pattern.
    Once the pattern ignored (for example : number is placed in first string -> 90Password ), error message will appear.

    here my vtype :
    Ext.form.VTypes=function()
    {
    k= /^([A-Z]{2})[A-Za-z\-]+[0-9_]+/;
    return
    {
    passpos : function(e)
    {
    return k.test(e) },
    passposText : "Wajib mengandung Huruf besar,huruf kecil, dan angka",
    passposMask : /[A-Za-z0-9_]/i
    }
    }();
    i want to create a rules (vtype or regEx) that allow user input their own password as long as containing one of Uppercase , number ,and symbols placed anywhere.

    Example :
    password -> wrong (not containing Uppercase , number and symbols)
    Password -> wrong (not containing number and symbols)
    pASsword -> wrong (not containing number and symbols)
    pASsword90 -> wrong (not containing symbols)
    pASsword90# -> correct
    &pAssword99 -> correct
    pas$90Word -> correct
    If you have any suggestion or idea , you may share it with us here.

  2. Try this:
    Code:
    Ext.apply(Ext.form.field.VTypes, {
        passpos:  function(v) {
            return /[A-Z]+/.test(v) && /[a-z]+/.test(v) && /[0-9]+/.test(v) && /[-_~!@#$%^&]+/.test(v);
        },
        passposText : "Wajib mengandung Huruf besar,huruf kecil, dan angka",
        passposMask : /[A-Za-z0-9_]/i
    });

  3. #2
    Sencha - Community Support Team
    Join Date
    Jan 2012
    Posts
    1,376
    Answers
    346
    Vote Rating
    113
    vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all vietits is a name known to all

      0  

    Default


    Try this:
    Code:
    Ext.apply(Ext.form.field.VTypes, {
        passpos:  function(v) {
            return /[A-Z]+/.test(v) && /[a-z]+/.test(v) && /[0-9]+/.test(v) && /[-_~!@#$%^&]+/.test(v);
        },
        passposText : "Wajib mengandung Huruf besar,huruf kecil, dan angka",
        passposMask : /[A-Za-z0-9_]/i
    });

  4. #3
    Sencha User thenevermore's Avatar
    Join Date
    Nov 2012
    Location
    Bandung , Indonesia
    Posts
    10
    Vote Rating
    0
    thenevermore is on a distinguished road

      0  

    Default


    Quote Originally Posted by vietits View Post
    Try this:
    Code:
    Ext.apply(Ext.form.field.VTypes, {
        passpos:  function(v) {
            return /[A-Z]+/.test(v) && /[a-z]+/.test(v) && /[0-9]+/.test(v) && /[-_~!@#$%^&]+/.test(v);
        },
        passposText : "Wajib mengandung Huruf besar,huruf kecil, dan angka",
        passposMask : /[A-Za-z0-9_]/i
    });
    Finally , that's worked well,,

    big thanks for vietits,


    Case Closed

Thread Participants: 1