本文整理汇总了C#中User.getPassword方法的典型用法代码示例。如果您正苦于以下问题:C# User.getPassword方法的具体用法?C# User.getPassword怎么用?C# User.getPassword使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类User
的用法示例。
在下文中一共展示了User.getPassword方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: authenticate
public string authenticate(string userData)
{
string[] values = parseInput(userData);
Console.WriteLine("Suche nach \""+ userData + "\"!");
MySqlCommand command = connection.CreateCommand();
//User aus der Datenbank suchen
command.CommandText = "SELECT * FROM User WHERE email = \'"+values[0]+"\'";
MySqlDataReader Reader;
connection.Open();
Reader = command.ExecuteReader();
//Wenn der User in der Datenbank vorhanden ist
if (Reader.Read())
{
//User-Objekt fuer weitere Operationen anlegen
currentUser = new User(Reader.GetValue(0).ToString(), Reader.GetValue(1).ToString(), Reader.GetValue(2).ToString(), Reader.GetValue(3).ToString(), Reader.GetValue(4).ToString());
//Wenn das Passwort stimmt
if (currentUser.getPassword().Equals(values[1]))
{
//Wenn der User Administrator ist
if (currentUser.getRole().Equals("admin"))
{
connection.Close();
return "1%" + currentUser.getID() + "%" +currentUser.getEmail()+"%"+ currentUser.getName()+"%"+currentUser.getPassword()+"%"+currentUser.getRole();
}
//Sonst normaler User
else
{
connection.Close();
return "2%" + currentUser.getID() + "%" + currentUser.getName();
}
}
//Wenn das Paswort nicht stimmt
else
{
connection.Close();
return "0";
}
}
//Wenn es den User nicht gibt
else
{
connection.Close();
return "3";
}
}
示例2: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
User u = new User().getByEmailId(TextBox1.Text);
if (u != null)
{
Session.Add("User", u);
string body = "User Name : "+u.getUserName()+"\n"+
"Password : "+u.getPassword();
WebMail.Send("[email protected]", u.getRecoveryEmail(), "Account Information", body);
Message.Send(u.getRecoveryMobile(), body);
Response.Redirect("CantAccessYourAccount2.aspx");
}
else
Label1.Text = " No account found with that email address";
}
示例3: Button2_Click
protected void Button2_Click(object sender, EventArgs e)
{
u = new User().getById(TextBox1.Text);
if (TextBox2.Text == u.getAnswer())
{
Session.Add("User", u);
string body = "User Name : " + u.getUserName() + "\n" +
"Password : " + u.getPassword();
WebMail.Send("[email protected]", u.getRecoveryEmail(), "Account Information", body);
Message.Send(u.getRecoveryMobile(), body);
Response.Redirect("CantAccessYourAccount2.aspx");
}
else
Label4.Text = "Incorrect answer";
}
示例4: Button1_Click
protected void Button1_Click(object sender, EventArgs e)
{
User u = new User().getById(TextBox1.Text);
if (u != null)
{
if (u.getPassword() == TextBox2.Text)
{
Session.Add("User", u);
Dummy d = Dummy.getById(TextBox1.Text);
if(d == null)
Response.Redirect("Default2.aspx");
else
Response.Redirect("./SignUpStep2.aspx?UserName="+u.getUserName()+"&Email="+u.getRecoveryEmail()+"&MobileNumber="+u.getRecoveryMobile());
}
}
Label8.Text = " Invalid Username or Password";
}