Click here to Skip to main content
15,891,895 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
hi to all,
Here i want to change password 30 days once. i have a field in model like Expired password date. now how i write in controller and views can anyone help me because i search in net cant find the solution so kindly help me.
Posted
Updated 6-Aug-14 19:27pm
v2

1 solution

You mean you can't find a pre-coded solution you can copy and paste? Not surprising...

It's quite easy really. When the user logs in, in your controller, you check the current date/time against the Expires date/time in the database. If the current date/time is greater, you simply Redirect to a password change controller and action to show an appropriate view.
 
Share this answer
 
Comments
JOTHI KUMAR Member 10918227 7-Aug-14 1:44am    
hey i'm don't do just copy and paste code, i cant find similar solution to this topic ok can you explain with example.
Dave Kreskowiak 7-Aug-14 8:36am    
I don't have time to write up an example.

It's not hard at all if you know the basics of MVC.

You already built your model, so I take you already know how to do a database query to retrieve your user.

Do you know how to put up a form and post the data back in MVC? If not, you really need to pickup a book on MVC and work through it. This is very basic stuff.

When a user submits their credentials for login and your controller gets called to authenticate those credentials you simply check the current date time against the expired time in the database. If the password is expired you simply RedirectToAction (HINT!) to another action in your controller that shows the password change view.

If you don't know how to do RedirectToAction or how to return a View from a controller, you REALLY need to learn the basics of MVC.

Raul Iloc 7-Aug-14 1:59am    
I agree with you. You have my vote (5).
JOTHI KUMAR Member 10918227 7-Aug-14 2:42am    
nobody know this question ha??or refer some similar sites
JOTHI KUMAR Member 10918227 8-Aug-14 1:42am    
Can anyone Explain me in Code

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