Trying to keep with pragmatic programming principles, I'm trying to decide on how to handle user password changes based on the "Tell, Don't Ask" principle.
I have a user object whose password expires every 30 days. I need to be able to show a password expired/change password view if the password is expired. Asking the object if the password is expired (it's state) and then choosing which view to show seems like a violation of the principle.
What is the best way to handle this situation?
If you have received an email with a subject line something like, "Office 365 Password About to Expire" claiming that your account's password is about to expire, THIS IS A PHISHING SCAM being sent by cybercriminals and not by Microsoft.
Required Editions and User Permissions To expire passwords for all users, except those users with profiles that have the Password Never Expires user permission: From Setup, enter Expire All Passwords in the Quick Find box, then select Expire All Passwords. Select Expire all user passwords. Click Save.
Set password expiration policy Select Password expiration policy. If you don't want users to have to change passwords, uncheck the box next to Set passwords to never expire. Type how often passwords should expire.
login
model.validate();
return model.show(self);
passwordExpired()
return View("ChangePassword")
loginSuccess()
return View("default")
class User
show(aController)
if passwordExpired
return aContoller.passwordExpired()
else return aContoller.loginSuccess()
Tell, Don't Ask, no exceptions, and it obeys the law of Demeter
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With