Ejemplo n.º 1
0
 /// <summary>
 /// a simple login method that uses the database
 /// </summary>
 /// <param name="username"></param>
 /// <param name="password"></param>
 /// <returns></returns>
 public bool LogIn(string username, string password)
 {
     foreach (Dictionary<string, object> D in db.Getuserpassword(username))
     {
         if ((string)D["wachtwoord"] == password)
         {
             LoggedInUser = new Account((string)D["naam"]);
             return true;
         }
     }
     return false;
 }
Ejemplo n.º 2
0
 //logs a user in if he can find the username/password combination in the database
 protected void btnLogin_OnClick(object sender, EventArgs e)
 {
     Klassen.Account acc = new Klassen.Account(tbUsername.Text);
     if (acc.LogIn(tbUsername.Text, tbPassword.Text))
     {
         Label username = (Label)this.Master.FindControl("lblUsername");
         username.Text = acc.Name;
         Response.Redirect("MainPage.aspx");
     }
     else
     {
         ClientScript.RegisterStartupScript(GetType(), "myalert", "alert('Kan niet inloggen. Controleer gebruikersnaam en wachtwoord.')", true);
     }
 }