예제 #1
0
        public void SetErrorSuccessMessage(LoginErrorCode loginCode)
        {
            switch (loginCode)
            {
            case LoginErrorCode.Success:
                mmMessages.SuccessMessage = string.Format("You're now logged in. You will be redirected in 5 seconds or you can click <a href='{0}' title='Continue'>here</a> to continue.", "Director.ashx");
                break;

            case LoginErrorCode.UserLockedOut:
                mmMessages.ErrorMessage = "We're sorry, but you've been locked out. Please wait 30 minutes and try again.";
                break;

            case LoginErrorCode.LoginFailed:
                mmMessages.ErrorMessage = "Invalid email and password combination. Please try again.";
                break;

            case LoginErrorCode.NoUserOrEmailSpecified:
                mmMessages.ErrorMessage = "Please specify both an email and password.";
                break;

            case LoginErrorCode.UserOrEmailNotExists:
                mmMessages.ErrorMessage = "This account does not appear to exist.";
                break;

            default:
                mmMessages.ErrorMessage = "Oops! It looks like an unknown error occurred. Please try again and if this issue persists, contact the administrator.";
                break;
            }
        }
예제 #2
0
    public static void HandleCharCreateResponse(ref PacketReader packet, ref World manager)
    {
        LoginErrorCode result = (LoginErrorCode)packet.ReadByte();

        switch (result)
        {
        case LoginErrorCode.CHAR_CREATE_SUCCESS:
            PacketWriter outpacket = new PacketWriter(WorldServerOpCode.CMSG_CHAR_ENUM);
            manager.Send(outpacket);
            Global.closeCharCreate();
            break;

        case LoginErrorCode.CHAR_CREATE_ERROR:
            Global.showNotifyBox("Error Creating Character.", "Okay");
            break;

        case LoginErrorCode.CHAR_CREATE_NAME_IN_USE:
            Global.showNotifyBox("Character Name Already In Use.", "Okay");
            break;

        case LoginErrorCode.CHAR_CREATE_FAILED:
            Global.showNotifyBox("Character Creation Failed.", "Okay");
            break;
        }
    }
예제 #3
0
        public async Task SendCharCreateReply(LoginErrorCode code)
        {
            PacketOut p = new PacketOut(RealmOp.SMSG_CHAR_CREATE);

            p.Write((byte)code);
            await SendPacketRealm(p);
        }
예제 #4
0
 /// <summary>
 /// Sends a "character login failed" error message to the client.
 /// </summary>
 /// <param name="client">the client to send to</param>
 /// <param name="error">the actual login error</param>
 public static void SendCharacterLoginFail(IPacketReceiver client, LoginErrorCode error)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHARACTER_LOGIN_FAILED, 1))
     {
         packet.WriteByte((byte)error);
         client.Send(packet, addEnd: false);
     }
 }
예제 #5
0
 /// <summary>Sends an auth session error response to the client.</summary>
 /// <param name="client">the client to send to</param>
 /// <param name="error">the error code</param>
 public static void SendAuthSessionErrorReply(IPacketReceiver client, LoginErrorCode error)
 {
     using (RealmPacketOut packet = new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_AUTH_RESPONSE, 1))
     {
         packet.WriteByte((byte)error);
         client.Send(packet, false);
     }
 }
예제 #6
0
        public Task SendAuthResponse(LoginErrorCode code)
        {
            PacketOut p = new PacketOut(RealmOp.SMSG_AUTH_RESPONSE);

            p.Write((byte)code);
            SendPacket(p);
            return(TaskDone.Done);
        }
예제 #7
0
        public static Dictionary <byte, object> Serialization(bool result, LoginErrorCode errorCode)
        {
            Dictionary <byte, object> retDic = new Dictionary <byte, object>();

            retDic[1] = result;
            retDic[2] = (int)errorCode;
            return(retDic);
        }
