示例#1
0
        public CreateAccountPacketRes CreateAccount([FromBody] CreateAccountPacketReq req)
        {
            CreateAccountPacketRes res = new CreateAccountPacketRes();

            // ID 겹치는지 확인
            AccountDb account = _context.Accounts
                                .AsNoTracking()
                                .Where(a => a.AccountName == req.AccountName)
                                .FirstOrDefault();

            if (account == null)
            {
                // 가능

                _context.Accounts.Add(new AccountDb()
                {
                    AccountName = req.AccountName,
                    Password    = req.Password // TODO Hash로 해주기
                });

                bool success = _context.SaveChangesEx();
                res.CreateOk = success;
            }
            else
            {
                // 불가능
                res.CreateOk = false;
            }
            return(res);
        }
示例#2
0
        public LoginAccountPacketRes LoginAccount([FromBody] LoginAccountPacketReq req)
        {
            LoginAccountPacketRes res = new LoginAccountPacketRes();

            AccountDb account = _context.Accounts
                                .AsNoTracking()
                                .Where(a => a.AccountName == req.AccountName && a.Password == req.Password)
                                .FirstOrDefault();

            if (account == null)
            {
                res.LoginOk = false;
            }
            else
            {
                res.LoginOk = true;

                // 토큰 발급
                DateTime expired = DateTime.UtcNow;
                expired.AddSeconds(600);

                TokenDB tokenDb = _shared.Tokens.Where(t => t.AccountDbId == account.AccountDbId).FirstOrDefault();

                if (tokenDb != null)
                {
                    tokenDb.Token   = new Random().Next(Int32.MinValue, Int32.MaxValue);
                    tokenDb.Expired = expired;
                    _shared.SaveChangesEx();
                }
                else
                {
                    tokenDb = new TokenDB()
                    {
                        AccountDbId = account.AccountDbId,
                        Token       = new Random().Next(Int32.MinValue, Int32.MaxValue),
                        Expired     = expired
                    };

                    _shared.Add(tokenDb);
                    _shared.SaveChangesEx();
                }

                res.AccountId  = account.AccountDbId;
                res.Token      = tokenDb.Token;
                res.ServerList = new List <ServerInfo>();

                foreach (ServerDb serverDb in _shared.Servers)
                {
                    res.ServerList.Add(new ServerInfo()
                    {
                        Name      = serverDb.Name,
                        IpAddress = serverDb.IpAddress,
                        Port      = serverDb.Port,
                        BusyScore = serverDb.BusyScore
                    });
                }
            }

            return(res);
        }
        public async Task <IActionResult> Register(RegisterViewModel reg)
        {
            if (ModelState.IsValid)
            {
                //Check Username is not taken
                if (!await AccountDb.IsUserNameTaken(reg.UserName, _context))
                {
                    Account acc = new Account()
                    {
                        FullName = reg.FullName,
                        Email    = reg.Email,
                        Username = reg.UserName,
                        Password = reg.Password
                    };
                    //add account to database
                    await AccountDb.Register(acc, _context);

                    //create user session
                    SessionHelper.CreateUserSession(_http, acc.AccountID, acc.Username);
                    #region Manual CreateUserSession Practice
                    //HttpContext.Session.SetInt32("Id", acc.AccountID);
                    //HttpContext.Session.SetString("Username", acc.Username);
                    #endregion

                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    //Display Error with other username error msg.
                    ModelState.AddModelError(nameof(Account.Username), "Username is already taken, Please pick another.");
                }
            }
            return(View(reg));
        }
示例#4
0
        public IActionResult Register(Account a)
        {
            if (ModelState.IsValid)
            {
                bool isEmailAndUsernameAvailable = true;
                if (AccountDb.IsEmailTaken(a.Email))
                {
                    isEmailAndUsernameAvailable = false;
                    ModelState.AddModelError(string.Empty, "Email address is taken");
                }

                if (AccountDb.IsUsernameTaken(a.Username))
                {
                    isEmailAndUsernameAvailable = false;
                    ModelState.AddModelError(string.Empty, "Username is taken");
                }

                if (!isEmailAndUsernameAvailable)
                {
                    return(View(a));
                }

                AccountDb.Add(a);
                SessionHelper.LogUserIn(_httpAccessor, a.AccountId, a.Username);
                TempData["Message"] = "You registered sucessfully";
                return(RedirectToAction("Index", "Home"));
            }

            return(View(a));
        }
示例#5
0
        public async Task <IActionResult> Register(RegisterViewModel reg)
        {
            if (ModelState.IsValid)
            {
                // Check username is not taken
                if (!await AccountDb.IsUsernameTaken(reg.Username, _context))
                {
                    Account acc = new Account()
                    {
                        Email    = reg.Email,
                        FullName = reg.FullName,
                        Password = reg.Password,
                        Username = reg.Username
                    };

                    await AccountDb.Register(_context, acc);

                    SessionHelper.CreateUserSession(acc.AccountId, acc.Username, _http);

                    return(RedirectToAction("Index", "Home"));
                }
                else // If username is taken, add error
                {
                    ModelState.AddModelError(nameof(Account.Username), "Username is already taken");
                }
            }

            return(View(reg));
        }
示例#6
0
        public async Task <IActionResult> Register(RegisterViewModel reg)
        {
            if (ModelState.IsValid)
            {
                //Check username is unique
                if (!await AccountDb.IsUsernameAvailable(reg.Username, _context))
                {
                    Account acc = new Account()
                    {
                        Email    = reg.Email,
                        FullName = reg.FullName,
                        Password = reg.Password,
                        Username = reg.Username
                    };

                    //if unique, add account to DB
                    await AccountDb.Register(_context, acc);

                    //with the DB made, this links the session CREATE USER SESSION
                    SessionHelper.CreateUserSession(acc.AccountId, acc.Username, _http);


                    return(RedirectToAction("Index", "Home"));
                }
                else // If username is taken, add error
                {
                    // Display error with other username error messages
                    //Tell it what class this property is in
                    ModelState.AddModelError(nameof(Account.Username)
                                             , "Username is already taken");
                }
            }

            return(View(reg));
        }
示例#7
0
        private void GetAccount()
        {
            AccountDb accountDb   = new AccountDb();
            Accounts  userAccount = accountDb.GetAccountsByUserId(currentUser.Id);

            currentAccount           = userAccount;
            accountInfo.InnerHtml    = $"<div>Account Number <p>{currentAccount.AccountNumber} </p></div>";
            accountBalance.InnerHtml = $"<div>Account Balance <p>{ currentAccount.Balance}</p></div>";
        }
示例#8
0
        public async Task <bool> ChangePassword(ChangePasswordViewModel model)
        {
            var exitAccount = await AccountDb.AsQueryable().SingleAsync(a => a.Id == model.UserId.ToGuid() && a.Password == model.OldPassword.ToMD5());

            if (!exitAccount.IsNull())
            {
                exitAccount.ChangePassword(model.NewPassword.ToMD5());
                return(AccountDb.Update(exitAccount));
            }

            return(false);
        }
        public static List <SelectListItem> GetClients()
        {
            var context = new AccountDb();
            List <SelectListItem> list = new List <SelectListItem>();

            foreach (Client client in context.Clients)
            {
                list.Add(new SelectListItem {
                    Value = client.Id.ToString(), Text = client.FirstName + " " + client.LastName
                });
            }
            ;
            return(list);
        }
        public static List <SelectListItem> GetRooms()
        {
            var context = new AccountDb();
            List <SelectListItem> list = new List <SelectListItem>();

            foreach (Room room in context.Rooms)
            {
                list.Add(new SelectListItem {
                    Value = room.Id.ToString(), Text = room.Number.ToString()
                });
            }
            ;
            return(list);
        }
        public static List <SelectListItem> GetAccounts()
        {
            var context = new AccountDb();
            List <SelectListItem> list = new List <SelectListItem>();

            foreach (Account account in context.Accounts)
            {
                list.Add(new SelectListItem {
                    Value = account.Id.ToString(), Text = account.Username
                });
            }
            ;
            return(list);
        }
        public void HandleLogin(C_Login loginPacket)
        {
            //Console.WriteLine($"UniqueId({loginPacket.UniqueId})");

            //TODO : 보안체크
            if (ServerState != PlayerServerState.ServerStateLogin)
            {
                return;
            }

            //TODO : 문제
            // - 동시에 다른 사람이 같은 uniqueId를 보낸다면?
            // - 악의적으로 같은 패킷을 여러번 보낸다면? DB에 과부하가 발생할 수 있음
            // - 쌩뚱맞은 타이밍에 이 패킷을 보낸다면?

            using (AppDbContext db = new AppDbContext())
            {
                AccountDb findAccount = db.Accounts
                                        .Include(a => a.Players)
                                        .Where(a => a.AccountName == loginPacket.UniqueId)
                                        .FirstOrDefault();

                if (findAccount != null)
                {
                    S_Login loginOk = new S_Login()
                    {
                        LoginOk = 1
                    };
                    Send(loginOk);
                    Console.WriteLine($"기존 캐릭터 LoginOK = {loginOk.LoginOk}");
                }
                else
                {
                    AccountDb newAccount = new AccountDb()
                    {
                        AccountName = loginPacket.UniqueId
                    };
                    db.Accounts.Add(newAccount);
                    db.SaveChanges();                    // TODO : Exception

                    S_Login loginOk = new S_Login()
                    {
                        LoginOk = 1
                    };
                    Send(loginOk);
                    Console.WriteLine($"신규캐릭터 LoginOK = {loginOk.LoginOk}");
                }
            }
        }
