This topic is locked

Activation Field.

10/6/2008 2:21:51 PM
ASPRunnerPro General questions
W
Wanda author

G'day to all. I'm really getting into this product and have found and used some very useful tips here.
However, we am having a slight problem that we get around.
I have a field in my MS SQL 2K5 db called activated. It is a bit field, which is set to 0 (false) when the account is created.
I want to use this field to trigger an event that redirects a user to a "Change Password" page. I want to do this because my staff creates the user account with some basic information. Then an email is sent automatically to the user with "Interim Login Info".
So, we need to force a user to change a password.
At this point we simply tell the user via email to do this, but we would like to manage this event.
Thanks all.
Just a quick edit here as well. Could someone also indicate to which event I would tie this to. I'm suspecting "after successful Login"???

Sergey Kornilov admin 10/7/2008

AfterSuccessfulLogin is correct event for this purpose.

W
Wanda author 10/29/2008

This is a follow up on this post.
I can't seem to get redirection to work. Probably not doing it right.
In the AfterSuccessfulLogin Event I am using this code:
if dict("activated") = 0 then

response.redirect("changepwd.asp")

end if
If I remove the DICT part and just use activated, then everyone is redirected. Even if the value = 1, which means the account IS activated.
Avtivated is a BIT column and is in fact Zero for an account that I tested.
Thanks

Sergey Kornilov admin 10/30/2008

AfterSuccessfulLogin event doesn't have dict parameter. You need to run SQL query using username and password as an argument to retrieve the value of Activated field.

W
Wanda author 10/31/2008

Yes sir, that's what we did. Created a recordset, grabbed it up and all was well. We now know how to do this. Many of the pointers and code frags throughout this site and from you helped.
Thanks.

jadachDevClub member 11/9/2008

Can someone explain to me how to do this?

"Run SQL query using username and password as an argument to retrieve the value of Activated field"
I have an app that I want to give a temporary password to the users, then force them to change their passwords.
Thanks

W
Wanda author 11/9/2008

Something Like this will do the trick:
dim rs, strSQL
strSQL = "Select Column1, Column2, ColumnX from TABLENAME "

strSQL = strSQL & "WHERE CONDITION ='" & StringToFind & "'"
Set rs = Server.CreateObject("ADODB.Recordset")

rs.Open strSQL, EW_DB_CONNECTION_STRING, 1, 2
' create session variables to be used later

session("strStatus") = rs("Acct_Status")

session("strActive") = rs("Activated")
rs.Close

Set rs = Nothing

jadachDevClub member 11/9/2008

Thank you Wanda. I will give that a try.

Something Like this will do the trick:

dim rs, strSQL
strSQL = "Select Column1, Column2, ColumnX from TABLENAME "

strSQL = strSQL & "WHERE CONDITION ='" & StringToFind & "'"
Set rs = Server.CreateObject("ADODB.Recordset")

rs.Open strSQL, EW_DB_CONNECTION_STRING, 1, 2
' create session variables to be used later

session("strStatus") = rs("Acct_Status")

session("strActive") = rs("Activated")
rs.Close

Set rs = Nothing