Website.ActivateWebsiteLogon
Documentation | WideWorldImporters |
Schema | Website |
Name | ActivateWebsiteLogon |
Allows a person (from Application.People) to have access to the website.
Input/Output
Mode | Name | Data type | Description | |
---|---|---|---|---|
1 | IN | PersonID | int | |
2 | IN | LogonName | nvarchar(50) | |
3 | IN | InitialPassword | nvarchar(40) |
Script
CREATE PROCEDURE Website.ActivateWebsiteLogon @PersonID int, @LogonName nvarchar(50), @InitialPassword nvarchar(40) WITH EXECUTE AS OWNER AS BEGIN SET NOCOUNT ON; SET XACT_ABORT ON; UPDATE [Application].People SET IsPermittedToLogon = 1, LogonName = @LogonName, HashedPassword = HASHBYTES(N'SHA2_256', @InitialPassword + FullName), UserPreferences = (SELECT UserPreferences FROM [Application].People WHERE PersonID = 1) -- Person 1 has User Preferences template WHERE PersonID = @PersonID AND PersonID <> 1 AND IsPermittedToLogon = 0; IF @@ROWCOUNT = 0 BEGIN PRINT N'The PersonID must be valid, must not be person 1, and must not already be enabled'; THROW 51000, N'Invalid PersonID', 1; RETURN -1; END; END; |
Exported: 2019-02-04 23:04, Last imported: 2018-08-10 09:51