• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 202
  • Last Modified:

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.
0
sydneyguy
Asked:
sydneyguy
  • 8
  • 5
1 Solution
 
sydneyguyAuthor Commented:
another good example would be to submit via a timer after 2sec it would auto submit. is this helpful to get my idea accross
0
 
rdivilbissCommented:
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.
0
 
sydneyguyAuthor Commented:
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>
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
sydneyguyAuthor Commented:
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
0
 
rdivilbissCommented:
Is that the Coldfusion code or a view source from a browser.
0
 
sydneyguyAuthor Commented:
cold fusion code from the login.cfm file
0
 
rdivilbissCommented:
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.
0
 
sydneyguyAuthor Commented:
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>
            
0
 
rdivilbissCommented:
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
0
 
sydneyguyAuthor Commented:
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>
0
 
sydneyguyAuthor Commented:
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
0
 
sydneyguyAuthor Commented:
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>
0
 
rdivilbissCommented:
After sleeping on the problem, I accept your solution!  LOL.  Sorry for the time delay but it seems writing it all down put the solution in your mind.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 8
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now