Password Expiration Notice Handling

onecm
Member Posts: 2
Dear All,
Currently, I want to alert user for their passowrd expiration during Navision logon.
I searched for solution and found that I can use stored procedure 'sp_$ndo$loginproc' to do that.
I finally write the following code :
I tested it and found that it only work for user with sysadmin role in SQL server.
As I only want those users with public role to have the alert message. Can anyone help me to solve it ?
Many thanks for your kindly help !
Currently, I want to alert user for their passowrd expiration during Navision logon.
I searched for solution and found that I can use stored procedure 'sp_$ndo$loginproc' to do that.
I finally write the following code :
IF EXISTS (SELECT name FROM sysobjects WHERE name = 'sp_$ndo$loginproc' AND type = 'P') DROP PROCEDURE [sp_$ndo$loginproc] GO CREATE PROCEDURE [sp_$ndo$loginproc] @appname VARCHAR(64) = NULL, @appversion VARCHAR(16) = NULL AS BEGIN IF SUSER_SNAME() IN ( SELECT SL.name AS LoginName FROM sys.sql_logins AS SL WHERE (is_expiration_checked = 1 and LOGINPROPERTY (SL.name, 'DaysUntilExpiration') = 2) ) PRINT 'Your password will be expired within 2 days, please change it ! ' IF SUSER_SNAME() IN ( SELECT SL.name AS LoginName FROM sys.sql_logins AS SL WHERE (is_expiration_checked = 1 and LOGINPROPERTY (SL.name, 'DaysUntilExpiration') = 1) ) PRINT 'Your password will be expired within 1 days, please change it ! ' END GO GRANT EXECUTE ON [sp_$ndo$loginproc] TO public GO
I tested it and found that it only work for user with sysadmin role in SQL server.
As I only want those users with public role to have the alert message. Can anyone help me to solve it ?
Many thanks for your kindly help !
0
Comments
-
You could create a new table in your Navision database that will store an OnLogin notice. You could then insert a notification from a stored proc that gets run once a day by an automated task. Then when a user logs in you could check the table for notifications meant for that user, display them and then delete them.Thad Ryker
I traded my sanity for a railgun0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions