/
ResetPassword.aspx.cs
128 lines (112 loc) · 4.1 KB
/
ResetPassword.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _ResetPassword : Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.Page.Title = "KeenProfile Reset Password";
if (!this.Page.IsPostBack)
{
Model_Users u = UserSessionController.FrontAppAuthLogin(this);
if (u != null)
{
Response.Redirect("/");
Response.End();
}
else
{
if (!string.IsNullOrEmpty(Request.QueryString["e"])){
HttpSessionState Hotels2Session = HttpContext.Current.Session;
string q = StringUtility.DecryptedData(Request.QueryString["e"]);
string[] arrq = q.Split('@');
string qUserID = arrq[0];
string qSession = arrq[1];
if(Hotels2Session[qSession] == null)
{
ss.InnerHtml = "Sorry the session is timeout";
signup_password.Visible = false;
ConfirmPassword.Visible = false;
btn_login.Visible = false;
bb.Visible = false;
btn_forgot.Visible = true;
}
}
else
{
ss.InnerHtml = "Sorry the session is timeout";
signup_password.Visible = false;
ConfirmPassword.Visible = false;
btn_login.Visible = false;
bb.Visible = false;
btn_forgot.Visible = true;
}
}
}
}
protected void btn_login_Click(object sender, EventArgs e)
{
if (!String.IsNullOrEmpty(Request.QueryString["e"]))
{
HttpSessionState Hotels2Session = HttpContext.Current.Session;
string password = signup_password.Text.Trim();
string q = StringUtility.DecryptedData(Request.QueryString["e"]);
string[] arrq = q.Split('@');
string qUserID = arrq[0];
string qSession = arrq[1];
if (Hotels2Session[qSession] == null)
{
ss.InnerHtml = "Sorry the session is timeout";
signup_password.Visible = false;
ConfirmPassword.Visible = false;
btn_login.Visible = false;
bb.Visible = false;
btn_forgot.Visible = true;
}
else
{
Model_Users mu = new Model_Users
{
UserID = int.Parse(qUserID),
Password = password
};
if(UsersController.UpdatePassword(mu))
{
signup_password.Visible = false;
ConfirmPassword.Visible = false;
btn_login.Visible = false;
bb.Visible = false;
ss.InnerHtml = "New password set successfully.";
btn_login.Visible = false;
btnBacklogin.Visible = true;
}
}
}
else
{
ss.InnerHtml = "Sorry the session is timeout";
signup_password.Visible = false;
ConfirmPassword.Visible = false;
btn_login.Visible = false;
bb.Visible = false;
btn_forgot.Visible = true;
}
}
//protected void btnSignup_Click(object sender, EventArgs e)
//{
//}
protected void btn_forgot_Click(object sender, EventArgs e)
{
Response.Redirect("Forgot");
Response.End();
}
protected void btnBacklogin_Click(object sender, EventArgs e)
{
Response.Redirect("Login");
Response.End();
}
}