Millisecond Online Community

Forums & Feeds
Welcome to Millisecond Online Community Sign in | Join | Help
in Search

Custom userid-script

Last post 06-03-2008, 8:52 AM by seandr. 2 replies.
Sort Posts: Previous Next
  •  05-27-2008, 1:56 AM 1648

    Custom userid-script

    In previous versions we've used a customs script we got from u Sean, where the users enter a number and a password. The password  is simply a conversion of the number (e.g 2 = p) but this has provided sufficient safety for us in that people never enter the wrong number by misstake.

    Since 3.x we've used the option to have them enter twice. Unfourtuantley people somtimes enter the wrong number, and they still do it twice!

    We would thus want to yet again use the custom script. I've tried uploadin the getsubjectnumber function in the create script wizard on your page but this does not work. Here is the script:


    function GetSubjectNumber()
    {
        // This method prompts the subject for two numbers in order avoid mistyped numbers.
        // The first is an id number. The second is a transformation of the id number.
        // The method verifies the second is in fact the proper transformation of the first.

     var intRegExp  = /(^-?\d\d*$)/;
     var promptMsg = "Skriv in det användarnummer du har fått av oss.";
     var confirmMsg = "Skriv in det lösenord du har fått av oss. Tänk på att bara använda små bokstäver";
     ///var idLength = 7;

        var snum = prompt(promptMsg, "");
        while ( snum != null && (intRegExp.test(snum) == false) )
     {
      // if the input was invalid, prompt again
      alert("Det nummer du skrev in, '" + snum + "', var inte det nummer du fått av oss.");
      snum = prompt(promptMsg, "");
     }
        if ( snum == null )
        {
            return null;
        }

        var sconfirm = prompt(confirmMsg, "");
        while ( sconfirm != null && (sconfirm != Transform(snum)) )
     {
      // if the input was invalid, prompt again
      alert("Det lösenord du skrev in, '" + sconfirm + "', var inte det lösenord du fått av oss.");
      sconfirm = prompt(confirmMsg, "");
     }
        if ( sconfirm == null )
        {
            return null;
        }

        return snum;
    }

    function Transform(snum)
    {
        var sconfirm = "xjp";
        if ( snum != null )
        {
            for (var i=0; i < snum.length; i++)
            {
                switch( snum.charAt(i) )
                {
                    case "1":
                        sconfirm += "c";
                        break;
                    case "2":
                        sconfirm += "r";
                        break;
                    case "3":
                        sconfirm += "e";
                        break;
                    case "4":
                        sconfirm += "a";
                        break;
                    case "5":
                        sconfirm += "t";
                        break;
                    case "6":
                        sconfirm += "i";
                        break;
                    case "7":
                        sconfirm += "o";
                        break;
                    case "8":
                        sconfirm += "n";
                        break;
                    case "9":
                        sconfirm += "b";
                        break;
                    case "0":
                        sconfirm += "g";
                        break;
                }
            }
        }
        return sconfirm;
    }

    Basicly we want this to work :) And we are in quite a hurry actually.

     

  •  05-30-2008, 12:07 AM 1655 in reply to 1648

    Re: Custom userid-script

    I've solved it now by downloading the script and chaning the getsubjectid function manually. The problem seem to have been with the wizard, but I don't know exactly what went wrong.

     

  •  06-03-2008, 8:52 AM 1659 in reply to 1655

    Re: Custom userid-script

    Glad you figured out the answer.

    If you decide to use the next version, 3.0.3.0 (which is now available as a beta option), we've changed the method by which the page asks for the user to enter the id, so your custom script may need to be altered a bit to work with the new system.

    The new page fixes the problem you reported earlier where the user id prompt would be blocked by Internet Explorer's security settings.

    -Sean

View as RSS news feed in XML
Powered by Community Server, by Telligent Systems