Exemple #1
0
        public override string GetCellData(string strColumnName, PwEntry pe)
        {
            if (strColumnName == null)
            {
                return(string.Empty);
            }
            if (pe == null)
            {
                return(string.Empty);
            }
            Random r = new Random();

            string otp       = string.Empty;
            bool   bForUsage = new System.Diagnostics.StackTrace().GetFrames().FirstOrDefault(x => x.GetMethod().Name == "OnPwListItemDrag") != null;

            if (bForUsage)
            {
                otp = OTPDAO.GetOTP(pe).GetOTP();
            }
            else
            {
                otp = OTPDAO.GetReadableOTP(pe);
            }
            if (!string.IsNullOrEmpty(otp))
            {
                if (bForUsage || strColumnName == OTPColumn_Verbose)
                {
                    return(otp);
                }
                return(PluginTranslation.PluginTranslate.TFADefined);
            }

            if (!Config.CheckTFA)
            {
                return(string.Empty);
            }
            string url = pe.Strings.ReadSafe(PwDefs.UrlField);

            if (string.IsNullOrEmpty(url))
            {
                return(string.Empty);
            }

            TFASites.TFAPossible TFAPossible = TFASites.IsTFAPossible(url);
            if (TFAPossible == TFASites.TFAPossible.Yes)
            {
                return(PluginTranslation.PluginTranslate.SetupTFA);
            }
            else if (TFAPossible == TFASites.TFAPossible.Unknown)
            {
                return("Checking 2FA");
            }
            else
            {
                return(string.Empty);
            }
        }