Beispiel #1
0
        internal static void RegisterUser(WebSocket sender, Packets.EmailRegistrationCode packet)
        {
            if (ReservedUserInfos.Count <= 0)
                throw new AccessViolationException();

            var reserved = ReservedUserInfos.LastOrDefault(t => (t.Sender == sender));
            if (reserved == null)
                throw new TimeoutException();

            if (reserved.Packet.Email != packet.Email)
                throw new ArgumentOutOfRangeException();

            if (reserved.Confirmation != packet.Code)
                throw new MissingFieldException();

            ScheduledTaskManager.Cancel(reserved.TaskId);
            ReservedUserInfos.Remove(reserved);

            var saltValue = PasswordManager.Salt();
            var user = new Dbmls.User()
            {
                Email = reserved.Packet.Email,
                Password = PasswordManager.Hash(reserved.Packet.Password, saltValue),
                Grade = "tester",
            };
            DbManager.Tables.Users.InsertOnSubmit(user);

            var salt = new Dbmls.Salt()
            {
                User = user,
                Value = saltValue,
            };
            DbManager.Tables.Salts.InsertOnSubmit(salt);

            DbManager.Tables.SubmitChanges();
        }
Beispiel #2
0
 partial void UpdateSalt(Salt instance);
Beispiel #3
0
 partial void DeleteSalt(Salt instance);
Beispiel #4
0
 partial void InsertSalt(Salt instance);