Reputation: 27
I want a method to ask the user to change his password after having it for 90 days.
I have something like this
ALTER PROCEDURE [dbo].[spRecoverPassword]
(
@sUsername varchar(50),
@sPassword varchar(100),
@sPasswordSalt varchar (128)
)
AS
BEGIN
SET NOCOUNT ON;
if (exists (select 1
from USER
where Username = @sUsername))
begin
update USER
set Password_Salt = @sPasswordSalt,
Password = @sPassword,
where Username = @sUsername;
select 1;
end
else
begin
select -1;
end
END
Then I have a method to call this stored procedure, from ASP.NET MVC. And somehow I would like to check the date that the password was last changed and do so that if that date is 90 days higher than today it will redirect it to the recover pass again. How should I do this?
Thanks
Upvotes: 0
Views: 1149
Reputation: 45490
Very easy:
last_changed
.last_changed
with now()
in the queryDATEDIFF(now(),last_changed)>90
Upvotes: 2
Reputation: 111
Add a new column in users Table to save last modified date of password. on Get method calculate the difference between Last modified date of password and today's date. and do what you want to do.
Upvotes: 2