示例#1
0
 protected void LoginButton_Clicked(object sender, EventArgs e)
 {
     User.UserAuthenticateResponce authenticationResponce = User.AuthenticateUser(UserNameTextBox.Text, PasswordTextBox.Text);
     if (authenticationResponce == User.UserAuthenticateResponce.UnknownUser)
     {
         Session["LastError"] = "Användaren hittades inte.";
         Response.Redirect(cms.Current.GetRootPath + "user/createuser");
     }
     else if (authenticationResponce == User.UserAuthenticateResponce.PasswordIncorrect)
     {
         Session["LastError"] = "Felaktigt lösenord.";
         Response.Redirect(cms.Current.GetRootPath + "user/login");
     }
     else
     {
         AccessControl.CreateUserSession(UserNameTextBox.Text);
         Response.Redirect(cms.Current.GetRootPath);
     }
 }
    protected void UserPanelLoginButton_Clicked(object sender, EventArgs e)
    {
        string userName = UserName2TextBox.Text;
        string password = Password2TextBox.Text;

        User.UserAuthenticateResponce authenticationResponce = CuplexLib.User.AuthenticateUser(userName, password);
        if (authenticationResponce == CuplexLib.User.UserAuthenticateResponce.UnknownUser)
        {
            Session["LastError"] = "Användaren hittades inte.";
            //Response.Redirect(cms.Current.GetRootPath + "user/createuser");
        }
        else if (authenticationResponce == CuplexLib.User.UserAuthenticateResponce.PasswordIncorrect)
        {
            Session["LastError"] = "Felaktigt lösenord.";
            //Response.Redirect(cms.Current.GetRootPath + "user/login");
        }
        else
        {
            AccessControl.CreateUserSession(userName);
            Response.Redirect(cms.Current.GetRootPath);
        }
    }