public bool AuthenticateUser(string username, string password, out User offlineUserDetails) { bool authenticationStatus = false; var ivendContext = ServiceContainer.Instance.GetInstance <IIvendContext>() as IIvendContext; var logger = ivendContext.Logger as Logger; if (logger != null && logger.IsMethodLogEnabled) { logger.MethodStart(); } string userName = username; _userDetails = StoreAndRetrieveUserEncryptedData.RetrieveUserDetails(); OfflineUser offlineUser = (OfflineUser)_userDetails; var enteredPasswordHash = EncryptDecryptUtility.GenerateSaltedHashPwd(userName, password); if (true /*userName.Equals(_userDetails.UserName) && enteredPasswordHash.Equals(offlineUser.HashedPwd)*/) { offlineUser.UserName = _userDetails.UserName; offlineUser.HashedPwd = enteredPasswordHash; authenticationStatus = true; } offlineUserDetails = _userDetails; if (logger != null && logger.IsMethodLogEnabled) { logger.MethodEnd("Offline_AuthenticateUser", new[] { new ParamContainer("Authentication Status", authenticationStatus), new ParamContainer("UserDetails", offlineUserDetails), }); } return(authenticationStatus); }
private void OfflineNextStepBTNClk(object sender, RoutedEventArgs e) { if (BOX_OfflineUserName.Text.Trim() != "") { var user = OfflineUser.Login(BOX_OfflineUserName.Text.Trim()); User.AddUser(user); LoadUser(); ClearBoxesInLoginPage(); } }
public static IUser Read(this NetworkReader reader) { //We first need to figure out what account type we are dealing with UserProvider provider = (UserProvider)reader.ReadByte(); if (provider == UserProvider.Offline) { return(OfflineUser.Create(reader)); } return(SteamUser.Create(reader)); }
public OfflineUserWorks(ChangeStatusToOffline p_change_status_to_offline, OfflineUser p_offline_user, GetUserPresenceState p_get_user_presence_state , GetOnlineUserThreadID p_get_online_user_thread_id, UserLeaveAllChats p_user_leave_all_chats, RemoveAThreadDialogs p_remove_a_thread_dialog , RemoveAUserDialogs p_remove_a_user_dialog, RemoveThread p_remove_thread) { change_status_to_offline = p_change_status_to_offline; offline_user = p_offline_user; get_user_presence_state = p_get_user_presence_state; get_online_user_thread_id = p_get_online_user_thread_id; user_leave_all_chats = p_user_leave_all_chats; remove_a_thread_dialog = p_remove_a_thread_dialog; remove_a_user_dialog = p_remove_a_user_dialog; remove_thread = p_remove_thread; }
public static OfflineUser RetrieveUserDetails() { var logger = GetLogger(); if (logger != null && logger.IsMethodLogEnabled) { logger.MethodStart(); } string fileName = GetFileName(); SerializationHelper <OfflineUser> serializationObj = new SerializationHelper <OfflineUser>(); OfflineUser userDetails = (OfflineUser)(serializationObj.Load(fileName)); if (logger != null && logger.IsMethodLogEnabled) { logger.MethodEnd("RetrieveUserDetails", new[] { new ParamContainer("User Details", userDetails) }); } return(userDetails); }
public static void SaveUserData(string userName, string passWord) { var logger = GetLogger(); if (logger != null && logger.IsMethodLogEnabled) { logger.MethodStart(); } OfflineUser userDetails = new OfflineUser(); userDetails.UserName = userName; userDetails.HashedPwd = EncryptDecryptUtility.GenerateSaltedHashPwd(userName, passWord); SerializationHelper <OfflineUser> serializationObj = new SerializationHelper <OfflineUser>(); string fileName = GetFileName(); serializationObj.Save(userDetails, fileName); if (logger != null && logger.IsMethodLogEnabled) { logger.MethodEnd("SaveUserData", new[] { new ParamContainer("User Details", userDetails) }); } }