Upload to server
uploading
This commit is contained in:
57
omegapro/Omega/Forms/frmChangePass.cs
Normal file
57
omegapro/Omega/Forms/frmChangePass.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
using System.Xml;
|
||||
using System.Linq;
|
||||
using System.Xml.Linq;
|
||||
|
||||
namespace Omega.Forms
|
||||
{
|
||||
public partial class frmChangePass : Omega.BasicForms.frmCommon
|
||||
{
|
||||
public frmChangePass()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void Cancel_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
|
||||
}
|
||||
|
||||
private void OK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if ((this.Password.Text != this.RePassword.Text) || (this.Password.Text.Length==0) || (this.RePassword.Text.Length==0))
|
||||
{
|
||||
MessageBox.Show("The input values are not the same or empty","Đổi mật khẩu",MessageBoxButtons.OK);
|
||||
}else
|
||||
{
|
||||
string fileToLoad = "Settings.xml";
|
||||
|
||||
XElement root = XElement.Load(fileToLoad);
|
||||
|
||||
var selected = (from cli in root.Descendants("user")
|
||||
where cli.Element("username").Value == this.UserName.EditValue.ToString()
|
||||
select cli).FirstOrDefault();
|
||||
|
||||
selected.Element("Password").Value = common.MD5Hash(Password.Text);
|
||||
root.Save("Settings.xml");
|
||||
|
||||
(new frmShowSaveInfo()).Show();
|
||||
this.Close();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void frmChangePass_Load(object sender, EventArgs e)
|
||||
{
|
||||
this.UserName.EditValue = SettingInfo.UserName;
|
||||
this.UserName.Enabled = (SettingInfo.UserName == "Admin");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user