home *** CD-ROM | disk | FTP | other *** search
/ bombers.k12.ar.us / bombers.k12.ar.us.tar / bombers.k12.ar.us / survey / ForgotPassword.asp < prev    next >
Text File  |  2006-11-29  |  8KB  |  212 lines

  1. <!--#Include File="Include/Top_inc.asp"-->
  2. <%
  3. '***********************************************************************
  4. '   Application: SelectSurveyASP Advanced v8.1.11
  5. '   Author: Aaron Baril for ClassApps.com
  6. '   Page Description: This page contains a form that allows the user to
  7. '                     enter his/her email address and receive his/her 
  8. '                      password by email.
  9. '
  10. '   COPYRIGHT NOTICE                                
  11. '
  12. '   See attached Software License Agreement
  13. '
  14. '   (c) Copyright 2002 - 2006 by ClassApps.com.  All rights reserved.
  15. '***********************************************************************
  16. %>
  17. <!--#Include File="Include/SurveyUtility_inc.asp"-->
  18. <!--#Include File="Include/Utility_inc.asp"-->
  19. <!--#Include File="Include/Config_inc.asp"-->
  20. <!--#Include File="Include/adovbs_inc.asp"-->
  21. <!--#Include File="Include/CurrentUser_inc.asp"-->
  22. <!--#Include File="Include/Email_inc.asp"-->
  23. <!--#Include File="Include/SurveySecurity_inc.asp"-->
  24. <!--#Include File="Include/Constants_inc.asp"-->
  25. <html>
  26. <head>
  27.     <title>Forgot Password</title>
  28.     <link rel="stylesheet" href="Resources/StyleSheet/SurveyStyle.css">
  29. </head>
  30.  
  31. <%
  32.     Dim strMessage
  33.     Dim rsForgotPassword
  34.     Dim strEmailText
  35.     Dim strSQL
  36.     Dim flgPasswordSent
  37.     
  38.     'Initialization
  39.     Set rsForgotPassword = Server.CreateObject("ADODB.Recordset")
  40.     flgPasswordSent = False
  41.     
  42.     'Check to see if this page has been submitted to itself or if this is the first time on the page
  43.     If Request.Form("FormSubmitted") = SUR_BOOLEAN_POSITIVE_DISPLAY Then
  44.         'Get the count of users with this email address. 
  45.         strSQL = "SELECT username, user_password " & _
  46.                     "FROM sur_user " & _
  47.                     "WHERE email_address = " & SQLEncode(Request.Form("txtEmailAddress"))
  48.         rsForgotPassword.Open ConvertSQL(strSQL), SURVEY_APP_CONNECTION, adOpenDynamic, , adCmdText
  49.         
  50.         'If there is a user, send the email.  Otherwise, display an error message.
  51.         If rsForgotPassword.EOF = False Then
  52.             rsForgotPassword.MoveFirst
  53.             strEmailText = "The login information you requested for the " & SUR_APPLICATION_NAME & " application is:" & vbCrLf & vbCrLf & _
  54.                             "Username: " & rsForgotPassword("username") & vbCrLf & vbCrLf & _
  55.                             "Password: " & rsForgotPassword("user_password")
  56.             SendMail Request.Form("txtEmailAddress"), SUR_APPLICATION_ADMIN_EMAIL_ADDRESS, "", "", strEmailText, "Password for " & SUR_APPLICATION_NAME, False
  57.             strMessage = "Your username and password have been sent to " & Request.Form("txtEmailAddress") & "."
  58.             flgPasswordSent = True
  59.         Else 'No records returned
  60.             strMessage = "There are no users in the system with the email address " & Request.Form("txtEmailAddress") & ".  Please " & _
  61.                          "enter your email address again, or click <a href=""User.asp?State=Insert"">here</a> to register."
  62.         End If
  63.  
  64.         'Clean up
  65.         rsForgotPassword.Close
  66.         Set rsForgotPassword = Nothing
  67.     Else
  68.         strMessage = "Please enter your email address below.  Your password will be emailed to you immediately."
  69.     End If
  70.  
  71.     'The client-side JavaScript is only needed if the text box for the email address is displayed
  72.     If flgPasswordSent = False Then
  73. %>
  74.         <script language ="JavaScript" src="ClientInclude/Utility.js"></script>
  75.         <script language="JavaScript">
  76.         function submitCheck()
  77.         {
  78.             if (trim(document.forms['frmForgotPassword'].txtEmailAddress.value) == "")
  79.             {    
  80.                 alert("Please enter a value for the Email Address field.");
  81.                 document.forms['frmForgotPassword'].txtEmailAddress.focus();
  82.             }
  83.             else if (isValidEmailAddress(trim(document.forms['frmForgotPassword'].txtEmailAddress.value)) == false)
  84.             {    
  85.                 alert("The format of the email address entered is not valid.  Please re-enter the email address.");
  86.                 document.forms['frmForgotPassword'].txtEmailAddress.focus();
  87.             }
  88.             else
  89.             {
  90.                 document.forms['frmForgotPassword'].submit();
  91.             }
  92.         }
  93.         </script>
  94. <%
  95.     End If
  96. %>
  97.  
  98. <body class="MainBodyStyle" 
  99.  
  100. <%
  101.     'Only set the focus if the text box is being rendered
  102.     If flgPasswordSent = False Then
  103. %>
  104.         onLoad="frmForgotPassword.txtEmailAddress.focus();"
  105. <%
  106.     End If
  107. %>    
  108. >
  109.  
  110. <table border="0" height="100%" width="100%" cellpadding="0" cellspacing="0">
  111.     <tr>
  112.         <td valign="center" align="center">
  113.             <table width="450" border="0" align="center" cellpadding="0" cellspacing="0" class="DarkBlueBackgroundColor">
  114.                 <tr> 
  115.                     <td align="left" height="36" valign="bottom">
  116.                           <img border="0" alt="SelectSurveyASP Advanced" src="Resources/Images/TopLogo.gif">
  117.                     </td>
  118.                 </tr>
  119.             </table>
  120.             <table width="450" border="0" align="center" cellpadding="8" cellspacing="0" class="DarkBlueBackgroundColor">
  121.                 <tr> 
  122.                     <td align="center">
  123.                         <table width="434" border="0" cellpadding="7" cellspacing="0" class="MediumBlueBackgroundColor">
  124.                             <tr> 
  125.                                 <td align="center">
  126.                                     <table cellspacing="0" border="0" cellpadding="6" width="420" class="WhiteBackgroundColor">
  127.                                         <tr>
  128.                                             <td>
  129.                                                 <table border="0" cellpadding="3" cellspacing="3" height="125" width="100%">
  130.                                                     <tr>
  131.                                                         <td colspan="2">
  132.                                                             <span class="H2HeadingStyle">Forgot Password</span>
  133.                                                             <br>
  134.                                                         </td>
  135.                                                     </tr>
  136. <%
  137.                                                     If flgPasswordSent = True Then
  138. %>
  139.                                                         <tr>
  140.                                                             <td align="left" colspan="2" class="Normal">
  141.                                                                 <%=strMessage%><br><br><br><br>
  142.                                                             </td>
  143.                                                         </tr>
  144.                                                         <tr>
  145.                                                             <td>
  146.                                                                  
  147.                                                             </td>
  148.                                                             <td align="right">
  149.                                                                 <a href="Login.asp?"><img border="0" alt="Login" name="btnOK" src="Resources/Buttons/OK.gif"></a>
  150.                                                             </td>
  151.                                                         </tr>
  152. <%
  153.                                                     Else
  154. %>
  155.                                                         <form name="frmForgotPassword" action="ForgotPassword.asp" method="post">
  156.                                                         <input type="hidden" name="FormSubmitted" value="<%=SUR_BOOLEAN_POSITIVE_DISPLAY%>">
  157.                                                         <tr>
  158.                                                             <td align="left" colspan="2" class="Normal">
  159.                                                                 <%=strMessage%><br><br>
  160.                                                             </td>
  161.                                                         </tr>
  162.                                                         <tr>
  163.                                                             <td align="left" width="30%">
  164.                                                                 <span class="NormalBold"><label for="txtEmailAddress">Email Address:</label> </span>
  165.                                                             </td>
  166.                                                             <td align="right">
  167.                                                                 <input type="text" value="" name="txtEmailAddress" id="txtEmailAddress" maxlength="75" style="width:270px">
  168.                                                             </td>
  169.                                                         </tr>
  170.                                                         <tr>
  171.                                                             <td>
  172.                                                                  
  173.                                                             </td>
  174.                                                             <td align="right">
  175.                                                                 <br>
  176.                                                                 <a href="Login.asp?"><img border="0" alt="Cancel" name="btnCancel" src="Resources/Buttons/Cancel.gif"></a>
  177.                                                                 <a href="javascript:submitCheck();"><img border="0" alt="Submit email address" name="btnSubmit" src="Resources/Buttons/Submit.gif"></a>
  178.                                                             </td>
  179.                                                         </tr>
  180.                                                         </form>
  181. <%
  182.                                                     End If
  183. %>                                    
  184.                                                     </form>
  185.                                                 </table>
  186.                                             </td>
  187.                                         </tr>
  188.                                     </table>
  189.                                 </td>
  190.                             </tr>
  191.                         </table>
  192.                     </td>
  193.                 </tr>
  194.             </table>
  195.             <table width="450" border="0" align="center" cellpadding="0" cellspacing="0" class="DarkBlueBackgroundColor">
  196.                 <tr> 
  197.                     <td align="center">
  198. <!--#Include File="Include/FooterInner_inc.asp"-->
  199.                     </td>
  200.                 </tr>
  201.             </table>
  202.         </td>
  203.     </tr>
  204. </table>
  205. </body>
  206. </html>
  207.  
  208. <%        
  209.     'Ensure that the web server returns the page
  210.     Response.Flush
  211. %>
  212.