Iron Speed Technical Forums
Register Latest Topics
 
 
 


Reply
  Author   Comment  
SkyForum

Registered:
Posts: 48
Reply with quote  #1 
I have enabled password encryption. Works perfectly except when you try and retrieve your password with the forgotuser feature. When you click OK, it tells you the email was sent but it never shows up. Does not throw error.

I have been all through the forums here and cannot find a solution. How does the application decrypt the password before its sent? Is it possible that it's not decrypting and the encrypted password is too large for the field?

Do I need to add a line of code to decrypt the password somewhere?

I'm at a loss here. Is it even possible?

__________________
As you get older, your patience begins to wane. As a result, you become the "Grumpy Old Guy".  At 60 years of age I have become this guy. I am now faced with the dilemma of an old dog learning new relationship tricks to survive. [rolleyes]
JimiJ

Avatar / Picture

MVP Developer
Registered:
Posts: 1,955
Reply with quote  #2 
We have a standard custom method for Forgot password routine. For encrypted password we always use this formula before sending:
FormulaUtils.DecryptData([encrypted password]).

Cheers,
Jimi J

__________________

  Jaime Jegonia
[jts_logo]

Iron Speed MVP Developer
 

". . . and whoever sows generously will also reap generously" 2 Cor 9:6

SkyForum

Registered:
Posts: 48
Reply with quote  #3 
Ok, thank you. Can you please explain in detail where this is applied or added so i can correct my issue? Thank you for your help....
__________________
As you get older, your patience begins to wane. As a result, you become the "Grumpy Old Guy".  At 60 years of age I have become this guy. I am now faced with the dilemma of an old dog learning new relationship tricks to survive. [rolleyes]
JimiJ

Avatar / Picture

MVP Developer
Registered:
Posts: 1,955
Reply with quote  #4 
Sorry! I can't give our proprietary code, but I will give you the main logic. You can easily fetch the password based on signed in UserID(), using common formula or GetRecord() method, decrypt it and send to the account's email address.   
 
Happy New Year!
Jimi J

__________________

  Jaime Jegonia
[jts_logo]

Iron Speed MVP Developer
 

". . . and whoever sows generously will also reap generously" 2 Cor 9:6

JBEMETO

Registered:
Posts: 160
Reply with quote  #5 
Happy New year Jimi,

Let me enjoy this priviledge too.
Cheers!!

__________________
JBEMETO
hafeezuddin

Registered:
Posts: 16
Reply with quote  #6 
Hi,

You can use the below code as I have used it in one of my app and its working fine.

 Public Sub SendButton_Click(ByVal sender As Object, ByVal args As EventArgs)
            ' Click handler for SendButton.
            ' Customize by adding code before the call or replace the call to the Base function with your own code.
            'SendButton_Click_Base(sender, args)
            SendPasswordToCustomer()
            ' NOTE: If the Base function redirects to another page, any code here will not be executed.
        End Sub

        Private Sub SendPasswordToCustomer()
             
 ' The email address is required by validation
            Dim uemail As String = Me.Emailaddress.Text

            ' lookup the email address in the user identity table and abort if not present


            Dim email As New BaseClasses.Utils.MailSenderInThread()
            email.AddFrom("no-reply@xxx.com")
            email.AddTo(uemail)
           
            email.SetSubject(GetResourceValue("Txt:GetSignin"))

 

            ' Create where string
            Dim whereStr As String = UsersTable.Emailid.UniqueName & " = " & "'" & uemail & "'"

            ' Create the order by string.
            Dim orderBy As BaseClasses.Data.OrderBy = Nothing
            Dim myRecord As UsersRecord = UsersTable.GetRecord(whereStr, orderBy)

            If IsNothing(myRecord) Then
                Utils.MiscUtils.RegisterJScriptAlert(Me, "Invalid Email Id", "Unregistered EmailId")
                Exit Sub
            End If

            Dim userid As String = myRecord.UserId0.ToString
            Dim password As String = BaseFormulaUtils.DecryptData(myRecord.Password.ToString)

            ' send the login info to the user email
            email.Body = "Your username & password is below:" & "<br/> <br/> Username: " & userid & "<br/> <br/> Password: " & password
            email.AreImagesEmbedded = True
            email.SetIsHtmlContent(True)
            'End While

            Try

                email.SendMessage()


            Catch ex As Exception
                Dim msg As String = GetResourceValue("Msg:SendToFailed") & " " & uemail & "<br />" & ex.Message
                Dim exc As New Exception(msg)
                Throw exc
            End Try

            Me.ForgotUserInfoLabel.Visible = True
            Me.ForgotUserInfoLabel.Text = GetResourceValue("Msg[tongue]wdEmailed") & " " & uemail
            Me.ForgotUserErrorLabel.Text = ""
            Me.ForgotUserErrorLabel.Visible = False
            Me.EnterEmailLabel.Visible = False
            Me.Emailaddress.Visible = False

            Me.SendButton.Visible = False
  End Sub

