/
login.aspx.cs
33 lines (28 loc) · 1.07 KB
/
login.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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class login : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnLogin_onclick(object sender, EventArgs e)
{
RepoMapConnect RMCaccount = new RepoMapConnect(databaseTable.PrimaryAccount);
PrimaryAccountMap PAM = new PrimaryAccountMap();
PAM.username = txtUsername.Text;
RMCaccount.map = RMCaccount.repo.selectData(PAM);
if (RMCaccount.map.password == RMCaccount.func.hashedValue(txtPassword.Text + RMCaccount.map.salt))
{
SessionsMap map = new SessionsMap(RMCaccount.map.id);
SessionsRepository repo = new SessionsRepository();
repo.executeData(map, sqlStatementType.Insert);
HttpCookie cookie = RMCaccount.func.createcookie(map.sessionVal, "SessionCookie");
Response.Cookies.Add(cookie);
Response.Redirect("Account/view.aspx");
}
}
}