public bool Register(string username, string password)
        {
            if (!CheckValidUsername(username))
                return false;
            bool result = false;

            try
            {
                RSSDBDataContext dt = new RSSDBDataContext();
                int randomvalue = RANDOM.Next(0, int.MaxValue);
                string md5pass = ServiceUtility.CalculateMD5Hash(password + randomvalue.ToString());

                Account account = new Account()
                {
                    Username = username,
                    Password = md5pass,
                    Salt = randomvalue,
                };

                dt.Accounts.InsertOnSubmit(account);
                dt.SubmitChanges();

                result = true;
            }
            catch
            {
                result = false;
            }
            finally
            {
            }

            return result;
        }
Ejemplo n.º 2
0
 partial void UpdateAccount(Account instance);
Ejemplo n.º 3
0
 partial void DeleteAccount(Account instance);
Ejemplo n.º 4
0
 partial void InsertAccount(Account instance);