示例#13
0
        public IActionResult MyVideos()
        {
            if (SessionHelper.IsLoggedIn(_httpAccessor))
            {
                int?memberId = SessionHelper.WhosLoggedIn(_httpAccessor);

                List <Video> userVideos = AccountDb.getUserVideos(memberId);

                return(View(userVideos));
            }
            else
            {
                TempData["Message"] = "You must be logged in to view your videos";
                return(RedirectToAction("Index", "Home"));
            }
        }
示例#14
0
        public IActionResult AccountSettings(Account a)
        {
            int?memberId         = SessionHelper.WhosLoggedIn(_httpAccessor);
            var darkModeCheckBox = Request.Form["darkModeCheckBox"].ToString();

            if (darkModeCheckBox == "on")
            {
                AccountDb.SwitchDarkMode(true, memberId);
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                AccountDb.SwitchDarkMode(false, memberId);
                return(RedirectToAction("Index", "Home"));
            }
        }
示例#15
0
 public IActionResult Account()
 {
     if (SessionHelper.IsLoggedIn(_httpAccessor))
     {
         int?         memberId = SessionHelper.WhosLoggedIn(_httpAccessor);
         Account      acc      = AccountDb.GetAccount(memberId);
         List <Video> videos   = AccountDb.getUserVideos(memberId);
         ViewBag.totalVideos = videos.Count();
         ViewBag.username    = acc.Username;
         return(View());
     }
     else
     {
         TempData["Message"] = "You must be logged in to view your account info";
         return(RedirectToAction("Index", "Home"));
     }
 }
示例#16
0
        public void InitContext()
        {
            var optionsBuilder = new DbContextOptionsBuilder <AccountDb>();

            optionsBuilder.UseInMemoryDatabase();

            var context  = new AccountDb(optionsBuilder.Options);
            var accounts = Enumerable.Range(1, 10)
                           .Select(i => new Account {
                Id = i, First = $"Bob{i}", Last = "Test", Email = "*****@*****.**"
            });

            context.AddRange(accounts);
            int changed = context.SaveChanges();

            _accountContext = context;
        }
示例#17
0
        protected void submit_Click(object sender, EventArgs e)
        {
            Users _user = new Users();

            _user.FirstName    = fName.Value;
            _user.LastName     = lName.Value;
            _user.EmailAddress = email.Value;
            _user.Password     = pwd.Value;
            _user.Birthday     = DateTime.Parse(dob.Value);

            if (!DoesUserExist(_user.EmailAddress))
            {
                UsersDb _usersDb = new UsersDb();

                if (pwd.Value == cpwd.Value)
                {
                    int userId = _usersDb.AddUser(_user);

                    Random   rnd      = new Random();
                    decimal  _balance = rnd.Next(100, 1000000);
                    Accounts _account = new Accounts();
                    _account.AccountNumber = Convert.ToInt32(accountNum.Value.ToString());
                    _account.AccountType   = accounttype.Value;
                    _account.Fk_UserId     = userId;
                    _account.Balance       = _balance;

                    AccountDb _accountDb = new AccountDb();
                    int       account    = _accountDb.AddAccount(_account);
                    _user.Id = userId;


                    Session["LoggedIn"] = _user.Id.ToString();
                    Response.Redirect("/Index.aspx");
                }
                else
                {
                    this.error.Visible   = true;
                    this.error.InnerText = "Password and Confirm Password must match.";
                }
            }
            else
            {
                this.error.Visible   = true;
                this.error.InnerText = "Email Address is already in use.";
            }
        }
