Solved

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

Posted on 2007-03-27
14
187 Views
Last Modified: 2012-05-05
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
Comment
Question by:sydneyguy
  • 8
  • 5
14 Comments
 

Author Comment

by:sydneyguy
ID: 18805021
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
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18805206
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
 

Author Comment

by:sydneyguy
ID: 18805263
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
 

Author Comment

by:sydneyguy
ID: 18805287
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
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18805297
Is that the Coldfusion code or a view source from a browser.
0
 

Author Comment

by:sydneyguy
ID: 18805351
cold fusion code from the login.cfm file
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18805370
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
 

Author Comment

by:sydneyguy
ID: 18805401
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
 
LVL 29

Expert Comment

by:rdivilbiss
ID: 18805448
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
 

Author Comment

by:sydneyguy
ID: 18805462
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
 

Author Comment

by:sydneyguy
ID: 18805477
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
 

Author Comment

by:sydneyguy
ID: 18805682
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
 
LVL 29

Accepted Solution

by:
rdivilbiss earned 500 total points
ID: 18808494
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Author Note: Since this E-E article was originally written, years ago, formal testing has come into common use in the world of PHP.  PHPUnit (http://en.wikipedia.org/wiki/PHPUnit) and similar technologies have enjoyed wide adoption, making it possib…
Using SQL Scripts we can save all the SQL queries as files that we use very frequently on our database later point of time. This is one of the feature present under SQL Workshop in Oracle Application Express.
This video teaches users how to migrate an existing Wordpress website to a new domain.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now