|
|
@ -1,8 +1,6 @@ |
|
|
|
using System; |
|
|
|
using System; |
|
|
|
using System.Numerics; |
|
|
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
using System.Collections.Generic; |
|
|
|
using MySql.Data.MySqlClient; |
|
|
|
using MySql.Data.MySqlClient; |
|
|
|
using System.Globalization; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
namespace NightmareCoreWeb2 |
|
|
|
namespace NightmareCoreWeb2 |
|
|
|
{ |
|
|
|
{ |
|
|
@ -10,7 +8,7 @@ namespace NightmareCoreWeb2 |
|
|
|
public class Account |
|
|
|
public class Account |
|
|
|
{ |
|
|
|
{ |
|
|
|
public UInt32 Id { get; set; } |
|
|
|
public UInt32 Id { get; set; } |
|
|
|
public bool IsGM {get; set;} |
|
|
|
public bool IsGM { get; set; } |
|
|
|
public string Username { get; set; } |
|
|
|
public string Username { get; set; } |
|
|
|
public string Email { get; set; } |
|
|
|
public string Email { get; set; } |
|
|
|
public string LastIP { get; set; } |
|
|
|
public string LastIP { get; set; } |
|
|
@ -125,25 +123,6 @@ namespace NightmareCoreWeb2 |
|
|
|
|
|
|
|
|
|
|
|
conn.Close(); |
|
|
|
conn.Close(); |
|
|
|
} |
|
|
|
} |
|
|
|
public bool AuthenticateWithToken(string token) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
MySqlConnection conn = new MySqlConnection(Program.connStr); |
|
|
|
|
|
|
|
conn.Open(); |
|
|
|
|
|
|
|
string sql = "select token from tokens.active_tokens where email=@email"; |
|
|
|
|
|
|
|
MySqlCommand cmd = new MySqlCommand(sql, conn); |
|
|
|
|
|
|
|
cmd.Parameters.AddWithValue("email", this.Email); |
|
|
|
|
|
|
|
MySqlDataReader rdr = cmd.ExecuteReader(); |
|
|
|
|
|
|
|
string dbToken = ""; |
|
|
|
|
|
|
|
while (rdr.Read()) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
try |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
dbToken = rdr.GetString(0); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
catch (Exception) { } |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return token.Equals(dbToken); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public bool AuthenticateAccount(string password) |
|
|
|
public bool AuthenticateAccount(string password) |
|
|
|
{ |
|
|
|
{ |
|
|
|
MySqlConnection conn = new MySqlConnection(Program.connStr); |
|
|
|
MySqlConnection conn = new MySqlConnection(Program.connStr); |
|
|
@ -170,7 +149,8 @@ namespace NightmareCoreWeb2 |
|
|
|
{ |
|
|
|
{ |
|
|
|
return verifier.Compare(this.Verifier); |
|
|
|
return verifier.Compare(this.Verifier); |
|
|
|
} |
|
|
|
} |
|
|
|
public void ChangePassword(string NewPassword) { |
|
|
|
public void ChangePassword(string NewPassword) |
|
|
|
|
|
|
|
{ |
|
|
|
MySqlConnection conn = new MySqlConnection(Program.connStr); |
|
|
|
MySqlConnection conn = new MySqlConnection(Program.connStr); |
|
|
|
conn.Open(); |
|
|
|
conn.Open(); |
|
|
|
byte[] salt = new byte[32]; |
|
|
|
byte[] salt = new byte[32]; |
|
|
|