public TextBoxInput(Forms.TextBox tb, InkControl parent) { InitializeComponent(); Translator.Translate(this); this.tb = tb; tbContent.Text = tb.Text; this.ink = parent; SetParent(Handle, parent.Handle); this.Text = Language.GetText("Dialog.textBox"); this.Icon = Icon.FromHandle(Forms.TextBox.BitmapTB.GetHicon()); foreach (FontFamily ff in FontFamily.Families) { cbFontFamilies.Items.Add(ff.Name); } cbFontFamilies.Text = tb.FontFamily; numFontSize.Value = (decimal)tb.FontSize; foreach (string name in Enum.GetNames(typeof(Renderer.BaseRenderer.TextAlign))) { cbAlignment.Items.Add(name); } CloseAll(); if (!opened.Contains(this)) { opened.Add(this); } this.FormClosing += TextBoxInput_FormClosing; }
void AccountSecurity_Show(object sender, EventArgs e) { template.SetTemplate("account_security.html"); Save(new EventHandler(AccountSecurity_Save)); if (core.Http.Query["mode"] == "enrole_phone" && (!LoggedInMember.UserInfo.TwoFactorAuthVerified)) { template.SetTemplate("account_security_twofactor.html"); AuthoriseRequestSid(); } else if (core.Http.Query["mode"] == "enrole_authenticator" && (!LoggedInMember.UserInfo.TwoFactorAuthVerified)) { template.SetTemplate("account_security_twofactor.html"); AuthoriseRequestSid(); Authenticator authenticator = new Authenticator(); string key = authenticator.GenerateKey(); Dictionary<string, string> args = new Dictionary<string, string>(); args.Add("mode", "qr_code"); args.Add("secret", key); string qrCode = core.Hyperlink.AppendSid(BuildUri("security", args), true); BoxSocial.Forms.Image qrCodeImage = new Forms.Image("qr_code", qrCode); BoxSocial.Forms.TextBox verifyTextBox = new Forms.TextBox("verify"); BoxSocial.Forms.HiddenField keyHiddenField = new Forms.HiddenField("key"); keyHiddenField.Value = key; template.Parse("S_ENROLE_AUTHENTICATOR", "TRUE"); template.Parse("I_QR_CODE", qrCodeImage); template.Parse("S_KEY", keyHiddenField); template.Parse("S_VERIFY", verifyTextBox); template.Parse("USERNAME", LoggedInMember.UserName); LoggedInMember.UserInfo.TwoFactorAuthKey = key; LoggedInMember.UserInfo.Update(); } else if (LoggedInMember.UserInfo.TwoFactorAuthVerified) { template.Parse("S_ENABLED", "TRUE"); template.Parse("U_DISABLE", core.Hyperlink.AppendSid(BuildUri("security", "disable"), true)); } else { template.Parse("S_DISABLED", "TRUE"); template.Parse("U_ENABLE", core.Hyperlink.AppendSid(BuildUri("security", "enrole_phone"), true)); } // Show all active sessions SelectQuery query = SessionKey.GetSelectQueryStub(core, typeof(SessionKey)); query.AddCondition(new DataField(typeof(SessionKey), "user_id"), LoggedInMember.Id); query.AddSort(SortOrder.Descending, "key_last_visit_ut"); System.Data.Common.DbDataReader sessionsReader = db.ReaderQuery(query); while (sessionsReader.Read()) { SessionKey sessionKey = new SessionKey(core, sessionsReader); VariableCollection sessionsVariableCollection = template.CreateChild("sessions_list"); sessionsVariableCollection.Parse("IP", sessionKey.Ip); sessionsVariableCollection.Parse("TIME", core.Tz.DateTimeToString(sessionKey.GetVisit(core.Tz))); sessionsVariableCollection.Parse("BROWSER_STRING", sessionKey.BrowserString); } sessionsReader.Close(); sessionsReader.Dispose(); }