public void OnPostVerifyUser() { if (FormFilled()) { if (VerifyPassword()) { alertSuccess = true; DBRepos repos = new DBRepos(); user_controller user = repos.GetUserByUserID(LoginUser.loginUsername); // login succesvol HttpContext.Session.SetString("LoginSession", user.user_id.ToString()); if (user.admin == true) { Response.Redirect("adminpage"); } else { Response.Redirect("index"); } } else { alertDanger = true; } } else { alertDanger = true; } }
public IndexModel(ILogger <IndexModel> logger) { _logger = logger; User = new user_controller(); LoginUser = new login_user(); Label = "test"; }
public void OnGet() { //string cookieStr = Request.Cookies["cookieLogin"]; string SessionCookie = HttpContext.Session.GetString("LoginSession"); DBRepos repos = new DBRepos(); user_controller user = repos.GetUserByID(Convert.ToInt32(SessionCookie)); if (SessionCookie != null) { Label = "Welcome, " + FirstLetterToUpper(user.username.ToString()) + "!"; } }
public HeaderViewComponent() { User = new user_controller(); User.admin = false; User.email = "*****@*****.**"; User.first_name = "test"; User.last_name = "Riemersma"; User.password = "******"; User.username = "******"; User.user_id = 22; LoginUser = new login_user(); Label = "tyfuas"; test = "tyfus"; }
private void button1_Click(object sender, EventArgs e) { user_controller temp = new user_controller(); if (radioButton1.Checked == true) { temp.register(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, Convert.ToInt32(textBox5.Text), Convert.ToInt32(textBox6.Text), "male", Convert.ToInt32(textBox7.Text), Convert.ToInt32(textBox8.Text)); } else if (radioButton2.Checked == true) { temp.register(textBox1.Text, textBox2.Text, textBox3.Text, textBox4.Text, Convert.ToInt32(textBox5.Text), Convert.ToInt32(textBox6.Text), "female", Convert.ToInt32(textBox7.Text), Convert.ToInt32(textBox8.Text)); } //string username, string password, string name, //int age,int weight,string gender, int height,int target Form4 f4 = new Form4(); this.Hide(); f4.ShowDialog(); }