/new/administrator/reset-password.asp

https://github.com/akabeko/fusionexcel · ASP · 70 lines · 67 code · 3 blank · 0 comment · 6 complexity · 877dfd5101a8c10edde3d79d2d93ec55 MD5 · raw file

  1. <!--#include file="../libraries.asp" -->
  2. <%
  3. Dim page_title
  4. page_title = "Fusion Excel Content Management System"
  5. Dim old_password, new_password, retype_password, error_msg
  6. if Request.ServerVariables("REQUEST_METHOD") = "POST" then
  7. old_password = Request("old_password")
  8. new_password = Request("new_password")
  9. retype_password = Request("retype_password")
  10. if new_password = "" then
  11. error_msg = "Please select your new password"
  12. elseif Len(new_password) < 6 then
  13. error_msg = "Please choose your password with more than 6 character"
  14. elseif new_password <> retype_password then
  15. error_msg = "The retype password doesn't same with the new password"
  16. else
  17. Dim RecordSet, sql
  18. sql = "SELECT password FROM tbl_users WHERE username = '" & Session("login") & "'"
  19. call SetConnection(GetUserDbPath())
  20. call OpenDatabase()
  21. call CreateRecordSet(RecordSet, sql)
  22. if not RecordSet.EOF then
  23. if old_password <> RecordSet("password") then
  24. error_msg = "The password you entered doesn't seem is same with the previous password"
  25. else
  26. RecordSet("password") = new_password
  27. RecordSet.Update
  28. Response.Redirect("reset-password.asp?success=1")
  29. end if
  30. End if
  31. end if
  32. end if
  33. %>
  34. <!--#include file="header.asp" -->
  35. <h1>Change Password</h1>
  36. <form method="post" class="input_form">
  37. <table border="0" cellspacing="0" cellpadding="0" width="100%">
  38. <tr>
  39. <td width="150px"><label for="id_old_password">Old Password: </label></td>
  40. <td><input type="password" name="old_password" id="id_old_password" value="<%= old_password %>" />
  41. </tr>
  42. <tr>
  43. <td><label for="id_new_password">New Password: </label></td>
  44. <td><input type="password" name="new_password" id="id_new_password" value="<%= new_password %>" />
  45. </tr>
  46. <tr>
  47. <td><label for="id_retype_password">Retype Password: </label></td>
  48. <td><input type="password" name="retype_password" id="id_retype_password" value="<%= retype_password %>" />
  49. </tr>
  50. <% if error_msg <> "" then %>
  51. <tr>
  52. <td></td>
  53. <td><p style="color: red">Error: <%= error_msg %></p></td>
  54. </tr>
  55. <% elseif Request("success") = 1 then %>
  56. <tr>
  57. <td></td>
  58. <td><p style="color: green">Password updated successfully</p></td>
  59. </tr>
  60. <% end if %>
  61. <tr>
  62. <td></td>
  63. <td><input type="submit" name="submit" value="Update Password" /></td>
  64. </tr>
  65. </table>
  66. </form>
  67. <!--#include file="footer.asp" -->