moulay

Registered:
Posts: 87
Reply with quote  #7 
HI,
you can change 1 line in this function in send "SendUserInfo.aspx.cs" (bold text)

public void DatabindLoginsForEmail()
{

string logList = "";

// get the email address from the url argument
string cryptarg = "";
string uemail = "";
try
{
cryptarg = this.Request.QueryString["Email"];
uemail = ((BaseApplicationPage)this.Page).Decrypt(cryptarg, false);
}
catch
{
EmailSetupError(GetResourceValue("Msg:ErrorProcessing"));
return;
}

if (string.IsNullOrEmpty(uemail))
{
EmailSetupError(GetResourceValue("Msg:NoEmail"));
return;
}

// add the email address to the InformationLabel
string lblInfo = this.InformationLabel.Text;
if (lblInfo.IndexOf(uemail) < 0)
{
this.InformationLabel.Text = lblInfo + " " + uemail;
}

// get the table used for login info
IUserIdentityTable userTable = (IUserIdentityTable)(BaseClasses.Configuration.ApplicationSettings.Current.GetUserIdentityTable());
if (userTable == null)
{
EmailSetupError(GetResourceValue("Msg:NoLoginTable"));
return;
}

// get all the login records containing the email address
BaseFilter fltr = new ColumnValueFilter(userTable.UserEmailColumn, uemail);
GroupBy grpby = new GroupBy(false, false);
OrderBy ordby = new OrderBy(false, false);
ArrayList logRecs = userTable.GetRecordList(fltr, grpby, ordby, 0, 100);

if (logRecs.Count < 1)
{
EmailSetupError(GetResourceValue("Txt:NoSigninInfo") + " " + uemail);
return;
}

// for each login record, add the username and password to the result
string h1 = GetResourceValue("Txt:UsernameCol");
string h2 = GetResourceValue("Txt[tongue]asswordCol");
string stlTable="style=\"font-family:Verdana, Arial, Georgia, sans serif; font-size:12px;\"";
string stlName="style=\"color: #bbbbbb; padding-bottom: 6px; padding-right: 4px; text-align: right; vertical-align: top; white-space: nowrap;\"";
string stlPwd="style=\"color: #bbbbbb; padding-bottom: 20px; padding-right: 4px; text-align: right; vertical-align: top; white-space: nowrap;\"";
string stlNameval="style=\"color: #555555; padding-bottom: 6px; padding-left: 4px; text-align: left; vertical-align: top; white-space: nowrap;\"";
string stlPwdval="style=\"color: #555555; padding-bottom: 20px; padding-left: 4px; text-align: left; vertical-align: top; white-space: nowrap;\"";
logList = "";
foreach (IUserIdentityRecord logRec in logRecs)
{
string uname = "<td " + stlName + ">" + h1 + "</td>";
uname += "<td " + stlNameval + ">" + "<pre>" + logRec.GetUserName() + "</pre>" + "</td>";
string upwd = "<td " + stlPwd + ">" + h2 + "</td>";
upwd += "<td " + stlPwdval + ">" + "<pre>" + youredecryptfunction(logRec.GetUserPassword()) + "</pre>" + "</td>";
logList += "<tr>" + uname + "</tr><tr>" + upwd + "</tr>" + Environment.NewLine;
}

// update the textbox with the login list
this.MyLoginInfo.Text = "<table width=100% " + stlTable + ">" + Environment.NewLine + logList + "</table>";
return;
}