예제 #8
0
 /// <summary>
 ///     Send Auth Response to Client
 /// </summary>
 /// <param name="state">LoginErroCode</param>
 /// <param name="count">Count to queue position</param>
 /// <returns></returns>
 public SMSG_AUTH_RESPONSE(LoginErrorCode state, int count = 0) : base(RealmEnums.SMSG_AUTH_RESPONSE)
 {
     Write((byte)state);
     Write((uint)0);     // BillingTimeRemaining
     Write((byte)0);     // BillingPlanFlags
     Write((uint)0);     // BillingTimeRested
     Write((byte)0);     // Expansion Level [0=normal, 1=TBC, 2=WOTLK, 3=CATA, 4=MOP]
     Write((uint)count); // Queue Position
     Write((byte)0);     // Free Transfer
 }
예제 #9
0
 private void sess_LoginFailed(Session sess, LoginErrorCode reason)
 {
     if (LoginRetrys > 0)
     {
         LoginRetrys--;
         Login();
     }
     else
     {
         LoginRetrys = 3;
         Console.WriteLine("LoginFailed: " + reason);
     }
 }
예제 #10
0
        public async Task <Tuple <LoginErrorCode, IPlayer> > CreatePlayer(PlayerCreateData info)
        {
            LoginErrorCode err  = LoginErrorCode.CHAR_CREATE_SUCCESS;
            var            guid = await GeneratePlayerGUID();

            var plr = GrainFactory.GetGrain <IPlayer>(guid.ToInt64());

            err = await plr.Create(info);

            var ret = new Tuple <LoginErrorCode, IPlayer>(err, err == LoginErrorCode.CHAR_CREATE_SUCCESS ? plr : null);

            return(ret);
        }
예제 #11
0
    public static void HandleCharDeleteResponse(ref PacketReader packet, ref World manager)
    {
        LoginErrorCode result = (LoginErrorCode)packet.ReadByte();

        if (result == LoginErrorCode.CHAR_DELETE_SUCCESS)
        {
            CharacterList.updateDelete   = false;
            recentlyDeletedOrCreated     = true;
            recentlyDeletedOrCreatedText = "Character Successfully Deleted.";
            PacketWriter outpacket = new PacketWriter(WorldServerOpCode.CMSG_CHAR_ENUM);
            manager.Send(outpacket);
        }
    }
예제 #12
0
        public void HandleAuthResponse(PacketIn packet)
        {
            LoginErrorCode error = (LoginErrorCode)packet.ReadByte();

            if (error == LoginErrorCode.AUTH_OK)
            {
                PacketOut outpacket = new PacketOut(WorldServerOpCode.CMSG_CHAR_ENUM);
                Send(outpacket);
            }
            else
            {
                Log.WriteLine(LogType.Error, "M values doesn't match, please try again.");
                Disconnect();
            }
        }
예제 #13
0
    public static void HandleAuthResponse(ref PacketReader packet, ref World manager)
    {
        LoginErrorCode error = (LoginErrorCode)packet.ReadByte();

        if (error == LoginErrorCode.AUTH_OK)
        {
            PacketWriter outpacket = new PacketWriter(WorldServerOpCode.CMSG_CHAR_ENUM);
            manager.Send(outpacket);
        }
        else
        {
            Debug.LogWarning("M values doesn't match, please try again.");
            //Exchange.Disconnect();
        }
    }
예제 #14
0
        protected void Page_Load(object sender, EventArgs e)
        {
            int loginUserID = RequestVars.Get <int>("luid", -1);

            if (loginUserID >= 0)
            {
                LoginResponse = TryLogUserIn(loginUserID);
                switch (LoginResponse)
                {
                case LoginErrorCode.Success:
                    Response.Redirect("/Director.ashx");
                    break;

                case LoginErrorCode.PasswordExpired:
                    Response.Redirect("/Director.ashx");                               //This will redirect to password change
                    break;

                default:
                    TopMessage.ErrorMessage = LoginResponse.ToString();
                    break;
                }
            }

            Title = "GCC Users";
            Master.HideAllFilters = true;
            SQLDatabase  sql       = new SQLDatabase();    sql.CommandTimeout = 120;
            SQLParamList sqlParams = new SQLParamList();

            if (CurrentPage == -1)
            {
                sqlParams.Add("@ShowAllRows", true);
            }
            else
            {
                sqlParams.Add("@Page", CurrentPage)
                .Add("@RowsPerPage", ROWS_PER_PAGE);
            }
            if (!String.IsNullOrEmpty(txtNameSearch.Text.Trim()))
            {
                sqlParams.Add("@TextSearch", txtNameSearch.Text.Trim());
            }
            DataTable dt = sql.ExecStoredProcedureDataTable("spAdmin_User_List", sqlParams);

            if (!sql.HasError)
            {
                Data = dt;
            }
        }