示例#18
0
        public bool Login(string username, string password)
        {
            if (string.IsNullOrEmpty(username) || string.IsNullOrEmpty(password))
            {
                throw new InvalidParameterException("Username/Password cannot be empty.");
            }

            var dt          = AccountDb.Login(username, password);
            var dbErrorCode = dt.Rows[0].Field <int>("ErrorCode");

            if (dbErrorCode.Equals(0))
            {
                return(true);
            }

            DebugHelper.Error($"{username} login failed. DbErrorCode:{dbErrorCode}");
            return(false);
        }
示例#19
0
        public ActionResult Index(AccountModel model)
        {
            var result = new AccountDb().Login(ref err, model.UserName, model.Password);

            if (result && ModelState.IsValid)
            {
                SessionHelper.SetSession(new Session()
                {
                    UserName = model.UserName
                });
                return(RedirectToAction("Index", "Home", new { Area = "Admin" }));
            }
            else
            {
                ModelState.AddModelError("", "Tên đăng nhập hay mật khẩu sai");
            }
            return(View(model));
        }
        public async Task <IActionResult> Login(LoginViewModel login)
        {
            if (ModelState.IsValid)
            {
                Account acc = await AccountDb.DoesUserMatch(login, _context);

                if (acc != null)
                {
                    SessionHelper.CreateUserSession(_http, acc.AccountID, acc.Username);
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Invalid Credintials");
                }
            }
            return(View(login));
        }
示例#21
0
        public IActionResult Login(LoginViewModel model)
        {
            if (ModelState.IsValid)
            {
                Account account = AccountDb.IsLoginValid(model);
                if (account != null)
                {
                    SessionHelper.LogUserIn(_httpAccessor, account.AccountId, account.Username);
                    TempData["Message"] = "Logged in successfully";
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "You didn't enter the correct information");
                }
            }

            return(View(model));
        }
示例#22
0
        public async Task <bool> SignUp(Account model)
        {
            // implement sign up logic here

            var result = false;

            if (model.IsValidate)
            {
                var exitAccount = AccountDb.AsQueryable().FirstAsync(a => a.Name == model.Name);
                if (!exitAccount.IsNull())
                {
                    result = false;
                }
                else
                {
                    result = await AccountDb.AsInsertable(model).ExecuteCommandAsync() > 0;
                }
            }

            return(result);
        }
 public ReservationsController()
 {
     context = new AccountDb();
 }
 public AccountsController()
 {
     context = new AccountDb();
 }
示例#25
0
        public void HandleLogin(C_Login loginPacket)
        {
            // TODO 보안체크 더 강하게
            if (ServerState != PlayerServerState.ServerStateLogin)
            {
                return;
            }

            // TODO 각종 상황에 대비
            // -동시?
            // -악질 패킷
            // -이상한 타이밍
            LobbyPlayers.Clear();
            using (AppDbContext db = new AppDbContext())
            {
                AccountDb findAccount = db.Accounts
                                        .Include(a => a.Players)
                                        .Where(a => a.AccountName == loginPacket.UniqueId)
                                        .FirstOrDefault();

                if (findAccount != null)
                {                                          // 로그인 성공
                    AccountDbId = findAccount.AccountDbId; // Id는 자주쓰니 기억
                    S_Login loginOk = new S_Login()
                    {
                        LoginOk = 1
                    };
                    foreach (PlayerDb playerDb in findAccount.Players)
                    {
                        LobbyPlayerInfo lobbyPlayer = new LobbyPlayerInfo()
                        {
                            PlayerDbId = playerDb.PlayerDbId,
                            Name       = playerDb.PlayerName,
                            StatInfo   = new StatInfo()
                            {
                                Level    = playerDb.Level,
                                Hp       = playerDb.Hp,
                                MaxHp    = playerDb.MaxHp,
                                Attack   = playerDb.Attack,
                                Speed    = playerDb.Speed,
                                TotalExp = playerDb.TotalExp
                            }
                        };

                        // 메모리에 들고있는다 DB접근 최소화
                        LobbyPlayers.Add(lobbyPlayer);
                        // 패킷을 넣어준다
                        loginOk.Players.Add(lobbyPlayer);
                    }
                    Send(loginOk);

                    // 로비로 이동
                    ServerState = PlayerServerState.ServerStateLobby;
                }
                else
                { // 실패
                  // TEMP_ 새계정으로
                    AccountDb newAccount = new AccountDb()
                    {
                        AccountName = loginPacket.UniqueId
                    };
                    db.Accounts.Add(newAccount);
                    bool success = db.SaveChangesEx();
                    if (success == false)
                    {
                        return;
                    }

                    AccountDbId = newAccount.AccountDbId;        // Id는 자주쓰니 기억

                    // 로그인 실패
                    S_Login loginOk = new S_Login()
                    {
                        LoginOk = 1
                    };
                    Send(loginOk);

                    // 로비로 이동
                    ServerState = PlayerServerState.ServerStateLobby;
                }
            }
        }
