forked from siteserver/cms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPageUserPassword.cs
More file actions
47 lines (43 loc) · 1.45 KB
/
PageUserPassword.cs
File metadata and controls
47 lines (43 loc) · 1.45 KB
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
using System;
using System.Web.UI.WebControls;
using BaiRong.Core;
namespace SiteServer.BackgroundPages
{
public class PageUserPassword : BasePage
{
public Literal UserName;
public TextBox CurrentPassword;
public TextBox NewPassword;
public TextBox ConfirmNewPassword;
public void Page_Load(object sender, EventArgs e)
{
if (IsForbidden) return;
if (!Page.IsPostBack)
{
UserName.Text = Body.AdministratorName;
}
}
public void Submit_Click(object sender, EventArgs e)
{
if (Page.IsPostBack && Page.IsValid)
{
if (BaiRongDataProvider.AdministratorDao.CheckPassword(CurrentPassword.Text, Body.AdministratorInfo.Password, Body.AdministratorInfo.PasswordFormat, Body.AdministratorInfo.PasswordSalt))
{
string errorMessage;
if (BaiRongDataProvider.AdministratorDao.ChangePassword(Body.AdministratorInfo.UserName, NewPassword.Text, out errorMessage))
{
SuccessMessage("密码更改成功");
}
else
{
FailMessage(errorMessage);
}
}
else
{
FailMessage("当前帐号密码错误");
}
}
}
}
}