예제 #15
0
        /// <summary>
        ///     Checks for valid login credentials. Returns 0 if successful, 1 if the username or password is empty, 2 if there was a SQL error, 3 if the user is locked out or 4 if the username or password is invalid.
        /// </summary>
        private static LoginErrorCode TryLogUserIn()
        {
            string username = RequestVars.Post("inputUsername", String.Empty).Trim(),
                   password = RequestVars.Post("inputPassword", String.Empty).Trim();

            int outputVal;

            UserInfo ui = UserInformation.LogUserIn <UserInfo>(
                username,
                password,
                true, //email logins allowed
                Config.ClientID, out outputVal);

            LoginErrorCode loginCode = (LoginErrorCode)outputVal;

            return(loginCode);
        }
예제 #16
0
        private void HandleLogin()
        {
            Packet result = new Packet((byte)LogonOpcodes.LS_LOGIN_REQ);

            string Account  = pkt.ReadString().TrimEnd();
            string Password = pkt.ReadString().TrimEnd();

            LoginErrorCode status = DbAgent.LoginReq(Account, Password);

            result.Append((byte)status);
            if (status == LoginErrorCode.AUTH_SUCCESS)
            {
                result.Append((UInt16)(DbAgent.GetPremiumTime(Account) / 30));
                result.Append(Account);
            }

            SendPacket(result, client);
        }
예제 #17
0
        public ActionResult Login(LoginModel model)
        {
            if (ModelState.IsValid)
            {
                int             outputMessage;
                AccountDbAccess ADA = new AccountDbAccess();
                ADA.LogInUser(model.userName, model.password, true, Config.clientId, out outputMessage);
                LoginErrorCode errorCode = (LoginErrorCode)outputMessage;

                if (outputMessage == 0)
                {
                    //Check is this first login, then redirect to change password
                    if (UserInfoModel.PasswordExpireDate < DateTime.Now)
                    {
                        return(RedirectToAction("ChangePassword", new { @userId = UserInfoModel.UserID }));
                    }

                    ViewBag.message     = "Successfully loggedIn";
                    ViewBag.messageType = "success";

                    return(JavaScript("window.top.location.href ='" + Url.Action("Index", "Home", new { area = "" }) + "';"));
                }
                else
                {
                    ModelState.AddModelError("LoginModel", "Login failed");

                    ViewBag.message     = "Login failed";
                    ViewBag.messageType = "error";
                }
            }
            else
            {
                ModelState.AddModelError("Login", "Login failed");

                ViewBag.message     = "Login failed";
                ViewBag.messageType = "error";
            }

            return(PartialView(model));
        }
예제 #18
0
        protected void Page_Load(object sender, EventArgs e)
        {
            CheckRedirect();

            SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;

            if (sql.HasError == true)
            {
                string a;
            }

            if (Request.RequestType == "GET")
            {
                //Check for logouts
                if (RequestVars.Get("lo", 0) == 1)
                {
                    Session.Abandon();
                    LoggedOutOnLoad = true;
                }
            }

            if (Request.RequestType == "POST")
            {
                LoginResponse = TryLogUserIn();
                switch (LoginResponse)
                {
                case LoginErrorCode.Success:
                    Response.Redirect(LoginRedirect);
                    break;

                case LoginErrorCode.PasswordExpired:
                    Response.Redirect("/Director.ashx");     //This will redirect to password change
                    break;

                default:
                    SetErrorSuccessMessage(LoginResponse);
                    break;
                }
            }
        }