示例#26
0
        public async Task Login(string username, string password, string extraData, Action <ErrCode, string, ulong, string, string> callback)
        {
            Log.Info(string.Format("login_prepare {0} {1}", username, password));
            var loginData = LoginDb.Get <long>(username);

            if (loginData == -1)
            {
                callback(ErrCode.LOGIN_IN_PROGRESS, null, 0, null, null);
                return;
            }

            Log.Error(TimeUtil.GetTimeStampMS() - loginData);
            if (TimeUtil.GetTimeStampMS() - loginData < 3000)
            {
                callback(ErrCode.LOGIN_TOO_FREQ, null, 0, null, null);
                return;
            }

            LoginDb.SetWithoutLock(username, (long)-1, expireSec: 3);

            //验证用户db,成功则登陆
            var account = AccountDb.Get <Account>(username);

            if (account != null)
            {
                if (account.password != password)
                {
                    callback(ErrCode.LOGIN_WRONG_USR_OR_PSW, null, 0, null, null);
                    LoginDb.Delete(username);
                    return;
                }
            }
            else //如果不存在,则创建游客账号
            {
                account = new Account()
                {
                    username = username,
                    password = password,
                    uid      = CreateUid()
                };

                if (!AccountDb.Set(username, account))
                {
                    callback(ErrCode.LOGIN_CREATE_ACCOUNT_FAIL, null, 0, null, null);
                    LoginDb.Delete(username);
                    return;
                }
            }

            //服务端生成玩家avatar
            //通常是在MasterService上,生成玩家,注意玩家可以随意迁移

            //如果已经存在了该actor,则直接找到它
            var actorId = Global.IdManager.GetActorId(account.uid);
            var hostId  = Global.IdManager.GetHostIdByActorId(actorId);

            if (hostId != 0)
            {
                var hostAddr = Global.IdManager.GetHostAddrByActorId(actorId);
                var clientId = Global.IdManager.GetHostIdByActorId(actorId, true);
                if (clientId != 0)
                {
                    //踢掉之前的客户端
                    Log.Info("kick_begin");
                    var result = await ActorRef().RemoveClientActorAsync(actorId, DisconnectReason.KICKED);

                    Log.Info("kick_end", result.code);
                    if (result.code != DefaultErrCode.OK)
                    {
                        callback(
                            ErrCode.ERROR,
                            account.uid,
                            hostId,
                            Global.IdManager.GetHostName(hostId),
                            Global.IdManager.GetExtAddress(hostAddr));
                        LoginDb.Delete(username);
                        return;
                    }
                }

                Log.Info(string.Format("[email protected] {0} {1} {2} {3}", account.uid, actorId,
                                       Global.IdManager.GetHostName(hostId), hostAddr));

                callback(
                    ErrCode.OK,
                    account.uid,
                    hostId,
                    Global.IdManager.GetHostName(hostId),
                    Global.IdManager.GetExtAddress(hostAddr)
                    );

                LoginDb.SetWithoutLock(username, TimeUtil.GetTimeStampMS(), expireSec: 3600);
                return;
            }

            Log.Info("login_create_actor", account.uid);

            //如果不存在,则申请创建一个
            var svc = GetService <MasterServiceRef>();

            svc.CreateActor(nameof(Avatar), account.uid, (code, actorInfo) =>
            {
                Global.IdManager.RegisterActorInfo(actorInfo);
                actorId = actorInfo.ActorId;
                Log.Info("create_actor:", code, actorInfo.ActorName, actorInfo.ActorId);
                if (code != DefaultErrCode.OK && code != DefaultErrCode.create_actor_already_exists)
                {
                    Log.Error("create_actor_fail", code);
                    callback(ErrCode.ERROR, actorInfo.ActorName, 0, null, null);
                    LoginDb.Delete(username);
                    return;
                }

                var hostId = Global.IdManager.GetHostIdByActorId(actorInfo.ActorId); //, false);
                //创建成功后,把客户端的avatar注册到服务端
                var hostAddr = Global.IdManager.GetHostAddrByActorId(actorInfo.ActorId);
                Log.Info(string.Format("[email protected] {0} {1} {2} {3} {4}", code, actorInfo.ActorName, actorInfo.ActorId,
                                       Global.IdManager.GetHostName(hostId), hostAddr));

                var retCode = (code == DefaultErrCode.OK ? ErrCode.OK : ErrCode.ERROR);
                callback(
                    retCode,
                    actorInfo.ActorName,
                    hostId,
                    Global.IdManager.GetHostName(hostId),
                    Global.IdManager.GetExtAddress(hostAddr)
                    );

                LoginDb.SetWithoutLock(username, TimeUtil.GetTimeStampMS(), expireSec: 3600);
            });
        }
 public RoomsController()
 {
     context = new AccountDb();
 }
