-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoginForm.aspx.cs
49 lines (47 loc) · 1.45 KB
/
LoginForm.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class LoginForm : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["user"] != null)
{
Server.Transfer("ShopBook.aspx");
}
}
protected void btnLogin_Click(object sender, EventArgs e)
{
List<User> users = UserDB.getAllCustomer();
foreach (User u in users)
{
if (tbxEmail.Text == u.Email && tbxPassword.Text == u.Password)
{
Session["user"] = u;
Server.Transfer("ShopBook.aspx");
}
else
{
List<Member> admins = (List<Member>)Application["admins"];
foreach (Member a in admins)
{
if (tbxEmail.Text == a.Email && tbxPassword.Text == a.Password)
{
Session["admin"] = a;
Response.Write("<script>alert('Redirecting to Admin Site');</script>");
Server.Transfer("UpdateBook.aspx");
}
}
}
}
pnlLoginError.Visible = true;
lblOutput.Text = "invalid Email Or Password!";
}
protected void btnForgot_Click(object sender, EventArgs e)
{
Server.Transfer("ForgotPassword.aspx");
}
}