예제 #19
0
        /// <summary>
        ///     Checks for valid login credentials. Returns 0 if successful, 1 if the username or password is empty, 2 if there was a SQL error, 3 if the user is locked out or 4 if the username or password is invalid.
        /// </summary>
        private static LoginErrorCode TryLogUserIn(int userID)
        {
            SQLDatabase sql = new SQLDatabase();    sql.CommandTimeout = 120;
            DataTable   dt  = sql.QueryDataTable("SELECT email FROM tblCOM_Users WHERE UserID = " + userID);

            if (!sql.HasError && dt.Rows.Count > 0)
            {
                int outputVal;

                UserInfo ui = UserInformation.LogUserIn <UserInfo>(
                    dt.Rows[0]["email"].ToString(),
                    "ASBNNLKW@nknslafans@$#^@*AjksN",
                    true,                     //email logins allowed
                    Config.ClientID, out outputVal);

                LoginErrorCode loginCode = (LoginErrorCode)outputVal;

                return(loginCode);
            }
            else
            {
                return(LoginErrorCode.LoginFailed);
            }
        }
예제 #20
0
 private void _OnLoginFailed(OscarSession sess, LoginErrorCode errorCode)
 {
     string msg = String.Format(_("Login failed: {0}"), errorCode);
     Session.AddTextToChat(_NetworkChat, "-!- " + msg);
 }
예제 #21
0
파일: Session.cs 프로젝트: pkt30/OscarLib
 /// <summary>
 /// Raises the <see cref="LoginFailed"/> event
 /// </summary>
 /// <param name="errorcode">A <see cref="LoginErrorCode"/> describing the failure</param>
 protected internal void OnLoginFailed(LoginErrorCode errorcode)
 {
     if (LoginFailed != null)
     {
         LoggedIn = false;
         LoginFailed(this, errorcode);
     }
 }
예제 #22
0
 public RpLoginResult(bool result, LoginErrorCode errorCode)
 {
     Result    = result;
     ErrorCode = errorCode;
 }
예제 #23
0
파일: Main.cs 프로젝트: pkt30/OscarLib
 private void sess_LoginFailed(Session sess, LoginErrorCode reason)
 {
     Console.WriteLine(reason);
 }
예제 #24
0
 private void sess_LoginFailed(Session sess, LoginErrorCode reason)
 {
     if (LoginRetrys >0)
     {
         LoginRetrys--;
         Login();
     }
     else
     {
         LoginRetrys = 3;
         Console.WriteLine("LoginFailed: " + reason);
     }
 }
예제 #25
0
파일: LoginHandler.cs 프로젝트: NVN/WCell
		/// <summary>
		/// Sends a "character login failed" error message to the client.
		/// </summary>
		/// <param name="client">the client to send to</param>
		/// <param name="error">the actual login error</param>
		public static void SendCharacterLoginFail(IPacketReceiver client, LoginErrorCode error)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHARACTER_LOGIN_FAILED, 1))
			{
				packet.WriteByte((byte)error);

				client.Send(packet);
			}
		}
예제 #26
0
 public SmsgCharDelete(LoginErrorCode code) : base(RealmCMD.SMSG_CHAR_DELETE)
 {
     Write((byte)code);
 }
예제 #27
0
        private void _OnLoginFailed(OscarSession sess, LoginErrorCode errorCode)
        {
            string msg = String.Format(_("Login failed: {0}"), errorCode);

            Session.AddTextToChat(_NetworkChat, "-!- " + msg);
        }
