View Full Version : Email PW not sending and I'm not a newbie
ejhart7196405
03-01-2009, 01:59 PM
I've been using Security Assist for a couple of years now but, this is the first time I've had a problem where I just can't figure out why it won't send.
I follow the solution recipe each time so that I know I'm doing it correctly. It redirects as if it was successful but, I never get an email. I was searching the forums last night for anything new I might be missing but, of course their gone now.
So can someone go down a list of reasons why this may be happening?
Ok, now it's sending but, the random generated password sent isn't working
ejhart7196405
03-01-2009, 02:36 PM
Ok, now it's sending but, the random generated password sent isn't working.
Ray Borduin
03-02-2009, 07:49 AM
It could be a problem with the position of the code on the page. It is difficult to say without looking at it, but the random password is generated with two essential chunks of code... an include file that contains the function that actually generates the password, and a line of code on the page that calls that function and usually stores it as a session variable to be used later.
If it isn't working, one of those two things is out of place or referenced improperly. If you continue to have problems, post a support incident... this will give you an opportunity to share your files and webassist can debug them directly to determine the precise problem.
ejhart7196405
03-02-2009, 05:22 PM
Well, is there a standard way like what comes first or second?
I read on the old forums that either Update Record server behavior or Send Email server behavior comes first. I can't remember which one but, I did rearrange it and nothing changed.
It no longer lists in my account history but, I think at this stage, I have no more support tickets available for Security Assist.
Here's my code below
<?php require_once('Connections/nysxreg.php');?>
<?php require_once("WA_SecurityAssist/WA_RandomPassword.php"); ?>
<?php require_once("WA_SecurityAssist/WA_SHA1Encryption.php"); ?>
<?php require_once("WA_DataAssist/WA_AppBuilder_PHP.php"); ?>
<?php require_once( "WA_SecurityAssist/Helper_PHP.php" );?>
<?php
if (!session_id()) session_start();
if (isset($_POST["Send_x"])) {
$_SESSION["newpw"] = "".WA_RandomPassword(8, false, true, true, "") ."";
}
?>
<?php
// WA Application Builder Update
if (isset($_POST["Send_x"])) // Trigger
{
$WA_connection = $nysxreg;
$WA_table = "organizations";
$WA_redirectURL = "";
$WA_keepQueryString = false;
$WA_indexField = "OrgEmail";
$WA_fieldNamesStr = "OrgPassword";
$WA_fieldValuesStr = "".WA_SHA1Encryption(WA_RandomPassword(8, false, true, true, "")) ."";
$WA_columnTypesStr = "',none,''";
$WA_comparisonStr = "=";
$WA_fieldNames = explode("|", $WA_fieldNamesStr);
$WA_fieldValues = explode("|", $WA_fieldValuesStr);
$WA_columns = explode("|", $WA_columnTypesStr);
$WA_where_fieldValuesStr = "".((isset($_POST["emailAddress"]))?$_POST["emailAddress"]:"") ."";
$WA_where_columnTypesStr = "',none,''";
$WA_where_comparisonStr = "=";
$WA_where_fieldNames = explode("|", $WA_indexField);
$WA_where_fieldValues = explode("|", $WA_where_fieldValuesStr);
$WA_where_columns = explode("|", $WA_where_columnTypesStr);
$WA_where_comparisons = explode("|", $WA_where_comparisonStr);
$WA_connectionDB = $database_nysxreg;
mysql_select_db($WA_connectionDB, $WA_connection);
if (!session_id()) session_start();
$updateParamsObj = WA_AB_generateInsertParams($WA_fieldNames, $WA_columns, $WA_fieldValues, -1);
$WhereObj = WA_AB_generateWhereClause($WA_where_fieldNames, $WA_where_columns, $WA_where_fieldValues, $WA_where_comparisons );
$WA_Sql = "UPDATE `" . $WA_table . "` SET " . $updateParamsObj->WA_setValues . " WHERE " . $WhereObj->sqlWhereClause . "";
$MM_editCmd = mysql_query($WA_Sql, $WA_connection) or die(mysql_error());
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
<?php
function WA_SecurityAssist_Email_1_SendMail($WA_Auth_Parame ter){
$WA_MailObject = WA_SecurityAssist_Definition("mail.mydomain.net","25","myname@mydomain.com","New York Shock Exchange","","");
$WA_MailObject = WA_SecurityAssist_SendMail($WA_MailObject,"","","",$WA_Auth_Parameter["toAddress"],"",$WA_Auth_Parameter["fromAddress"],$WA_Auth_Parameter["subject"],$WA_Auth_Parameter["mailBody"]);
$WA_MailObject = null;
}// WA_SecurityAssist_Email_1_SendMail
?>
<?php
if(isset($_POST["Send_x"])){
//WA SecurityAssist Email object="Mail for Linux"
$WA_Auth_Parameter = array(
"connection" => $nysxreg,
"database" => $database_nysxreg,
"tableName" => "organizations",
"filterColumn" => "OrgEmail",
"columnValue" => "".((isset($_POST["emailAddress"]))?$_POST["emailAddress"]:"") ."",
"columnType" => "text",
"usernameColumn" => "OrgAAUCode",
"passwordColumn" => "OrgPassword",
"selectColumns" => array("OrgName"),
"sessionVariables" => array("newpw"),
"successRedirect" => "login.php",
"failRedirect" => "emailpw.php",
"keepQueryString" => TRUE,
"toAddressColumn" => "OrgEmail",
"fromAddress" => "myname@mydomain.com",
"fromAddressDisplay" => "NYSX Online Registration",
"subject" => "Online Registration Info",
"mailBody" => "Hello [OrgName],\r\nYou're receiving this e-mail because you requested a password reset for your user account.\r\nYour new password is:\r\nPassword: [Session.newpw]\r\nPlease login using your AAU Code and new password.\r\nThanks for using our site!",
"emailFunction" => "WA_SecurityAssist_Email_1_SendMail"
);
WA_Auth_ForgotPassword($WA_Auth_Parameter);
}
?>
Ray Borduin
03-03-2009, 07:21 AM
There are no longer limits on support tickets, so you have unlimited available for all of your products.
It doesn't really matter which goes first, as long as the first one does not specify a redirect page.... so the order you have should work since the update is before the email and has a blank redirect setting.
It really appears this page should work. What is the result you are having? The email gets sent but the password is not updated?
Is it updated in the email and not in the database? or is it updated in the database and not in the email?
ejhart7196405
03-03-2009, 09:49 AM
Well, I get sent a new password by email. So that is working.
When I use the password, it does not work. Neither does the old one though. So I'm thinking it is being updated in the database.
I looked at an old support ticket from when I first started using SA and I saw where I had made the characters in the db table for encrypted passwords too short (varchar(8) changed to varchar(50) per support instructions).
So I checked that and, just as I thought, I copy those db table specifications from website to website so that I don't come across that issue again.
So if it's being updated in the database and sent to me by email, could the issue be with the login page? I didn't have a problem with that until I started testing the EmailPW page.
Ray Borduin
03-04-2009, 09:22 AM
Sounds like a problem on the login page. Maybe you aren't encrypting the entered password before comparing it to the database entry.
ejhart7196405
03-04-2009, 09:26 AM
Cool, now I have somewhere else I can check for the problem when I get home. Before, I had run out of the usual suspects. Thanks for reasoning that out for me. If possible, I do like to kind of figure it out on my own so that I can learn. So this little brainstorming session did help out a great deal. I'll try to make sure I come back and let everyone know what the deal was so it will help someone else later on.
Thanks
ejhart7196405
03-04-2009, 11:01 PM
Ok, I found that it wasn't the login page.
This line:
$WA_fieldValuesStr = "".WA_SHA1Encryption(WA_RandomPassword(8, false, true, true, "")) ."";
Should be this:
$WA_fieldValuesStr = "".WA_SHA1Encryption($_SESSION['newpw']) ."";
Although I don't remember doing it, I must have been clicking on 'Random Password' instead of the actual session for the random password.
Ray Borduin
03-05-2009, 08:06 AM
That makes sense... so you were updating the database with one random password and sending an email with another. I didn't think about that possibility but it makes sense now considering the results you were experiencing.
karen.marley367377
06-03-2009, 01:06 PM
Thank you Thank you Thank you! - I have followed the tutorials to a tee on the Security Assist Solution Recipes - and had the same problem,
Now - after following Ray's post and replies on your thread, have finally cracked it!
Ray - you are a genius!
Any change the solution recipes could be updated to show this step to newbies like myself.
vBulletin® v3.8.1, Copyright ©2000-2012, Jelsoft Enterprises Ltd.