private void _processLogin(string loginName, LoginStatus status, Action<LoginResult> onResult) { var result = new LoginResult { Status = status }; if (status == LoginStatus.Success) { var session = _createOscarSession(loginName); if (session == null) { onResult(new LoginResult { Status = LoginStatus.SessionBlocked }); Log.Warn("Unable to create user session."); return; } var preferences = new GetSettingsSection { DriverId = session.UserId, Section = _dSessionSection }; Services.Invoke(preferences, o => { if (o != null) { var defaultVehicle = o.Get(_dVehicle); if (defaultVehicle.NotNull()) { session.VehicleId = BplIdentity.Get(defaultVehicle.Value); } var defaultLocale = o.Get(_dLocale); if (defaultLocale.NotNull()) { session.UserLocale = new Locale(defaultLocale.Value); } } else { Log.Info("Login: No preferences for driver {0} stored.", session.UserId); } result.SessionToken = CryptServices.Encode(session); onResult(result); }, e => { Log.Warn("Login: Error processing preference request {0}", e); result.SessionToken = CryptServices.Encode(session); onResult(result); }); } else { onResult(result); } }
public LoginCommandResult Execute(LoginCommand command) { LoginStatus status = LoginStatus.Success; string msg = null; try { _dbManager.Open($"Data Source={command.DataSource};User Id={command.UserName};Password={command.Password}"); } catch (OracleException ex) when(ex.Number == 28001) { msg = "Срок действия Вашего пароля истек. Смените пароль или обратитесь к администратору."; status = LoginStatus.Expired; } catch (OracleException ex) when(ex.Number == 28002) { msg = "Срок действия Вашего пароля истекает, учетная запись будет заблокирована. Смените пароль или обратитесь к администратору. Сменить пароль?"; status = LoginStatus.Expiring; } catch (Exception ex) { msg = ex.Message; status = LoginStatus.Failure; } finally { _dbManager.Close(); } return(new LoginCommandResult() { Status = status, Message = msg }); }
public IPromise PublishScore(int score, string leaderBoardId = GPGSIds.leaderboard_best_volcano) { return(new Promise((resolve, reject) => { LoginStatus loginStatus = this.dataController.GetLoginStatus(); if (loginStatus.RefusedLogIn) { reject(new Exception(Exceptions.RefusedLogin)); return; } if (!loginStatus.LoggedIn) { reject(new Exception(Exceptions.NotLoggedIn)); return; } Social.ReportScore(score, leaderBoardId, (sucess) => { if (sucess) { resolve(); return; } reject(new Exception(Exceptions.FailedPublishScore)); }); })); }
IEnumerator CreateAccount(string username, string password, string email) { WWWForm registerForm = new WWWForm(); registerForm.AddField("username", username); registerForm.AddField("email", email); registerForm.AddField("password", password); registerForm.AddField("submitted", 1); WWW www = new WWW(REGISTER_URL, registerForm); yield return(www); if (www.error != null) { Debug.Log("ERROR ON REGISTRATION: " + www.error); } else { string encodedString = www.data; Debug.Log(encodedString); JSONObject j = new JSONObject(encodedString); // Debug.Log(j.list); // Debug.Log(j.HasField("id_u")); if (j.HasField("id_u")) { string uID = j.GetField("id_u").str; Debug.Log(uID); userID = int.Parse(uID); Debug.Log(userID + ": Registered and Logged In"); loginStatus = LoginStatus.LoggedIn; } } yield return(0); }
public override Task <LoginStatus> AutenticarUsuario(UsuarioAAutenticar request, ServerCallContext context) { Autenticacion autenticacion = new Autenticacion(); Usuario usuario = autenticacion.AutenticarUsuario(request.Nombre, request.Password); LoginStatus status = new LoginStatus(); if (usuario != null) { status.Codigo = 0; status.Mensaje = "Autenticacion exitosa."; status.UsuarioDelServicio = new UsuarioDelServicio(); status.UsuarioDelServicio.Id = usuario.Id; status.UsuarioDelServicio.Contrasena = usuario.GetContrasena(); status.UsuarioDelServicio.NombreDeUsuario = usuario.NombreDeUsuario; status.UsuarioDelServicio.TieneSuscripcion = usuario.TieneSuscripcion; if (usuario.IdArtista != null) { status.UsuarioDelServicio.IdArtista = usuario.IdArtista; } } else { status.Codigo = 1; status.Mensaje = "Autenticacion fallida, las credenciales ingresadas no coinciden con alguna registrada en nuestro sistema."; } return(Task.FromResult(status)); }
/// <summary> /// Methods used in VM /// </summary> /// // login user // check if provided login exists in db private void LoginUser() { if (Login != null && Password != null) { LoginStatus status = DBQueries.CheckUserExists(Login, Password); switch (status) { case (LoginStatus.Correct): Window Main = new MainWindow(); Application.Current.Windows[0].Close(); Main.Show(); break; case (LoginStatus.NoSuchUser): MessageBox.Show("Incorrect login or password!"); Password = ""; break; } } else { MessageBox.Show("Provide login and password!"); } }
void m_reGetTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e) { try { m_reGetTimer.Stop(); var response = m_CompanionIO.GetProfileData(true); if (!response.Cached) { String json = response.Json ?? "{}"; m_joCompanion = JsonConvert.DeserializeObject <JObject>(json); CompanionStatus = response.LoginStatus; } m_cachedResponse = response; AsyncDataRecievedEvent.Raise(this, new EventArgs()); } catch (Exception ex) { CErr.processError(ex, "Error in m_reGetTimer_Elapsed"); } }
void HandleGetIdentityIdCallback(AmazonCognitoIdentityResult <Amazon.Runtime.ImmutableCredentials> result, string guestName) { if (result.Exception != null) { Debug.LogError(result.Exception); Status = LoginStatus.LoggedOut; return; } Debug.Log("Current Identity is now: " + m_credentials.GetCachedIdentityId()); if (guestName != null) { if (IsAuthenticated) { m_guestIdCache.ClearGuestById(m_credentials.GetCachedIdentityId()); } else { m_guestIdCache.Add(guestName, m_credentials.GetCachedIdentityId()); } m_guestIdCache.StoreGuestIds(); } Status = result.Response == null ? LoginStatus.LoggedOut : LoginStatus.LoggedIn; }
public Account_c(string acc, string pwd) { Lib.DataUtility du = new Lib.DataUtility(); DataTable dt = du.getDataTableByText("select * from account_c where account = @acc", "acc", acc); if (dt.Rows.Count != 1) { isValid = false; loginstatus = LoginStatus.Logout; } if (dt.Rows.Count == 1) { if (dt.Rows[0]["password"].ToString() == pwd) { isValid = true; account = acc; password = pwd; role_code = dt.Rows[0]["role_code"].ToString(); name = dt.Rows[0]["name"].ToString(); id = dt.Rows[0]["id"].ToString(); unit_code = dt.Rows[0]["unit_code"].ToString(); rank_code = dt.Rows[0]["rank_code"].ToString(); tel = dt.Rows[0]["tel"].ToString(); cell = dt.Rows[0]["cellphone"].ToString(); mail = dt.Rows[0]["mail"].ToString(); ip = dt.Rows[0]["ip"].ToString(); pwdChange = dt.Rows[0]["pwdChange"].ToString(); status = dt.Rows[0]["status"].ToString(); byAcc = dt.Rows[0]["byAcc"].ToString(); loginstatus = LoginStatus.Login; string roleCode = dt.Rows[0]["role_code"].ToString(); switch (roleCode) { case "1": role = User_Role.Administrator; break; case "2": role = User_Role.AccountManager; break; case "3": role = User_Role.CenterSupervisor; break; case "4": role = User_Role.CenterOfficer; break; default: break; } } else { isValid = false; loginstatus = LoginStatus.Logout; } } }
void Network_OnLogin(LoginStatus login, string message) { if (InvokeRequired) { BeginInvoke(new MethodInvoker( delegate() { Network_OnLogin(login, message); } )); return; } if (login == LoginStatus.Success) { MessageBox.Show("Connected: " + message); cmdConnect.Enabled = true; } else if (login == LoginStatus.Failed) { MessageBox.Show(this, String.Format("Error logging in ({0}): {1}", Client.Network.LoginErrorKey, Client.Network.LoginMessage)); cmdConnect.Text = "Connect"; cmdConnect.Enabled = true; txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true; DisableUpload(); } }
private void button1_Click(object sender, RoutedEventArgs e) { UserOperations operations = new UserOperations(); LoginStatus status = operations.isValidUser(textBox1.Text, passwordBox1.Password); if (status.ValidUser) { label3.Visibility = Visibility.Hidden; if (status.FirstLogin) { if (System.Windows.MessageBox.Show("You need to change your password.", "Change Password", MessageBoxButton.OK, MessageBoxImage.Information) == MessageBoxResult.OK) { ChangePassword change = new ChangePassword(textBox1.Text, passwordBox1.Password, status.Employee); change.Show(); this.Close(); } } else { HomeWindow hm = new HomeWindow(textBox1.Text, passwordBox1.Password, status.Employee); hm.Show(); this.Close(); } } else { label3.Visibility = Visibility.Visible; } }
public void StoreActionResponseMessageByLoginStatus(LoginStatus status) { IValidationMessageService validationMessageService = NinjectWebCommon.GetConcreteInstance <IValidationMessageService>(); if (status == LoginStatus.Blocked) { validationMessageService.StoreActionResponseMessageInfo("Your account has been blocked. Please contact with support."); } else if (status == LoginStatus.Failed) { validationMessageService.StoreActionResponseMessageError("Problem has been occurred while proccessing you requst. Please try again."); } else if (status == LoginStatus.InvalidLogin) { validationMessageService.StoreActionResponseMessageError("Incorrect Username or Password"); } else if (status == LoginStatus.Successful) { validationMessageService.StoreActionResponseMessageSuccess("Login Successful"); } else if (status == LoginStatus.Unverified) { validationMessageService.StoreActionResponseMessageError("Please confirm your email address."); } }
/// <summary> /// Helper function to complete the login procedure and check the /// credentials. /// </summary> /// <returns>Whether the login was successful or not.</returns> private bool login() { loginStatus = LoginStatus.LoginFailed; String response = steamRequest("ISteamWebUserPresenceOAuth/Logon/v0001", "?access_token=" + accessToken); if (response != null) { JObject data = JObject.Parse(response); if (data["umqid"] != null) { steamid = (String)data["steamid"]; umqid = (String)data["umqid"]; message = (int)data["message"]; OnLogon(new SteamEvent()); loginStatus = LoginStatus.LoginSuccessful; return(true); } else { return(false); } } else { return(false); } }
public IdentityInfo LoginCheck(LoginModel loginMdl) { IdentityInfo identity = new IdentityInfo(); LoginStatus status = new LoginStatus(); var loginUser = registerRep.Entities.FirstOrDefault(e => e.UserId == loginMdl.UserId); if (loginUser != null) { if (loginUser.Password == loginMdl.Password) { status.StatusCode = 0; identity = LoginHandler.CollectUserInfoWhenLogined(identity, loginMdl.UserId); } else { status.StatusCode = 2; } } else { status.StatusCode = 1; } identity.LoginStatus = status; return(identity); }
public void FailsWhenDockyardAccountNull() { using (var uow = ObjectFactory.GetInstance <IUnitOfWork>()) { curLogingStatus = _fr8Account.Login(uow, null, password, true); } }
public ApiReturns Put(int id, string newName) { if (string.IsNullOrEmpty(newName)) { return(ApiReturns.BadRequest()); } var file = _departFilesBll.QuerySingle(id); if (file == null) { return(ApiReturns.BadRequest()); } if (file.IsCommon && !LoginStatus.IsSuperAdminLogin()) { return(ApiReturns.Forbidden()); } file.FileName = newName; var success = UpdateFile(file, Operation.Update); if (success) { return(ApiReturns.Created()); } return(ApiReturns.Failed()); }
public static void Logout(LoginStatus newStatus = LoginStatus.NotLogged, bool resetAutologon = true, bool skipLogoutOnServer = false) { if (!skipLogoutOnServer && LoginStatus == LoginStatus.Logged) { //save the token instance because logout is run in separate thread and this logout method set //null to sessionData. Basically without this token in ServiceManager.Logout is alwas null so in //most cases logout on the server is not working var token = Token; ThreadPool.QueueUserWorkItem(delegate { try { ServiceManager.Logout(token); } catch (Exception ex) { ExceptionHandler.Default.Process(ex); } }); } if (resetAutologon) { Settings1.Default.AutoLoginUserName = null; Settings1.Default.AutoLoginPassword = null; Settings1.Default.Save(); } sessionData = null; profileInfo = null; tempPassword = null; tempUserName = null; LoginStatus = newStatus; }
public void BackgroundSymbolList() { string[] SymbolList = null; try { if (DataClient != null) { while (true) { LoginStatus ls = Login(); if (ls == LoginStatus.Yes) { SymbolList = DataClient.GetSymbols(Exchanges); } if (ls != LoginStatus.No) { break; } } } } finally { if (OnSymbolList != null) { OnSymbolList(this, SymbolList); } DownloadThread = null; } }
public ActionResult Login(Models.MemberLogin login) { using (DbAccess db = new DbAccess()) { var user = db.MemberLogins.Where(x => x.UserName.Trim() == login.UserName && x.PassWord.Trim() == login.PassWord); if (user.Any()) { try { short uid = user.SingleOrDefault().UserId; Member uname = db.Members.SingleOrDefault(x => x.UserId == uid); LoginStatus userLogin = new LoginStatus() { UserId = uid, UserName = login.UserName, RealName = uname.RealName }; Session["login"] = userLogin; } catch (NullReferenceException e) { ViewBag.err = e.Message; } } else { ViewBag.tips = "密码错误"; } } return(RedirectToAction("Index", "Main")); }
public void BackgroundEodData() { DataPackage[] EodData = null; try { if (DataClient != null) { while (true) { LoginStatus ls = Login(); if (ls == LoginStatus.Yes) { EodData = DataClient.GetEodData(Exchanges, StartTime, EndTime); } if (ls != LoginStatus.No) { break; } } } } finally { if (OnEodData != null) { OnEodData(this, EodData); } DownloadThread = null; } }
private async Task <LoginStatus> ParseFailReasonAsync(string rawHTML) { //Searches for parseCause( and get the value after it //Might be better for performance to separate the html by line first. try { var loginURL = Regex.Match(rawHTML, @"replace\(([^)]*)\)").Groups[1].Value; loginURL = loginURL.Replace('"', ' ').Trim(); using (var client = new HttpClient()) { var response = await client.GetAsync(loginURL); var loginHtml = await response.Content.ReadAsStringAsync(); var reason = Regex.Match(loginHtml, @"deniedCause = parseCause\(([^)]*)").Groups[1].Value; //Remove " reason = reason.Replace('\"', ' '); reason = reason.Trim(); LoginStatus parsedReason = (LoginStatus)int.Parse(reason); return(parsedReason); } }catch (Exception) { return(LoginStatus.LimitReachedOrOtherError); } }
/// <summary> /// gets the status code and returns a user-friendly message in hebrew /// </summary> /// <param name="loginStatus"></param> /// <returns></returns> public static string FriendlyLoginMessage(LoginStatus loginStatus) { string ret = ""; switch (loginStatus) { case LoginStatus.OK: ret = "התחברות עברה בהצלחה"; break; case LoginStatus.NoSuchUserExists: ret = "משתמש בשם זה לא קיים או הסיסמא שגויה"; break; case LoginStatus.GeneralError: ret = "שגיאה כללית בהתחברות למערכת"; break; default: ret = ""; break; } return(ret); }
public async Task <IActionResult> Add(EaAccount eaAccount) { LoginStatus loginStatus = LoginStatus.Unknown; var user = HttpContext.Items["User"] as User; var chromeDriver = ChromeInstances.Instance.Add(eaAccount.Username); try { loginStatus = new LoginService(chromeDriver).Start(new Models.DTOs.LoginDTO { Username = eaAccount.Username, Password = eaAccount.Password }); } catch (ElementClickInterceptedException) { loginStatus = LoginStatus.Logged; } if (!user.EaAccounts.Any(ea => ea.Username == eaAccount.Username)) { user.EaAccounts.Add(eaAccount); await _dbService.UpdateEaAccounts(user); } return(Ok(loginStatus)); }
public override string GetDesignTimeHtml() { string logoutText; IDictionary data = new HybridDictionary(2); data["LoggedIn"] = this._loggedIn; LoginStatus viewControl = (LoginStatus)base.ViewControl; ((IControlDesignerAccessor)viewControl).SetDesignModeState(data); if (this._loggedIn) { logoutText = viewControl.LogoutText; if (((logoutText == null) || (logoutText.Length == 0)) || (logoutText == " ")) { viewControl.LogoutText = "[" + viewControl.ID + "]"; } } else { logoutText = viewControl.LoginText; if (((logoutText == null) || (logoutText.Length == 0)) || (logoutText == " ")) { viewControl.LoginText = "[" + viewControl.ID + "]"; } } return(base.GetDesignTimeHtml()); }
public ApiReturns GetDirsAndFiles(int id) { List <FileDirectory> dirs; List <ViewDepartFiles> files; if (id == 0) { // 顶级目录,所有人看到的都一样 dirs = _dirBll.QueryList(d => d.IsTopestDir && !d.IsDeleted).ToList(); files = new List <ViewDepartFiles>(); } else { var loginUser = LoginStatus.GetLoginUser(); var departId = loginUser.DepartmentId; // 子目录,各单位的只能看到自己单位的以及公共的目录 dirs = _dirBll.QueryList( d => !d.IsDeleted && d.ParentId == id && // 定位到当前目录 (d.DepartmentId == departId || d.IsCommon)) // 查询公共的及单位私有的文件夹 .ToList(); // 子目录,各单位的只能看到自己单位的以及公共的目录 files = _fileBll.QueryList( f => !f.IsDeleted && f.FileDirectoryId == id && (f.IsCommon || f.DepartmentId == departId)) .ToList(); } return(ApiReturns.Ok(new { dirs, files })); }
private void OnLoginMgrPropertyChanged(object sender, PropertyChangedEventArgs arg) { if ("CurrentLoginStatus" == arg.PropertyName) { UpdateWindowVisibility(); // To show the main window quickly(especially when network is not fluent), make the operation after loginedIn as below LoginStatus status = LoginManager.Instance.CurrentLoginStatus; log.DebugFormat("MainWindowViewModel received login status changed message, login status:{0}", status); if (LoginStatus.LoggedIn == status || LoginStatus.AnonymousLoggedIn == status) { App.Current.Dispatcher.InvokeAsync(() => { if (_mainView == null) { _mainView = (UserControl)Activator.CreateInstance(typeof(EasyVideoWin.View.MainView)); } if (LoginStatus.AnonymousLoggedIn == status) { CurrentView = null; } else { CurrentView = _mainView; } }); } else if (LoginStatus.NotLogin == status) { if (Utils.GetAnonymousLogoutAndAnonymousJoinConf()) { log.Info("Login status changed to NotLogin and LogoutAndAnonymousJoinConf is true."); string joinConfAddress = Utils.GetAnonymousJoinConfServerAddress(); string joinConfId = Utils.GetAnonymousJoinConfId(); if (!string.IsNullOrEmpty(joinConfAddress) && !string.IsNullOrEmpty(joinConfId)) { log.Info("Login status changed to NotLogin and begin to join conf anonymously."); LoginManager.Instance.SaveCurrentLoginInfo(); Application.Current.Dispatcher.InvokeAsync(() => { LoginManager.Instance.ServiceType = Utils.ServiceTypeEnum.Enterprise; LoginManager.Instance.LoginProgress = LoginProgressEnum.EnterpriseJoinConf; LoginManager.Instance.IsNeedAnonymousJoinConf = true; }); return; } else { if (CallStatus.Ended == CallController.Instance.CurrentCallStatus) { log.Info("Call ended and need to login."); LoginManager.Instance.ResumePreLoginInfo(); LoginManager.Instance.IsNeedRelogin = true; } log.Info("Clear flag for logout and anonymous join conf."); Utils.SetAnonymousLogoutAndAnonymousJoinConf(false); } } } } }
private void Network_OnLogin(LoginStatus login, string message) { if (login == LoginStatus.Success) { RefreshFriends(); } }
private void Network_OnLogin(LoginStatus login, string message) { if (login == LoginStatus.Success) { lock (_Accounts) { _Accounts[_Client.Self.Name] = _LoginParams.Password; if (!listNames.Items.Contains(_Client.Self.Name)) { this.BeginInvoke((MethodInvoker) delegate { listNames.Items.Add(_Client.Self.Name); }); } } } else if (login == LoginStatus.Failed) { this.BeginInvoke((MethodInvoker) delegate { btnLogin.Text = "Login"; if (MessageBox.Show(this, "Login failed. Try again?", "Login", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation) == DialogResult.Yes) { btnLogin.Text = "Logout"; Client.Network.BeginLogin(_LoginParams); } }); } }
IEnumerator PerformLogin(string username, string password){ loginStatus = LoginStatus.LoggingIn; WWWForm loginForm = new WWWForm(); loginForm.AddField("username", username); loginForm.AddField("unity", 1); loginForm.AddField("password", password); loginForm.AddField("submitted", 1); WWW www = new WWW( LOGIN_URL, loginForm ); yield return www; if(www.error != null){ Debug.Log("ERROR ON LOGIN: "******"id_u")); if(j.HasField("id_u")){ string uID = j.GetField("id_u").str; userID = int.Parse(uID); Debug.Log("User "+ userID + " has logged In"); loginStatus = LoginStatus.LoggedIn; } } yield return 0; }
protected override void HandleRequest() { using (StreamWriter wtr = new StreamWriter(Context.Response.OutputStream)) { using (StreamReader rdr = new StreamReader($"account/struct/AccountInformationStruct.json")) { DbAccount acc; LoginStatus status = Database.Verify(Query["guid"], Query["password"], out acc); string JSONData = rdr.ReadToEnd(); if (status == LoginStatus.OK) { List <string> data = new List <string>(); AccountInformation user = new AccountInformation(); user.name = acc.Name; user.accountType = acc.AccountType; user.accountLifetime = acc.AccountLifetime; user.email = acc.UUID; user.guildId = Convert.ToInt32(acc.GuildId); user.guildName = user.guildId == -1 ? string.Empty : Database.GetGuild(acc.GuildId).Name; user.guildRank = user.guildId == -1 ? -1 : acc.GuildRank; user.isBanned = acc.Banned; user.isRegistered = acc.Verified; user.isAgeVerified = acc.IsAgeVerified == 1 ? true : false; user.isNameChosen = acc.NameChosen; user.isAccountMuted = acc.Muted; user.totalFame = acc.TotalFame; user.registration = acc.RegTime; user.vaultQuantity = acc.VaultCount; user.characterSlotQuantity = acc.MaxCharSlot; user.credits = acc.Credits; user.fame = acc.Fame; user.authenticationToken = acc.AuthToken; data.Add(JSONData.Replace("{NAME}", user.name)); data.Add(data[0].Replace("{FORMAT_ACCOUNT_TYPE}", user.formatAccountType())); data.Add(data[1].Replace("{EMAIL}", user.email)); data.Add(data[2].Replace("{FORMAT_GUILD}", user.formatGuild())); data.Add(data[3].Replace("{IS_BANNED}", $"{user.isBanned}")); data.Add(data[4].Replace("{IS_REGISTERED}", $"{user.isRegistered}")); data.Add(data[5].Replace("{IS_AGE_VERIFIED}", $"{user.isAgeVerified}")); data.Add(data[6].Replace("{IS_NAME_CHOSEN}", $"{user.isNameChosen}")); data.Add(data[7].Replace("{IS_MUTED}", $"{user.isAccountMuted}")); data.Add(data[8].Replace("{TOTAL_FAME}", $"{user.totalFame}")); data.Add(data[9].Replace("{REGISTRATION}", $"{user.registration}")); data.Add(data[10].Replace("{FORMAT_VAULT}", user.formatVault())); data.Add(data[11].Replace("{FORMAT_CHARACTER_SLOT}", user.formatCharacterSlot())); data.Add(data[12].Replace("{FORMAT_CREDITS}", user.formatCredits())); data.Add(data[13].Replace("{FORMAT_FAME}", user.formatFame())); data.Add(data[14].Replace("{AUTH_TOKEN}", user.authenticationToken)); wtr.Write(JsonConvert.DeserializeObject <List <AccountInformationMessages> >(data[data.Count - 1])[0].message); } else { wtr.Write(JsonConvert.DeserializeObject <List <AccountInformationMessages> >(JSONData)[0].error); } } } }
public void BackgroundHistory() { CommonDataProvider cdp = null; try { if (DataClient != null) { while (true) { LoginStatus ls = Login(); if (ls == LoginStatus.Yes) { cdp = DataClient.GetHistoricalData(Symbol); } if (ls != LoginStatus.No) { break; } } } } finally { if (OnHistoryFinish != null) { OnHistoryFinish(this, cdp); } DownloadThread = null; } }
public JsonResult LoginUsuario([FromBody] Usuario b) { string hash; using (MD5 md5Hash = MD5.Create()) { hash = Utils.GetMd5Hash(md5Hash, b.Password); } var obj = _dbContext.Usuarios.Where(a => a.Username.Equals(b.Username) && a.Password.Equals(hash)).FirstOrDefault(); LoginStatus status = new LoginStatus(); if (obj != null) { status.Success = true; status.Message = ""; status.Token = Guid.NewGuid().ToString(); status.Username = b.Username; status.UserId = obj.Id; //HttpContext.Session.SetString(UserName, obj.Username.ToString()); } else { status.Success = false; status.Message = "Login inválido"; status.Token = ""; status.Username = ""; status.UserId = 0; } return Json(status); }
/// <summary> /// Initialize everything that needs to be initialized once we're logged in. /// </summary> /// <param name="login">The status of the login</param> /// <param name="message">Error message on failure, MOTD on success.</param> public void LoginHandler(LoginStatus login, string message) { if (login == LoginStatus.Success) { // Start in the inventory root folder. CurrentDirectory = Inventory.Store.RootFolder; } }
public static void SendLoginNotification(LoginStatus loginStatus, Connection connection) { if (loginStatus == LoginStatus.Sucess) { // We should check for a exact number of nodes here when we have the needed infraestructure if (ConnectionManager.NodesCount > 0) { connection.NodeID = ConnectionManager.RandomNode; AuthenticationRsp rsp = new AuthenticationRsp(); // String "None" marshaled byte[] func_marshaled_code = new byte[] { 0x74, 0x04, 0x00, 0x00, 0x00, 0x4E, 0x6F, 0x6E, 0x65 }; rsp.serverChallenge = ""; rsp.func_marshaled_code = func_marshaled_code; rsp.verification = false; rsp.cluster_usercount = ConnectionManager.ClientsCount + 1; // We're not in the list yet rsp.proxy_nodeid = connection.NodeID; rsp.user_logonqueueposition = 1; rsp.challenge_responsehash = "55087"; rsp.macho_version = Common.Constants.Game.machoVersion; rsp.boot_version = Common.Constants.Game.version; rsp.boot_build = Common.Constants.Game.build; rsp.boot_codename = Common.Constants.Game.codename; rsp.boot_region = Common.Constants.Game.region; // Setup session connection.Session.SetString("address", connection.Address); connection.Session.SetString("languageID", connection.LanguageID); connection.Session.SetInt("userType", Common.Constants.AccountType.User); connection.Session.SetLong("userid", connection.AccountID); connection.Session.SetLong("role", connection.Role); // Update the connection, so it gets added to the clients correctly ConnectionManager.UpdateConnection(connection); connection.Send(rsp.Encode()); } else { // Pretty funny, "AutClusterStarting" maybe they mean "AuthClusterStarting" GPSTransportClosed ex = new GPSTransportClosed("AutClusterStarting"); connection.Send(ex.Encode()); Log.Trace("Client", "Rejected by server; cluster is starting"); connection.EndConnection(); } } else if (loginStatus == LoginStatus.Failed) { GPSTransportClosed ex = new GPSTransportClosed("LoginAuthFailed"); connection.Send(ex.Encode()); connection.EndConnection(); } }
async private void UpdateFacebookId(LoginStatus status) { if (status == LoginStatus.LoggedIn) { await PreloadUserInformation(); } this.LoadPicture(); }
void Start() { Debug.Log("LoginScene Start"); //init status = LoginStatus.WAIT; controller = ClientController.Instance; addListener(); Log.game.Debug("Game Started"); }
public static void Login_Finish(User user, LoginStatus status) { if (status == LoginStatus.Success) { Contract.usersLoggedIn = Contract.usersLoggedIn.Add(user); } else // if status == LoginStatus.Failure if (Contract.usersLoggedIn.Contains(user)) Contract.usersLoggedIn = Contract.usersLoggedIn.Remove(user); activeLoginRequests = activeLoginRequests.RemoveKey(user); }
void Network_OnLogin(LoginStatus login, string message) { if (login == LoginStatus.Failed) { Display.Error(Session.SessionNumber, "Login failed (" + message + ")"); } else if (login == LoginStatus.Success) { Display.InfoResponse(Session.SessionNumber, "Connected!"); } else Display.InfoResponse(Session.SessionNumber, message); }
/// <summary> /// Initialize everything that needs to be initialized once we're logged in. /// </summary> /// <param name="login">The status of the login</param> /// <param name="message">Error message on failure, MOTD on success.</param> public void LoginHandler(LoginStatus login, string message) { if (login == LoginStatus.Success) { // Create the stores: InventoryStore = new Inventory(Inventory, Inventory.InventorySkeleton); LibraryStore = new Inventory(Inventory, Inventory.LibrarySkeleton); // Start in the inventory root folder: CurrentDirectory = InventoryStore.RootFolder; } }
private void Network_OnLogin(LoginStatus login, string message) { if (login == LoginStatus.Success) { UpdateTimer.Elapsed += new System.Timers.ElapsedEventHandler(UpdateTimer_Elapsed); UpdateTimer.Start(); } else if (login == LoginStatus.Failed) { Console.WriteLine("Login failed: " + Client.Network.LoginMessage); Console.ReadKey(); this.Close(); return; } }
private void Network_OnLogin(LoginStatus login, string message) { if (login == LoginStatus.Success) { EnablePlugins(true); } else if (login == LoginStatus.Failed) { BeginInvoke( (MethodInvoker)delegate() { MessageBox.Show(this, String.Format("Error logging in ({0}): {1}", Client.Network.LoginErrorKey, Client.Network.LoginMessage)); cmdConnect.Text = "Connect"; txtFirstName.Enabled = txtLastName.Enabled = txtPassword.Enabled = true; EnablePlugins(false); }); } }
public void Login(LoginData data, out string token, out LoginStatus status) { Smmuser user= SqlMapHelper.DefaultSqlMap.QueryForObject<Smmuser>("SelectSmmuserByKey", data.UserNumber); if (user == null) status = LoginStatus.InvalidUser; else { if (MainDataModule.Decrypt(user.Password) == data.Password) status = LoginStatus.OK; else status = LoginStatus.InvalidPassword; } token = string.Empty; if (status == LoginStatus.OK) { token = Guid.NewGuid().ToString(); UserStateSingleton.Instance.AddUser(new UserInfo(token, data.UserNumber)); } }
public static bool TryGetAuthenticatedLogin(CSSDataContext db, string username, string password, out Login login, out LoginStatus loginStatus) { loginStatus = LoginStatus.Authenticated; login = Login.FindLoginByUsernameOrCallsign(db, username); if (login == null) loginStatus = LoginStatus.InvalidCredentials; else if (login.IsBanned) loginStatus = LoginStatus.AccountLocked; else { CssMembershipProvider provider = new CssMembershipProvider(); if (provider.ValidateUser(login.Username, password) == false) loginStatus = LoginStatus.InvalidCredentials; else loginStatus = LoginStatus.Authenticated; } return loginStatus == LoginStatus.Authenticated; }
private async Task LogHistory(LoginType loginType, LoginStatus status, string clientId, string username, string deviceKey, string apiKey, string clientIp = null, string clientUri = null) { var unityContainer = UnityConfig.GetConfiguredContainer() as UnityContainer; var loginHistoryBll = unityContainer.Resolve<ILoginHistoryBll>(); if (string.IsNullOrEmpty(clientIp)) clientIp =SecurityUtils.GetClientIPAddress(); if (string.IsNullOrEmpty(clientUri) && HttpContext.Current != null) clientUri = HttpContext.Current.Request.Url.AbsoluteUri; int num = await loginHistoryBll.InsertLoginHistory(new InsertLoginHistoryInput() { Type = loginType.GetHashCode(), UserName = username, LoginTime = DateTime.Now, LoginStatus = status.GetHashCode(), AppId = string.IsNullOrEmpty(clientId) ? null : clientId, ClientUri = clientUri, ClientIP = clientIp, ClientUA = HttpContext.Current.Request.UserAgent, ClientApiKey = apiKey, ClientDevice = deviceKey }); }
void OnGUI() { GUI.Box(CenterRect(0, -80, 300, 50), "유니티클라+자바서버 샘플"); GUI.Box(CenterRect(0, -30, 300, 25), mesage); email = GUI.TextField(CenterRect(0, 0, 150, 25), email, 30); password = GUI.TextField(CenterRect(0, 25, 150, 25), password, 30); //로그인 버튼 클릭시 처리 프로토콜 호출 if( GUI.Button(CenterRect(0, 55, 50, 25), "login") ) { PUserLogin login = new PUserLogin(); login.sendLogin(email, password); } //로그인 상태 변경 if( status == LoginStatus.SUCESS ) { Application.LoadLevel("LobbyScene"); }else if( status == LoginStatus.FAIL ) { mesage = "이메일 또는 패스워드가 맞지 않습니다."; status = LoginStatus.WAIT; }else if( status == LoginStatus.DUPLICATE_LOGIN ) { mesage = "중복 로그인으로 인한 실패"; status = LoginStatus.WAIT; } }
private void UpdateLoginStatus(LoginStatus status, string message) { InternalStatusCode = status; InternalLoginMessage = message; Logger.DebugLog("Login status: " + status.ToString() + ": " + message, Client); // If we reached a login resolution trigger the event if (status == LoginStatus.Success || status == LoginStatus.Failed) { CurrentContext = null; LoginEvent.Set(); } // Fire the login status callback if (m_LoginProgress != null) { OnLoginProgress(new LoginProgressEventArgs(status, message, InternalErrorKey)); } }
private void loginCallback(LoginStatus status, string message) { VUtil.assetServerUri = this.m_user.Network.AssetServerUri; VUtil.authToken = this.m_user.Network.SecureSessionID; if (OnLogin != null) { OnLogin((LoginStatus)status, message); } }
public void loginStatusCallback(LoginStatus login, string message) { if (login == LoginStatus.Failed) { m_log.ErrorFormat("[CONNECTION]: Login Failed:{0}",message); } }
IEnumerator CreateAccount(string username, string password, string email){ WWWForm registerForm = new WWWForm(); registerForm.AddField("username", username); registerForm.AddField("email", email); registerForm.AddField("password", password); registerForm.AddField("submitted", 1); WWW www = new WWW( REGISTER_URL, registerForm ); yield return www; if(www.error != null){ Debug.Log("ERROR ON REGISTRATION: "+ www.error); } else{ string encodedString = www.data; Debug.Log(encodedString); JSONObject j = new JSONObject(encodedString); // Debug.Log(j.list); // Debug.Log(j.HasField("id_u")); if(j.HasField("id_u")){ string uID = j.GetField("id_u").str; Debug.Log(uID); userID = int.Parse(uID); Debug.Log(userID + ": Registered and Logged In"); loginStatus = LoginStatus.LoggedIn; } } yield return 0; }
public LoginStatusChangedEventArgs(LoginStatus loginStatus) { LoginStatus = loginStatus; }
void Network_OnLogin(LoginStatus login, string message) { if (login == LoginStatus.Success) UpdateFolder(Client.Inventory.Store.RootFolder.UUID); }
private void UpdateLoginStatus(LoginStatus status, string message) { InternalStatusCode = status; InternalLoginMessage = message; Logger.DebugLog("Login status: " + status.ToString() + ": " + message, Client); // If we reached a login resolution trigger the event if (status == LoginStatus.Success || status == LoginStatus.Failed) { CurrentContext = null; LoginEvent.Set(); } // Fire the login status callback if (OnLogin != null) { try { OnLogin(status, message); } catch (Exception e) { Logger.Log(e.Message, Helpers.LogLevel.Error, Client, e); } } }
/// <summary> /// 프로토콜 결과 수신 /// ClientIoHandler -> IClientEventListener -> IUIEventListener.perform /// </summary> /// <param name="gameEvent"></param> public override void perform(ClientEventAbstract clientEvent) { //로그인 프로토콜 if( clientEvent.GetProtocol() == Protocol.USER_LOGIN ) { if( clientEvent.GetHResult() == RCode.SUCESS ) { status = LoginStatus.SUCESS; } else { status = LoginStatus.FAIL; } //중복 로그인 프로토콜 } else if( clientEvent.GetProtocol() == Protocol.DUPLICATE_LOGIN ) { status = LoginStatus.DUPLICATE_LOGIN; } }
void Network_OnLogin(LoginStatus login, string message) { if (login == LoginStatus.Failed) LogText("Login failed: " + message, Color.Red); else if (login != LoginStatus.Success) LogText(message, Color.Black); }
static void LoginHandler(LoginStatus login, string message) { Logger.Log(String.Format("Login: {0} ({1})", login, message), Helpers.LogLevel.Info); switch (login) { case LoginStatus.Failed: LoginEvent.Set(); break; case LoginStatus.Success: LoginSuccess = true; LoginEvent.Set(); break; } }
public LoginProgressEventArgs(LoginStatus login, String message, String failReason) { this.m_Status = login; this.m_Message = message; this.m_FailReason = failReason; }
/// <summary> /// Helper function to complete the login procedure and check the /// credentials. /// </summary> /// <returns>Whether the login was successful or not.</returns> private bool login() { loginStatus = LoginStatus.LoginFailed; String response = steamRequest("ISteamWebUserPresenceOAuth/Logon/v0001", "?access_token=" + accessToken); if (response != null) { JObject data = JObject.Parse(response); if (data["umqid"] != null) { steamid = (String)data["steamid"]; umqid = (String)data["umqid"]; message = (int)data["message"]; OnLogon(new SteamEvent()); loginStatus = LoginStatus.LoginSuccessful; return true; } else { return false; } } else { return false; } }
/// <summary> /// Login that takes a struct of all the values that will be passed to /// the login server /// </summary> /// <param name="loginParams">The values that will be passed to the login /// server, all fields must be set even if they are String.Empty</param> /// <returns>Whether the login was successful or not. On failure the /// LoginErrorKey string will contain the error code and LoginMessage /// will contain a description of the error</returns> public bool Login(LoginParams loginParams) { BeginLogin(loginParams); LoginEvent.WaitOne(loginParams.Timeout, false); if (CurrentContext != null) { CurrentContext = null; // Will force any pending callbacks to bail out early InternalStatusCode = LoginStatus.Failed; InternalLoginMessage = "Timed out"; return false; } return (InternalStatusCode == LoginStatus.Success); }
private void Network_OnLogin(LoginStatus login, string message) { SetLabelText(txtStatus, message); }