예제 #28
0
 public SMSG_CHAR_CREATE(LoginErrorCode code) : base(RealmEnums.SMSG_CHAR_CREATE)
 {
     Write((byte)code);
 }
        /// <summary>
        ///     Perform password reset
        /// </summary>
        /// <param name="isGuidReset">is this a password retrieval?</param>
        public void ResetPassword(bool isGuidReset)
        {
            string         pass       = Request.Form["pwd"];     //Old password
            string         newpass1   = Request.Form["newpwd1"]; //New passwords
            string         newpass2   = Request.Form["newpwd2"];
            LoginErrorCode loginError = LoginErrorCode.UnknownError;
            UserInfo       user       = UserData;

            //If this isn't a GUID-based reset (we already checked those)
            if (!isGuidReset)
            {
                int outputValue;
                user       = UserInformation.LogUserIn <UserInfo>(user.Email, pass, true, Config.ClientID, out outputValue);
                loginError = (LoginErrorCode)outputValue;
                if (loginError != LoginErrorCode.Success)
                {
                    user = SessionWrapper.Get <UserInfo>("UserInfo", null);
                    switch (loginError)
                    {
                    case LoginErrorCode.NoUserOrEmailSpecified:
                        mmMessages.ErrorMessage = "Please enter your old password.";
                        return;

                    case LoginErrorCode.LoginFailed:
                        mmMessages.ErrorMessage = "Invalid password.";
                        return;

                    case LoginErrorCode.UserLockedOut:
                        mmMessages.ErrorMessage = "This account has been locked out. Please try again in 30 minutes.";
                        return;

                    case LoginErrorCode.UserOrEmailNotExists:
                        mmMessages.ErrorMessage = "This user doesn't appear to exist. If you think this is an error, please contact the administrator.";
                        return;
                    }
                }
            }
            if (user == null)
            {
                //Error message!
                mmMessages.ErrorMessage = "We're sorry. We couldn't find the user associated with this account. Please try again.";
                return;
            }
            UserData = user;
            //Validate new password
            if (newpass1 != newpass2)
            {
                mmMessages.ErrorMessage = "These new passwords don't match.";
                return;
            }
            //try to update password and return error message if invalid
            string error;

            if (!UserData.UpdatePassword(newpass1, out error))
            {
                mmMessages.ErrorMessage = error;
                return;
            }

            int rows = UserData.ClearLoginAttempts();

#if DEBUG
            Debug.WriteLine("{0} Login Attempts deleted");
#endif

            //Get user with new password to make sure that everything is OK
            int outputValue2;
            UserData = UserInformation.LogUserIn <UserInfo>(UserData.Email, newpass1, true, Config.ClientID, out outputValue2);

            if (UserData == null)
            {
                if (user != null)
                {
                    UserData = user;
                }
                else
                {
                    UserData = SessionWrapper.Get <UserInfo>("UserInfo", null);
                }

                mmMessages.ErrorMessage = "There was a database level error while attempting to save this user. Please contact the administrator if this error persists.";
                return;
            }

            SessionWrapper.Add("UserInfo", UserData);

            string redir = RequestVars.Get("rd", String.Empty);
            if (!String.IsNullOrEmpty(redir))
            {
                redir = "?rd=" + HttpContext.Current.Server.UrlEncode(redir);
            }
            Response.Redirect("/Director.ashx" + redir);
        }
예제 #30
0
 public static void SendCharacterRenameError(IPacketReceiver client, LoginErrorCode error)
 {
     using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHAR_RENAME, 1))
     {
         packet.WriteByte((byte)error);
         client.Send(packet);
     }
 }
예제 #31
0
        /// <summary>
        /// Sends a character creation reply to the client.
        /// </summary>
        /// <param name="client">the client to send to</param>
        /// <param name="error">the error code</param>
        public static void SendCharCreateReply(IPacketReceiver client, LoginErrorCode error)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHAR_CREATE, 1))
            {
                packet.WriteByte((byte)error);

                client.Send(packet);
            }
        }
예제 #32
0
파일: LoginHandler.cs 프로젝트: NVN/WCell
		/// <summary>
		/// Sends an auth session error response to the client.
		/// </summary>
		/// <param name="client">the client to send to</param>
		/// <param name="error">the error code</param>
		public static void SendAuthSessionErrorReply(IPacketReceiver client, LoginErrorCode error)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_AUTH_RESPONSE, 1))
			{
				packet.WriteByte((byte)error);

				client.Send(packet);
			}
		}
예제 #33
0
 public PSCharDelete(LoginErrorCode code)
     : base(WorldOpcodes.SMSG_CHAR_CREATE)
 {
     this.Write((byte)code);
 }
예제 #34
0
파일: Main.cs 프로젝트: saroj82/OscarLib
 private void sess_LoginFailed(Session sess, LoginErrorCode reason)
 {
     Console.WriteLine(reason);
 }
예제 #35
0
        /// <summary>
        /// Sends a character delete reply to the client.
        /// </summary>
        /// <param name="client">the client to send to</param>
        /// <param name="error">the rror code</param>
        public static void SendCharDeleteReply(IRealmClient client, LoginErrorCode error)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_CHAR_DELETE, 1))
            {
                packet.WriteByte((byte)error);

                client.Send(packet);
            }

            SendCharEnum(client);
        }
예제 #36
0
 public PSCharCreate(LoginErrorCode code)
     : base(WorldOpcodes.SMSG_CHAR_CREATE)
 {
     this.Write((byte)code);
 }