Link to home
Start Free TrialLog in
Avatar of sydneyguy
sydneyguyFlag for Australia

asked on

auto submit form if password matches. from a log in screen

I have a login form and what I require is the login in screen to pass through when the pass word matches a default value...at present the system looks at a file record in the data base and if the system password is for example abcxyz  then the log in screen auto populates with the user name password and file password in the log in box so the user can hit log in and they do not need to know the password. now the criteria has changed and they require the log in screen will auto disappear and give access to the file on question. if the filepassword is anything except abcxyz the login box will stay blank. what I need to do is a redirect if abcexy is found.  so effectivly a auto submitt line in stead of hitting the submit button if password is a match.
Avatar of sydneyguy
sydneyguy
Flag of Australia image

ASKER

another good example would be to submit via a timer after 2sec it would auto submit. is this helpful to get my idea accross
What a horribly insecure form.  Glad I'm not responsible for the requirements. Post what you've got, preferably from a view source, and we'll take a whack at it.

What db and what server side language would also be helpful.
tell me about it they started of wanting a super secure site and bit by bit it gets wittled away such is life.
<cfform method="post" action=#filevar#>


<CFOUTPUT>

<div align="center">
  <center>

<table border="0" width="327" height="245" background="images/publicldocoginf.jpg">
  <tr>                                                      
    <td width="319" height="286">
      <table border="0" width="100%" height="62">
        <tr>
          <td width="100%" height="1" valign="top"></td>
        </tr>
        <tr>
          <td width="100%" height="103" valign="top"></td>
        </tr>
      <tr>
      
        <td width="100%" height="29" valign="top">
         <p align="right">
      
      <CFIF #passwordpublic# IS #passtoval#>
      <cfinput type="text" name="Username" VALUE="public" size="20" maxlength="15" required="Yes" message="You must provide a Username.">
         <CFELSE>
                 <cfinput type="text" name="Username" size="15" maxlength="15" required="Yes" message="You must provide a Username.">
      
      
      <td width="340">      
            
      </td>
      </CFIF>
      </tr>
      <tr>
        <td width="100%" height="29" valign="top">
          <p align="right">      
      <CFIF #passwordpublic# IS #passtoval#>
            <cfinput type="Password" name="Password"  autocomplete="OFF" VALUE="Public" size="20" maxlength="15" required="Yes" message="You must provide a Password">
         <CFELSE>
                 <cfinput type="Password" name="Password" size="15"  autocomplete="OFF" value="" maxlength="15" required="Yes" message="You must provide a Password">
      <td width="340">      
      
      </td>
      </CFIF>
      </tr>
      <tr>
      <td width="100%" height="29" valign="top">
        <p align="right">      
      <CFIF #passwordpublic# IS #passtoval#>
            <cfinput type="Password" name="FilePassword" VALUE="public" size="15" maxlength="15" required="No" message="You must provide a File Password">

********* THIS IS WERE I WAS TRYING TO PLACE MY AUTO SUBMIT LINE    BY THIS TIME IF THE SYSTEM HAS FOUND THE MATCHING FILE PASSWORD THEN THE SYSTEM
HAS ALREADY FILLED IN THE USERNAME  PASSWORD  AND THE FILE PASSWORD
FROM HERE IF IT GOT TO THROUGH TO THIS IF STATEMENT IT WOULD SIMPLY SUBMIT ITS SELF
SO FAR HAVE NOT FOUND AN EXAMPLE TO USE....ITS ALWAYS EASY WHEN YOU KNOW HOW...
THANKS FOR YOUR INPUT
*************************************8


         <CFELSE>
                 <cfinput type="Password" name="FilePassword"  autocomplete="OFF" value="" size="15" maxlength="15" required="No" message="You must provide a File Password x">
      <td width="340">      
      
      
      </td>
      </CFIF>
      </tr>


      <center>
      <tr>
        <td width="100%" height="52" valign="top">
          <table border="0" width="100%" height="15">
            <tr>
              <td width="23%" height="19"><input type="button" value="Cancel" name="B3"></td>

            </tr>
            <tr>
              <td width="23%" height="15"><input type="submit" value="  Login   "></td>


            </tr>
          </table>
        </td>
      </tr>
    </center>
      </table>
    </td>
  </tr>
</table>
</CFOUTPUT>
</cfform>
</div>
</body>
</html>
am running sqlsever and coldfusion  at the end of the day its probably one line that will replace the submit button and do it automatially and post the info off the same as hitting the submit button would do. the system would still retain the submit button for when the passwords do not match for manual input
Is that the Coldfusion code or a view source from a browser.
cold fusion code from the login.cfm file
Could you open it in a browser and send the rendered code, it is much more useful to me.

If there is some sensitive data, such as the password in a hidden field, just edit that out with "thesecret".

If I don't see what the browser is seeing, I really can't help.
HERE IS THE RENDERED CODE IF THERES ANY THING SENSITIVE IN THERE LET ME KNOW AS IT SHOULD NOT BE IN THERE AS YOU CAN WELL IMAGINE...THANKS

      <br>
      
      <br>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
      <title></title>