示例#28
0
 public virtual DataTable GetDbTable(string username, string password)
 {
     return(AccountDb.Login(username, password));
 }
 public AccountsController(AccountDb dbContext, IConfiguration iConfig)
 {
     DbContext     = dbContext;
     configuration = iConfig;
 }
示例#30
0
        public void HandleLogin(C_Login loginPacket)
        {
            // TODO : 이런 저런 보안 체크
            if (ServerState != PlayerServerState.ServerStateLogin)
            {
                return;
            }

            // TODO : 문제가 있긴 있다
            // - 동시에 다른 사람이 같은 UniqueId을 보낸다면?
            // - 악의적으로 여러번 보낸다면
            // - 쌩뚱맞은 타이밍에 그냥 이 패킷을 보낸다면?

            LobbyPlayers.Clear();

            using (AppDbContext db = new AppDbContext())
            {
                AccountDb findAccount = db.Accounts
                                        .Include(a => a.Players)
                                        .Where(a => a.AccountName == loginPacket.UniqueId).FirstOrDefault();

                if (findAccount != null)
                {
                    // AccountDbId 메모리에 기억
                    AccountDbId = findAccount.AccountDbId;

                    S_Login loginOk = new S_Login()
                    {
                        LoginOk = 1
                    };
                    foreach (PlayerDb playerDb in findAccount.Players)
                    {
                        LobbyPlayerInfo lobbyPlayer = new LobbyPlayerInfo()
                        {
                            PlayerDbId = playerDb.PlayerDbId,
                            Name       = playerDb.PlayerName,
                            StatInfo   = new StatInfo()
                            {
                                Level    = playerDb.Level,
                                Hp       = playerDb.Hp,
                                MaxHp    = playerDb.MaxHp,
                                Attack   = playerDb.Attack,
                                Speed    = playerDb.Speed,
                                TotalExp = playerDb.TotalExp
                            }
                        };

                        // 메모리에도 들고 있다
                        LobbyPlayers.Add(lobbyPlayer);

                        // 패킷에 넣어준다
                        loginOk.Players.Add(lobbyPlayer);
                    }

                    Send(loginOk);
                    // 로비로 이동
                    ServerState = PlayerServerState.ServerStateLobby;
                }
                else
                {
                    AccountDb newAccount = new AccountDb()
                    {
                        AccountName = loginPacket.UniqueId
                    };
                    db.Accounts.Add(newAccount);
                    bool success = db.SaveChangesEx();
                    if (success == false)
                    {
                        return;
                    }

                    // AccountDbId 메모리에 기억
                    AccountDbId = newAccount.AccountDbId;

                    S_Login loginOk = new S_Login()
                    {
                        LoginOk = 1
                    };
                    Send(loginOk);
                    // 로비로 이동
                    ServerState = PlayerServerState.ServerStateLobby;
                }
            }
        }