Error message for Unauthorized users?
Last Post 01-14-2013 11:47 AM by Ryan Bakerink. 3 Replies.
AddThis - Bookmarking and Sharing Button
Author Messages Not Resolved
Amy CaseyUser is Offline
going with the flow
going with the flow
Posts:54
Avatar

--
12-18-2012 12:41 PM
    When users enter a bad password or user name they get an error, however if an unauthorized user (in my case someone who has registered but not been approved) tries to login the page just kind of reloads, deleting what they had entered. 

    Can i configure an error message that tells unauthorized users they will not be able to login until they are approved?
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    12-21-2012 04:59 AM
    Hello Amy,

    There's a feature in Dynamic Login named "Restrict by IP / SQL Validation". SQL Validation will enable you to perform a search in the database, and return a message based on the conditions you've setup.

    You can re-purpose the SQL Query in the following Forum:
    http://www.datasprings.com/dnn-modu...h-checkbox

    You can build your SQL Validation around this:

    UPDATE UserPortals SET Authorised = 'False' WHERE PortalId=$(PortalID) AND UserId = $(UserID)

    Of course you won't be updating, just add some logic and conditionally return true or false.

    Please let me know if you have any questions.

    Thanks,

    Ryan

    Albert EltawilUser is Offline
    wading in the water
    wading in the water
    Posts:14
    Avatar

    --
    01-11-2013 08:50 AM
    Hey Ryan, I tried your proposed solution for unauthorized users but it still didn't display the message.

    Here is my validation query (the 'Enable SQL Validation' is turned ON):

    SELECT Authorised as IsValid 
    FROM UserPortals
    WHERE UserID = $(UserID) AND PortalID = $(PortalID)

    Validation message:

    "Your account hasn't been authorized yet."

    Users who are not authorized still did not get the message. So I tried the following to see if the workflow actually works:

    SELECT '0' as IsValid

    And it did display the message for all users except unauthorized users.

    So what am I missing?
    Albert Eltawil | Systems Developer | IES Group Inc.
    Ryan BakerinkUser is Offline
    river guide
    river guide
    Posts:1900
    Avatar

    --
    01-14-2013 11:47 AM
    Hello Albert,

    I may take a different approach:


    DECLARE @IsAuthorisedUser int
    SET @IsAuthorizedUser =(SELECT Authorised FROM UserPortals WHERE UserID = '$(UserID)' AND PortalID = '$(PortalID)')

    IF @IsAuthorisedUser = 1
    BEGIN
    Select 'True' As IsValid
    END
    ELSE
    BEGIN
    Select 'False' As IsValid
    END


    Or you can shorten the Code:

    IF (SELECT Authorised FROM UserPortals WHERE UserID = '$(UserID)' AND PortalID = '$(PortalID)') = 1 
    BEGIN
    Select 'True' As IsValid
    END
    ELSE
    BEGIN
    Select 'False' As IsValid
    END

    Try either one out and let me know if it begins working. If it doesn't, then you may be experiencing a bug.

    Please let me know if you have any questions.

    Thanks,

    Ryan


    ---
  • film izle
  • 720 izle
  • film
  • sinema izle
  • film makinesi
  • T�rk�e dublaj film
  • film izle
  • film izle
  • baglan film izle
  • sinema izle
  • 1080 film izle
  • film mercegi