SkyForum

Registered:
Posts: 48
Reply with quote  #8 
Here's what I did. Still does not work. I'm just poking and hoping here. I do not get the email. 

// for each login record, add the username and password to the result
string h1 = GetResourceValue("Txt:UsernameCol");
string h2 = GetResourceValue("Txt[tongue]asswordCol");
string stlTable="style=\"font-family:Verdana, Arial, Georgia, sans serif; font-size:12px;\"";
string stlName="style=\"color: #bbbbbb; padding-bottom: 6px; padding-right: 4px; text-align: right; vertical-align: top; white-space: nowrap;\"";
string stlPwd="style=\"color: #bbbbbb; padding-bottom: 20px; padding-right: 4px; text-align: right; vertical-align: top; white-space: nowrap;\"";
string stlNameval="style=\"color: #555555; padding-bottom: 6px; padding-left: 4px; text-align: left; vertical-align: top; white-space: nowrap;\"";
string stlPwdval="style=\"color: #555555; padding-bottom: 20px; padding-left: 4px; text-align: left; vertical-align: top; white-space: nowrap;\"";
logList = "";
foreach (IUserIdentityRecord logRec in logRecs)
{
string uname = "<td " + stlName + ">" + h1 + "</td>";
uname += "<td " + stlNameval + ">" + "<pre>" + logRec.GetUserName() + "</pre>" + "</td>";
string upwd = "<td " + stlPwd + ">" + h2 + "</td>";
upwd += "<td " + stlPwdval + ">" + "<pre>" + BaseFormulaUtils.DecryptData(logRec.GetUserPassword()) + "</pre>" + "</td>";
logList += "<tr>" + uname + "</tr><tr>" + upwd + "</tr>" + Environment.NewLine;


__________________
As you get older, your patience begins to wane. As a result, you become the "Grumpy Old Guy".  At 60 years of age I have become this guy. I am now faced with the dilemma of an old dog learning new relationship tricks to survive. [rolleyes]
SkyForum

Registered:
Posts: 48
Reply with quote  #9 
I give up. After more than a year trying to get the encrypted password system to work to no avail, I am going back to clear text. I know someone has gotten the forgot password to work with encryption but no one wants to give away their secrets. 

Frustrated as usual.

__________________
As you get older, your patience begins to wane. As a result, you become the "Grumpy Old Guy".  At 60 years of age I have become this guy. I am now faced with the dilemma of an old dog learning new relationship tricks to survive. [rolleyes]
SkyForum

Registered:
Posts: 48
Reply with quote  #10 
I swear on my grandmothers grave I'm going to take my AR-15 and use this com for some target practice in my backyard! 

I am such a NON GEEK! I removed all the extraneous code adjustments, put it all back the way it was. DID NOT remove the encryption from the password fields in the DB and the added snippet in the signin.aspx page (prom Akesh video) thought I'd just get it working again for tonight. then login tomorrow and finish removing the encryption. 

Went to the login screen, decided to click the lost password link one more time just because I was bored


and the SOB worked. [mad]

That only took me about a year and a half. 




__________________
As you get older, your patience begins to wane. As a result, you become the "Grumpy Old Guy".  At 60 years of age I have become this guy. I am now faced with the dilemma of an old dog learning new relationship tricks to survive. [rolleyes]
Previous Topic | Next Topic
Print
Reply

Quick Navigation:

Easily create a Forum Website with Website Toolbox.

Download Iron Speed Designer

Terms of Service Privacy Statement