Click here to Skip to main content
15,890,947 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how to set password expire alert messge for user within before 3 days..?
is it possible in Ajax control alert box.....?
Posted
Updated 28-May-20 13:15pm
v4
Comments
shakil0304003 1-Feb-11 3:31am    
What you tried?

Sorry, no one here would write code for you. If you want to have idea,
1) You should store the date time when user sets/changes the password
2) When user logs in, check the date difference between current and the stored date.
3) If difference is more than or equal to password reset duration (or duration -3 days, as you specified), then prompt the user to change the password.
 
Share this answer
 
Comments
bhargavpp 30-Jul-11 7:44am    
but if user never change password then how to prompt it
If you want to display an alert message when user logs in then do as Prerak said.
But what if the user doesn't login for the last three days before the password expires.
Use a windows service to send an email to the user before 3 days.
Have a look[^] here
 
Share this answer
 
by comparing created date and current date if current date and created diffrence more than 3 then prompt to it for changing a password
 
Share this answer
 
VB
<pre> Private Sub CheckLastPasswordChangedDate()
        Try
            Con = New SqlConnection(connectionstringhere)
            Con.Open()
            cmd = Con.CreateCommand()
            cmd.CommandText = "SELECT PasswordLastChangedDate FROM YOURTABLENAME WHERE User_ID = '" & txt_Username.Text & "' and Password='" & EncryptData(txt_Password.Text) & "'"
            rdr = cmd.ExecuteReader()
            If rdr.Read Then
                Label1.Text = rdr.GetValue(0).ToString
                If Convert.ToDateTime(rdr.GetValue(0)).AddDays(passwordExpiresDays) < DateTime.Now Then
                    If MessageBox.Show("Your password has expired! Please change your password.", My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Asterisk) = System.Windows.Forms.DialogResult.OK Then
                        ForcePassChange_.Show()
                        Exit Sub
                    End If
                End If
            End If
        Catch ex As Exception
            MessageBox.Show(ex.Message, My.Application.Info.Title, MessageBoxButtons.OK, MessageBoxIcon.Error)
        Finally
            Con.Close()
            Con.Dispose()
            rdr.Close()
        End Try


    End Sub
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900