locked
No Forgotpassword for a specific user RRS feed

  • Question

  • User709978785 posted

    I'm using a login control with a layout template that has a username textbox and have the forgotpassword link showing. I need to disable it if a specific user tried to login. How can I do that?

    Monday, April 28, 2014 3:49 PM

Answers

  • User709978785 posted

    Is it possible to do this from the Forgotpassword.aspx page?

    I tried the following but it did not work. I'm not sure the username textbox in the login control has a text property. So I don;t know how to check the user name?

    Any Ideas?

    Sub PasswordRecovery1_VerifyingUser(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs)
            If PasswordRecovery1.UserName = "SpecificUserName" Then
                PasswordRecovery1.UserNameInstructionText = "You must enter another name."
                e.Cancel = True
            Else
                PasswordRecovery1.UserNameInstructionText = "Enter your User Name to receive your password."
            End If
        End Sub

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 28, 2014 7:28 PM

All replies

  • User1564875471 posted

    I think you can handle the LoginError event of the Login control, then if the user name (can be taken directly from the username text box) matches with what you are looking for, you use get a reference to the link that is inside the login control (LoginControlID.FindControl("LinkID").Visible=false.

    Maybe better to show the markup incase it didn't work.

    Monday, April 28, 2014 4:55 PM
  • User709978785 posted

    Is it possible to do this from the Forgotpassword.aspx page?

    I tried the following but it did not work. I'm not sure the username textbox in the login control has a text property. So I don;t know how to check the user name?

    Any Ideas?

    Sub PasswordRecovery1_VerifyingUser(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.LoginCancelEventArgs)
            If PasswordRecovery1.UserName = "SpecificUserName" Then
                PasswordRecovery1.UserNameInstructionText = "You must enter another name."
                e.Cancel = True
            Else
                PasswordRecovery1.UserNameInstructionText = "Enter your User Name to receive your password."
            End If
        End Sub

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, April 28, 2014 7:28 PM