<script type="text/javascript" src="/CFIDE/scripts/cfform.js"></script>
<script type="text/javascript" src="/CFIDE/scripts/masks.js"></script>
<script type="text/javascript">
<!--
    function  _CF_checkCFForm_1(_CF_this)
    {
        //reset on submit
        _CF_error_exists = false;
        _CF_error_messages = new Array();
        _CF_error_fields = new Object();
        _CF_FirstErrorField = null;

        //form element Username required check
        if( !_CF_hasValue(_CF_this['Username'], "TEXT", false ) )
        {
            _CF_onError(_CF_this, "Username", _CF_this['Username'].value, "You must provide a Username.");
            _CF_error_exists = true;
        }

        //form element Password required check
        if( !_CF_hasValue(_CF_this['Password'], "PASSWORD", false ) )
        {
            _CF_onError(_CF_this, "Password", _CF_this['Password'].value, "You must provide a Password");
            _CF_error_exists = true;
        }


        //display error messages and return success
        if( _CF_error_exists )
        {
            if( _CF_error_messages.length > 0 )
            {
                // show alert() message
                _CF_onErrorAlert(_CF_error_messages);
                // set focus to first form error, if the field supports js focus().
                if( _CF_this[_CF_FirstErrorField].type == "text" )
                { _CF_this[_CF_FirstErrorField].focus(); }

            }
            return false;
        }else {
            return true;
        }
    }
//-->
</script>
</head>



<body bgcolor="#FFFFFF">
<div align="center">
            
      <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr bgcolor="#3366CC">
            
            <td align="left">
            <font color="#FFFFFF" face="Arial, Helvetica, sans-serif" size="+2">&nbsp;&nbsp;<b><SUP><font size="+1">TM</font></SUP>&nbsp;&nbsp;</b></font>
            <td></td>
             
            </tr>
                                                      
</table>

<form name="CFForm_1" action="authenticate.cfm?filev=a.bmp&filetxt=testing 9" method="post" onsubmit="return _CF_checkCFForm_1(this)">

      login fileval..authenticate.cfm?filev=a.bmp&filetxt=testing 9



<p>

&nbsp;
<p>

&nbsp;
<p>



<input type="hidden" name="filenameval" VALUE="a.bmp" size="25" maxlength="15" required="Yes">
<input type="hidden" name="filenamevaltext" VALUE="testing 9" size="25" maxlength="15" required="Yes"><BR>

<div align="center">
  <center>

<table border="0" width="327" height="245" background="images/bslpublicldocoginf.jpg">
  <tr>                                                      
    <td width="319" height="286">
      <table border="0" width="100%" height="62">
        <tr>
          <td width="100%" height="1" valign="top"></td>
        </tr>
        <tr>
          <td width="100%" height="103" valign="top"></td>
        </tr>
      <tr>
      
        <td width="100%" height="29" valign="top">
         <p align="right">
      
      
      <input name="Username" id="Username" type="text" value="public" maxlength="15"  size="20"  />
          
      </tr>
      <tr>
        <td width="100%" height="29" valign="top">
          <p align="right">      
      
            <input name="Password" id="Password" type="password" value="Public" maxlength="15"  size="20"  autocomplete="OFF"  />
          
      </tr>
      <tr>
      <td width="100%" height="29" valign="top">
        <p align="right">      
      
            <input name="FilePassword" id="FilePassword" type="password" value="public" maxlength="15"  size="15"  />

test data


               


 
            

            
      </tr>


      
      <center>
      <tr>
        <td width="100%" height="52" valign="top">
          <table border="0" width="100%" height="15">
            <tr>
              <td width="14%" height="19"></td>
              <td width="99%" height="19"></td>
              <td width="23%" height="19"><input type="button" value="Cancel" name="B3"></td>

            </tr>
            <tr>
             <td width="35%" height="15"></a></td>
              <td width="99%" height="15"></td>
              <td width="23%" height="15"><input type="submit" value="  Login   "></td>


            </tr>
          </table>
        </td>
      </tr>
    </center>
      </table>
    </td>
  </tr>
</table>



      </form>

      
               
</div>
</body>
</html>
            
Patience, bed time...if another expert beats me to the puch, so much the better for you...if not I'll be back in the AM
the problem as i see it is that usually requesting the file would throw up a login in screen on the requested directory file, but when I render the login in screen up on the server I do not want a return screen if the password is of the type public, so it must make a decision to either return the login page with with clear data login in text boxes so you can fill them out and then authenticate it by submission button or set the security session and then jump of to the required form for the file requested.....but the data still needs ot be authenticated with the supplied passwords ect ...this is what need to happen

 <cfset request.User = StructNew()> <cfset request.User.LoggedIn = "1"> <cfset request.User.Username = FORM.Username>
so this would mean that I would not be posting it off to authenticate as it happens up on the server. it needs some other form of redirect of to the authenticate form. while still maintaining the security for the files that do not have the public log in
ok have come up with a answer that will do the job at least fot the log in screen have placed a body onload call to a java script function that will document.login.submit(); the page, with no time  it will do it as soon as it is rendered. may need a bit of code change to only submit when public or what I require but will do the job. and as usual 1 line of code. its easy after you have done it...
 
<script language="JavaScript">
function StartTheTimer(){
     document.login.submit();
}
</script>
ASKER CERTIFIED SOLUTION
Avatar of rdivilbiss
rdivilbiss
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial