Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • MRP 2 posts 22 karma points
    Sep 23, 2011 @ 19:12
    MRP
    0

    Can't Login with custom login from ?

    Tnx in Forward :D

     

    I've implement a login form using user api , but it doesn't work and return False !!!

    code :
    Response.Write(User.validateCredentials("MyUsername","MyPasswod"));

    Or:
    var logedInUser = new umbraco.providers.UsersMembershipProvider();
    Response.Write(logedInUser.ValidateUser("username","passwod"));

    in both cases it returns False although my username and password is true !!!

  • Bo Damgaard Mortensen 719 posts 1207 karma points
    Sep 23, 2011 @ 20:59
    Bo Damgaard Mortensen
    0

    Hi jpazooki,

    Which version of Umbraco are you running? :)

    If you're running 4.7.0 or 4.7.1, you could use the following Razor snippet for a custom login (using the default ASP.NET MemberShip provider)

    @using System.Web.Security

    @if (!IsPost)
    {
       <form id="login-form" method="post">
        <p>
          <label for="txt-username">Username</label>
        </p>
        <input name="username" id="txt-username" type="text" />
        
        <p>
          <label for="txt-password">Password</label>
        </p>
        <input name="password" id="txt-password" type="password" />
      
        <p><href="#">Forgot your password?</a></p>
        <input type="submit" value="LOGIN" name="submit" class="login-button" />
       </form>
    }
    else
    {
      var username Request["username"];
      var password Request["password"];
     
      if(Membership.ValidateUser(usernamepassword))
      {
          FormsAuthentication.SetAuthCookie(usernametrue);
          Response.Redirect("/");
      }
    }

    Don't know if that helps any ;)

  • MRP 2 posts 22 karma points
    Sep 24, 2011 @ 06:46
    MRP
    0

    Tnx, but this will work for members of my site and not for backend users :(

    I'm using 4.7.0 ....

     

    hope find some thing new to finish this site www.parmisran.com

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies