payfrit-works/reset.cfm

164 lines
5.3 KiB
Text

<cfif len(#form.UUID#) gt 0 AND mode neq "forgot3">
<cfset mode="forgot2">
</cfif>
<cfif mode eq "forgot">
<script language="JavaScript">
function submitformforgot()
{
document.myformforgot.submit();
}
</script>
<cfoutput><form action="#request.cgiPath#" method="post" name="myformforgot" id="myformforgot" style="display:inline;">
Please input either your email address or cell phone:<br><br>
<input type="text" name="credential" size="15">
<a href="javascript: submitformforgot()">Submit</a>
<input type="hidden" name="mode" value="forgot1">
</form></cfoutput><br>
<cfelseif mode eq "forgot1">
<cfoutput><cfmodule credential = "#form.credential#" template = "modules/parse_phnum.cfm"></cfoutput>
<cfif REFindNocase("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.(([a-z]{2,3})|(aero|coop|info|museum|name))$", form.credential) EQ 0 AND len(parsed_phnum) neq 10>
<cfset messages = listappend(messages, "invalid info entered - please input only an email address or mobile nuber.")>
</cfif>
<cfquery name="Get_user" datasource="#application.datasource#" dbtype="ODBC">
SELECT EmailID, ContactNumber, EmailUUID
FROM dbo.UserMaster
WHERE (EmailID = '#form.credential#'
OR
ContactNumber = '#parsed_phnum#')
AND
IsEmailVerify = 1
AND
IsCOntactVerify = 1
</cfquery>
<cfif get_user.recordcount EQ 1>
<cfset link_to_build = "https://"&cgi.server_name&application.wwwrootprefix&"reset.cfm?UUID="&Get_user.EmailUUID>
<cfset isMessageSent = application.twilioObj.sendSMS(recipientNumber=#Get_user.ContactNumber#, messageBody = "Password change requested for Payfrit, please visit #link_to_build#")>
<cfset this_email_body = "Please click here to update your password:<br><br>
<br>
<cfoutput><a href='#link_to_build#'>click here to confirm</a></cfoutput><br>
<br>
if that doesn't work you can try to copy and paste this link into your browser:<br>
<br>
<cfoutput>#link_to_build#<br>
<br>
if you didn't request this action, please <a href='admin@payfrit.com'>email</a> us and we will figure out what happened.<br><br><br>
regards,<br>
<br>
Payfrit<br>
<cfoutput>"&cgi.server_name&"</cfoutput><br>">
<cfmodule template="#application.wwwrootprefix#modules/notifier.cfm"
domain="box.payfrit.com"
from_email="admin@payfrit.com"
to_email="#Get_user.EmailID#"
subject="Payfrit - reset your password"
email_body="#this_email_body#"
>
<br>
If there is registered Payfrit account with that information,<br>
you will receive information on hoow to reset your password.
<cfelse>
User not found!<br><br>
</cfif>
<cfelseif mode eq "forgot2">
<script language="JavaScript">
function submitformforgot1()
{
document.myformforgot1.submit();
}
</script>
<cfoutput><form action="#request.cgiPath#" method="post" name="myformforgot1" id="myformforgot1" style="display:inline;">
Please input your new password:<br><br>
<input type="text" name="new_password" size="15"><br><br>
Please type it again:<br><br>
<input type="text" name="new_password_confirm" size="15"><br><br>
<a href="javascript: submitformforgot1()">Submit</a>
<input type="hidden" name="mode" value="forgot3">
<input type="hidden" name="UUID" value="#form.UUID#">
</form></cfoutput><br>
<cfelseif mode eq "forgot3">
<cfif form.new_password eq form.new_password_confirm>
<cfquery name="update_password" datasource="#application.datasource#" dbtype="ODBC">
UPDATE dbo.UserMaster
SET Password = '#hash(new_password)#'
WHERE EmailUUID = '#form.UUID#'
AND
IsEmailVerify = 1
AND
IsCOntactVerify = 1
</cfquery>
Password updated!<br><br>
<cfelse>
<script language="JavaScript">
function submitformforgot1()
{
document.myformforgot1.submit();
}
</script>
<cfoutput><form action="#request.cgiPath#" method="post" name="myformforgot1" id="myformforgot1" style="display:inline;">
Values did not match, please try again!<br><br>
Please input your new password:<br><br>
<input type="text" name="new_password" size="15"><br><br>
Please type it again:<br><br>
<input type="text" name="new_password_confirm" size="15"><br><br>
<a href="javascript: submitformforgot1()">Submit</a>
<input type="hidden" name="mode" value="forgot3">
<input type="hidden" name="UUID" value="#form.UUID#">
</form></cfoutput><br>
</cfif>
<cfelse>
you shouldn't be here!
<cflocation url="https://payfr.it">
</cfif>