public void CheckPassword(FormCollection collection) { if (!HttpContext.User.Identity.IsAuthenticated || CurrentUser == null) { RedirectToAction(ViewBag.BasePath + "Account/Login");//去登录 } else { JsonObject json = new JsonObject(); string password = collection["Password"]; if (!string.IsNullOrWhiteSpace(password)) { SiteIdentity SID = new SiteIdentity(CurrentUser.UserName); if (SID.TestPassword(password.Trim()) == 0) { json.Accumulate("STATUS", "ERROR"); } else { json.Accumulate("STATUS", "OK"); } } else { json.Accumulate("STATUS", "UNDEFINED"); } Response.Write(json.ToString()); } }
public void ExportManagerSitesTest() { // Arrange var context = new ExportImportContext(); var testSiteIdentity = new SiteIdentity { Id = Guid.NewGuid(), Name = "TestSite", RootPage = "123", StartPage = "456" }; context.SiteIdentityLoaderMock.SetupGet(l => l.SiteIdentites).Returns(new List <SiteIdentity> { testSiteIdentity }); var exportManager = new ExportManager(new List <IExporter>(), context.SiteIdentityLoaderMock.Object, context.Settings); // Act var sites = exportManager.GetSites(); // Assert Assert.Equal(2, sites.Count); Assert.Equal(Helpers.AllSitesId, sites[0].Id); Assert.Equal(testSiteIdentity.Id.ToString(), sites[1].Id); }
public HttpResponseMessage Login([FromBody] UserPostParamVM param) { HttpResponseMessage response = new HttpResponseMessage(); try { UserBL scope = new UserBL(); UserVM model = scope.GetByAccountPwd(param.Account, param.Password); if (model != null && model.Id.HasValue) { SiteIdentity si = new SiteIdentity(model.Id.Value, model.StaffCode, model.Account , model.CHName, model.Localization, model.StoreId); SysCommon.CurrentUser = si; response = Request.CreateResponse(HttpStatusCode.OK); } else { response = Request.CreateResponse(HttpStatusCode.Forbidden); } } catch (Exception ex) { LogHelper.Write(this.GetType(), ex); response = Request.CreateResponse <string>(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
protected void saveInfo() { bool Result; string IF_COL_ID = this.txtIF_COL_ID.Text; string IF_COL_NAME = this.txtIF_COL_NAME.Text; string CUSTOM_COL_ID = this.txtCUSTOM_COL_ID.Text; string CUSTOM_COL_NAME = this.txtCUSTOM_COL_NAME.Text; string SOOSIK = this.txtSOOSIK.Text; string soosik_desc = this.txtSOOSIK_DESC.Text; SiteIdentity gUserInfo = (SiteIdentity)Context.User.Identity; Result = bizPmsComInfo.Add_Pms_Com_Info(IF_COL_ID , IF_COL_NAME , CUSTOM_COL_ID , CUSTOM_COL_NAME , SOOSIK , soosik_desc , gUserInfo.Emp_Ref_ID.ToString()); if (Result) { this.ltrScript.Text = JSHelper.GetAlertScript("저장되었습니다."); } else { this.ltrScript.Text = JSHelper.GetAlertScript("저장에 실패하였습니다."); } }
public HttpResponseMessage GetCurrentUser() { HttpResponseMessage response = new HttpResponseMessage(); try { UserBL scope = new UserBL(); SiteIdentity currentUser = SysCommon.CurrentUser; if (currentUser != null) { response = Request.CreateResponse <SiteIdentity>(HttpStatusCode.OK, currentUser); } else { response = Request.CreateResponse(HttpStatusCode.Forbidden); } } catch (Exception ex) { LogHelper.Write(this.GetType(), ex); response = Request.CreateResponse <string>(HttpStatusCode.InternalServerError, ex.Message); } return(response); }
/// <summary> /// 사용자정보 세팅 /// </summary> private void SetUserName() { SiteIdentity gUserInfo = (SiteIdentity)Context.User.Identity; lblEmpName.Text = gUserInfo.Emp_Name; //DataTable dtEst_Data = bizEstData.GetEstData(COMP_ID, EST_ID, ESTTERM_REF_ID, ESTTERM_SUB_ID, ESTTERM_STEP_ID, "", TGT_DEPT_ID, TGT_EMP_ID); }
protected bool syncUSer() { Biz_Com_IF bizComIF = new Biz_Com_IF(); SiteIdentity gUserInfo = (SiteIdentity)Context.User.Identity; bool Result = bizComIF.Sync_Emp_IF(gUserInfo.LoginID); return(Result); }
public ActionResult Edit([Bind(Include = "Id,Title,Keywords,Description,LogoFA,LogoTitle")] SiteIdentity siteIdentity) { if (ModelState.IsValid) { db.Entry(siteIdentity).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(siteIdentity)); }
// GET: SiteIdentity/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } SiteIdentity siteIdentity = db.SiteIdentity.Find(id); if (siteIdentity == null) { return(HttpNotFound()); } return(View(siteIdentity)); }
protected void Page_Load(object sender, EventArgs e) { if (Context.User.Identity.IsAuthenticated) { gUserInfo = (SiteIdentity)Context.User.Identity; } iBtnShowMenu.Style.Add(HtmlTextWriterStyle.Position, "absolute"); iBtnShowMenu.Style.Add(HtmlTextWriterStyle.Top, "75px"); iBtnShowMenu.Style.Add(HtmlTextWriterStyle.Left, "0px"); if (!IsPostBack) { this.SetGlobalStatus(); #region FileVersion if (this.IASSEMBLY_VERSION == "") { string sVersionFormat = "[ {0} ]"; try { FileVersionInfo FVI = FileVersionInfo.GetVersionInfo(Server.MapPath("../bin/MicroBSC_deploy.dll")); this.IASSEMBLY_VERSION = String.Format(sVersionFormat, FVI.FileVersion); } catch { } } lblSysVer.Text = this.IASSEMBLY_VERSION; #endregion } else { if (hdfMenuStatus.Value == "O") { tdMenuLeft.Style.Add(HtmlTextWriterStyle.Display, "block"); } else { tdMenuLeft.Style.Add(HtmlTextWriterStyle.Display, "none"); } } this.SetNoticeBoard(); this.SetUserName(); this.SetMenu(); // 탑메뉴관련추가 - 타이틀설정 - 08.03.19 류승태 // MenuControl_Tree.ascx.cs 에서 Copy InitControlValue(); }
protected void Page_Load(object sender, EventArgs e) { if (Context.User.Identity.IsAuthenticated) { SiteIdentity gUserInfo = (SiteIdentity)Context.User.Identity; MicroBSC.Integration.CTL.Biz.Biz_Ctl_Common Biz = new MicroBSC.Integration.CTL.Biz.Biz_Ctl_Common(); Biz.ModifyConnectLog(Session.SessionID, gUserInfo.LoginID); } FormsAuthentication.SignOut(); string login_page_url = WebUtility.GetConfig("Login_Page_Url", "~/base/Login.aspx"); Response.Redirect(login_page_url); }
protected void btnAdd_Click(object sender, System.EventArgs e) { if (Page.IsValid) { SiteIdentity SID = new SiteIdentity(User.Identity.Name); if (SID.TestPassword(txtOldPassword.Text) == 0) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "原密码输入错误!"; } else if (this.txtPassword.Text.Trim() != this.txtPassword1.Text.Trim()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "密码输入的不一致!请重试!"; } else { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); //currentUser.Password=AccountsPrincipal.EncryptPassword(txtPassword.Text); currentUser.NonEncryptPasswordPassword = txtPassword.Text; if (!currentUser.Update()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "更新用户信息发生错误!"; //日志 //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新失败"); } else { this.lblMsg.ForeColor = Color.Blue; this.lblMsg.Text = "用户信息更新成功!"; //日志 //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri, "用户密码更新成功"); } } } }
public ActionResult UserPass(string oldPassword, string newPassword, string confirmPassword) { if (!HttpContext.User.Identity.IsAuthenticated) { return(RedirectToAction("Login", "Account")); //去登录 } SiteIdentity SID = new SiteIdentity(User.Identity.Name); JsonObject json = new JsonObject(); if (SID.TestPassword(oldPassword) == 0) { json.Put("Result", "Error"); return(Json(json)); } else { if (newPassword.Trim() != confirmPassword.Trim()) { json.Put("Result", "ConfirmError"); return(Json(json)); } else { YSWL.Accounts.Bus.User currentUser = CurrentUser; if (!currentUser.SetPassword(CurrentUser.UserName, newPassword, MvcApplication.IsAutoConn)) { json.Put("Result", "NO"); return(Json(json)); } else { json.Put("Result", "OK"); return(Json(json)); } } } }
public void btnSave_Click(object sender, System.EventArgs e) { if (Page.IsValid) { SiteIdentity SID = new SiteIdentity(User.Identity.Name); if (SID.TestPassword(txtOldPassword.Text) == 0) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = Resources.Site.ErrorPasswprdError; } else if (this.txtPassword.Text.Trim() != this.txtPassword1.Text.Trim()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = Resources.Site.ErrorPasswprd; } else { User currentUser = this.CurrentUser; currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text); if (!currentUser.Update()) { YSWL.Common.MessageBox.ShowFailTip(this, Resources.Site.TooltipUpdateError); //日志 //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri,Resources.Site.TooltipUpdateFailPassword); } else { YSWL.Common.MessageBox.ShowSuccessTip(this, Resources.Site.TooltipSaveOK); //日志 //UserLog.AddLog(currentUser.UserName, currentUser.UserType, Request.UserHostAddress, Request.Url.AbsoluteUri,Resources.Site.TooltipUpdateSuccessfulPassword); } } } }
protected void btnAdd_Click(object sender, System.EventArgs e) { if (Page.IsValid) { SiteIdentity SID = new SiteIdentity(User.Identity.Name); if (SID.TestPassword(txtOldPassword.Text) == 0) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "原密码输入错误!"; } else if (this.txtPassword.Text.Trim() != this.txtPassword1.Text.Trim()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "密码输入的不一致!请重试!"; } else { AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name); User currentUser = new LTP.Accounts.Bus.User(user); currentUser.Password = AccountsPrincipal.EncryptPassword(txtPassword.Text); if (!currentUser.Update()) { this.lblMsg.ForeColor = Color.Red; this.lblMsg.Text = "更新用户信息发生错误!"; } else { this.lblMsg.ForeColor = Color.Blue; this.lblMsg.Text = "用户信息更新成功!"; } } } }
protected void Page_Load(object sender, EventArgs e) { gUserInfo = (SiteIdentity)Context.User.Identity; bizPmsInfo = new Biz_Pms_Info(); bizPmsColInfo = new Biz_Pms_Col_Info(); bizPmsComInfo = new Biz_Pms_Com_Info(); if (!IsPostBack) { DropDownListCommom.BindComp(ddlCompID, lblCompTitle); this.prj_sDate.Value = System.DateTime.Now.AddMonths(-1); } COMP_ID = WebUtility.GetIntByValueDropDownList(ddlCompID); ltrScript.Text = ""; ibnSoosikSave.Visible = false; ibnSoosikSave.Enabled = false; }
public override string GetBaseFolder() { return(Path.Combine(YetaWFManager.DataFolder, Dataset, SiteIdentity.ToString())); }
public void ExportManagerSitesTest() { // Arrange var context = new ExportImportContext(); var testSiteIdentity = new SiteIdentity { Id = Guid.NewGuid(), Name = "TestSite", RootPage = "123", StartPage = "456" }; context.SiteIdentityLoaderMock.SetupGet(l => l.SiteIdentites).Returns(new List<SiteIdentity> { testSiteIdentity}); var exportManager = new ExportManager(new List<IExporter>(), context.SiteIdentityLoaderMock.Object, context.Settings); // Act var sites = exportManager.GetSites(); // Assert Assert.Equal(2, sites.Count); Assert.Equal(Helpers.AllSitesId, sites[0].Id); Assert.Equal(testSiteIdentity.Id.ToString(), sites[1].Id); }
protected void loginbtn_Click(object sender, ImageClickEventArgs e) { //세션ID 업데이트 Session.Abandon(); Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", "")); string bscAuth = ConfigurationManager.AppSettings["BSC.Authentication"].ToString(); string domainName = ConfigurationManager.AppSettings["Domain.Name"].ToString(); SitePrincipal newUser = null; string en_use_yn = WebUtility.GetConfig("ENCRYPTION_USE_YN").ToUpper(); string encryption_oneway_mode = WebUtility.GetConfig("ENCRYPTION_ONEWAY_MODE").ToUpper(); string encPasswd; if (en_use_yn.Equals("Y")) { encPasswd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPasswd.Text, encryption_oneway_mode); } else { encPasswd = txtPasswd.Text; } int loginResult = 0; int max_login_failcnt = DataTypeUtility.GetToInt32(WebUtility.GetConfig("MAX_LOGIN_FAILCNT", "5")); if (bscAuth.Equals("Forms")) // 폼 인증 { //newUser = SitePrincipal.ValidateLogin(txtLoginID.Text, encPasswd); loginResult = SitePrincipal.ValidateLogin(txtLoginID.Text, encPasswd, max_login_failcnt, out newUser); //로그인 시도 허용횟수 검사 } else if (bscAuth.Equals("Windows")) // 윈도우 인증 & 폼인증 { if (WindowAuthentication.ValidateLogin(txtLoginID.Text, encPasswd, domainName, Context)) { newUser = new SitePrincipal(txtLoginID.Text); } } if (newUser == null) { //MicroBSC.Integration.COM.Biz.Biz_Com_Emp_Info bizEmpInfo = new MicroBSC.Integration.COM.Biz.Biz_Com_Emp_Info(); //string emp_ref_id = bizEmpInfo.Get_Emp_Ref_Id(txtLoginID.Text); //if (emp_ref_id.Length == 0) //{ // //ID가 없음 // this.ltrScript.Text = JSHelper.GetAlertScript("ID가 존재하지 않습니다."); // txtLoginID.Focus(); //} //else //{ // //비번이 틀림 // this.ltrScript.Text = JSHelper.GetAlertScript("비밀번호가 틀렸습니다."); // txtPasswd.Focus(); //} if (loginResult == 0) { this.ltrScript.Text = JSHelper.GetAlertScript("ID 또는 비밀번호가 틀렸습니다."); txtPasswd.Focus(); } else if (loginResult == -1) { this.ltrScript.Text = JSHelper.GetAlertScript("로그인 시도 횟수가 초과되었습니다. 관리자에게 문의하세요."); txtPasswd.Focus(); } else { this.ltrScript.Text = JSHelper.GetAlertScript("관리자에게 문의하세요."); txtPasswd.Focus(); } } else { Context.User = newUser; SaveUserID(txtLoginID.Text, true); // 쿠키 저장 여부 //login.SetUserLogs(txtUserID.Text, Request.ServerVariables["REMOTE_ADDR"].ToString(), Request.ServerVariables["HTTP_USER_AGENT"].ToString(), Session.SessionID); SiteIdentity gUserInfo = (SiteIdentity)Context.User.Identity; //MicroBSC.Integration.CTL.Dac.Dac_Ctl_Common log = new MicroBSC.Integration.CTL.Dac.Dac_Ctl_Common(); //log.InsertConnectLog(Session.SessionID, gUserInfo.Emp_Ref_ID, gUserInfo.LoginID, gUserInfo.Emp_Name, Request.UserHostAddress, "BSC"); if (WebUtility.GetConfig("LOG_SIGNON", "N").Equals("Y")) { MicroBSC.Integration.CTL.Biz.Biz_Ctl_Common objCtlCommon = new MicroBSC.Integration.CTL.Biz.Biz_Ctl_Common(); objCtlCommon.AddConnectLog(Session.SessionID, gUserInfo.Emp_Ref_ID, gUserInfo.LoginID, gUserInfo.Emp_Name, Request.UserHostAddress, "BSC"); } if (WebUtility.GetConfig("SSL", "N").Equals("N")) { FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); Response.Redirect("Main.aspx"); } else { if (WebUtility.GetConfig("SSLLIVE", "N").Equals("Y")) { FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); Response.Redirect(WebUtility.GetConfig("SSL.MainPageLive", "Main.aspx")); } else { FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); Response.Redirect(WebUtility.GetConfig("SSL.MainPage", "Main.aspx")); } } //if (Request["ReturnUrl"] != null) //{ // //Response.Cookies["GSBNPortalWeb"].Expires = DateTime.Today.AddDays(-1); // //Response.Cookies["GSBNPortalWeb"].Value = null; // FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); // Response.Redirect("../index.aspx?" + "ReturnUrl=" + Request["ReturnUrl"]); //} //else //{ // FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); //} } }
protected void loginbtn_Click(object sender, ImageClickEventArgs e) { string bscAuth = ConfigurationManager.AppSettings["BSC.Authentication"].ToString(); string domainName = ConfigurationManager.AppSettings["Domain.Name"].ToString(); SitePrincipal newUser = null; string en_use_yn = WebUtility.GetConfig("ENCRYPTION_USE_YN").ToUpper(); string encryption_oneway_mode = WebUtility.GetConfig("ENCRYPTION_ONEWAY_MODE").ToUpper(); string encPasswd; if (en_use_yn.Equals("Y")) { encPasswd = FormsAuthentication.HashPasswordForStoringInConfigFile(txtPasswd.Text, encryption_oneway_mode); } else { encPasswd = txtPasswd.Text; } if (bscAuth.Equals("Forms")) // 폼 인증 { newUser = SitePrincipal.ValidateLogin(txtLoginID.Text, encPasswd); } else if (bscAuth.Equals("Windows")) // 윈도우 인증 & 폼인증 { if (WindowAuthentication.ValidateLogin(txtLoginID.Text, encPasswd, domainName, Context)) { newUser = new SitePrincipal(txtLoginID.Text); } } if (newUser == null) { MicroBSC.Integration.COM.Biz.Biz_Com_Emp_Info bizEmpInfo = new MicroBSC.Integration.COM.Biz.Biz_Com_Emp_Info(); string emp_ref_id = bizEmpInfo.Get_Emp_Ref_Id(txtLoginID.Text); if (emp_ref_id.Length == 0) { //ID가 없음 this.ltrScript.Text = JSHelper.GetAlertScript("ID가 존재하지 않습니다."); txtLoginID.Focus(); } else { //비번이 틀림 this.ltrScript.Text = JSHelper.GetAlertScript("비밀번호가 틀렸습니다."); txtPasswd.Focus(); } } else { Context.User = newUser; SaveUserID(txtLoginID.Text, true); // 쿠키 저장 여부 //login.SetUserLogs(txtUserID.Text, Request.ServerVariables["REMOTE_ADDR"].ToString(), Request.ServerVariables["HTTP_USER_AGENT"].ToString(), Session.SessionID); SiteIdentity gUserInfo = (SiteIdentity)Context.User.Identity; //MicroBSC.Integration.CTL.Dac.Dac_Ctl_Common log = new MicroBSC.Integration.CTL.Dac.Dac_Ctl_Common(); //log.InsertConnectLog(Session.SessionID, gUserInfo.Emp_Ref_ID, gUserInfo.LoginID, gUserInfo.Emp_Name, Request.UserHostAddress, "BSC"); MicroBSC.Integration.CTL.Biz.Biz_Ctl_Common objCtlCommon = new MicroBSC.Integration.CTL.Biz.Biz_Ctl_Common(); objCtlCommon.AddConnectLog(Session.SessionID, gUserInfo.Emp_Ref_ID, gUserInfo.LoginID, gUserInfo.Emp_Name, Request.UserHostAddress, "BSC"); FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); Response.Redirect("Main.aspx"); //if (Request["ReturnUrl"] != null) //{ // //Response.Cookies["GSBNPortalWeb"].Expires = DateTime.Today.AddDays(-1); // //Response.Cookies["GSBNPortalWeb"].Value = null; // FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); // Response.Redirect("../index.aspx?" + "ReturnUrl=" + Request["ReturnUrl"]); //} //else //{ // FormsAuthentication.RedirectFromLoginPage(txtLoginID.Text, false); //} } }
public void Navigate(string uriString) { _isNavigating = true; bool cancelled = false; var uri = new Uri(uriString); var normalisedUri = UriTester.NormaliseUri(uri); var siteIdentity = new SiteIdentity(normalisedUri, Session.Instance); var fullQuery = normalisedUri.OriginalString; //sanity check we have a valid URL syntax at least if (normalisedUri.Scheme == null) { ToastNotify("Invalid URL: " + normalisedUri.OriginalString, ToastMessageStyles.Error); cancelled = true; } ToggleContainerControlsForBrowser(false); //these are the only ones we "navigate" to. We do this by downloading the GMI content //converting to HTML and then actually navigating to that. if (normalisedUri.Scheme == "gemini") { var geminiNavigator = new GeminiNavigator(this); cancelled = geminiNavigator.NavigateGeminiScheme(fullQuery, uri, siteIdentity); } else if (normalisedUri.Scheme == "gopher") { var gopherNavigator = new GopherNavigator(this); cancelled = gopherNavigator.NavigateGopherScheme(fullQuery, uri, siteIdentity); } else if (normalisedUri.Scheme == "about") { var aboutNavigator = new AboutNavigator(this); cancelled = aboutNavigator.NavigateAboutScheme(uri, siteIdentity); } else if (normalisedUri.Scheme.StartsWith("http")) //both http and https { //detect ctrl click if (_settings.HandleWebLinks == "System web browser") { //open in system web browser var launcher = new ExternalNavigator(this); launcher.LaunchExternalUri(uri.ToString()); ToggleContainerControlsForBrowser(true); cancelled = true; } else if (_settings.HandleWebLinks == "Gemini HTTP proxy") { // use a gemini proxy for http links var geminiNavigator = new GeminiNavigator(this); cancelled = geminiNavigator.NavigateGeminiScheme(fullQuery, uri, siteIdentity); } else { //use internal navigator var httpNavigator = new HttpNavigator(this); cancelled = httpNavigator.NavigateHttpScheme(fullQuery, uri, siteIdentity, "web-launch-external"); } } else if (normalisedUri.Scheme == "file") { //just load the converted html file //no further action. BrowserControl.Text = File.ReadAllText(normalisedUri.LocalPath); } else { //we don't care about any other protocols //so we open those in system web browser to deal with var launcher = new ExternalNavigator(this); launcher.LaunchExternalUri(uri.ToString()); ToggleContainerControlsForBrowser(true); cancelled = true; } if (!cancelled) { uriString = uri.ToString(); //look up the URL that this HTML page shows var regex = new Regex(@".*/([a-f0-9]+)\.(.*)"); if (regex.IsMatch(uriString)) { var match = regex.Match(uriString); var hash = match.Groups[1].ToString(); string geminiUrl = _urlsByHash[hash]; if (geminiUrl != null) { //now show the actual gemini URL in the address bar txtUrl.Text = geminiUrl; ShowTitle(BrowserControl); var originalUri = new UriBuilder(geminiUrl); if (originalUri.Scheme == "http" || originalUri.Scheme == "https") { ShowLinkRenderMode(BrowserControl.Text); } } //if a text file (i.e. view->source), explicitly set the charset //to UTF-8 so ascii art looks correct etc. if ("txt" == match.Groups[2].ToString().ToLower()) { //set text files (GMI source) to be UTF-8 for now HtmlPanelExtensions.SetCharsetUtf8(BrowserControl.Text); } } BrowserControl.Focus(); ShowTitle(BrowserControl); //we need to turn on/off other elements so focus doesnt move elsewhere //in that case the keyboard events go elsewhere and you have to click //into the browser to get it to work again //see https://stackoverflow.com/questions/8495857/webbrowser-steals-focus ToggleContainerControlsForBrowser(true); } _isNavigating = false; }
public void ShowUrl(string sourceUrl, string gmiFile, string htmlFile, string themePath, SiteIdentity siteIdentity) { var hash = HashService.GetMd5Hash(sourceUrl); var usedShowWebHeaderInfo = false; var uri = new UriBuilder(sourceUrl); //only show web header for self generated content, not proxied usedShowWebHeaderInfo = uri.Scheme.StartsWith("http") && _settings.HandleWebLinks != "Gemini HTTP proxy"; //create the html file ConverterService.CreateDirectoriesIfNeeded(gmiFile, htmlFile, themePath); var result = ConverterService.GmiToHtml(gmiFile, htmlFile, sourceUrl, siteIdentity, themePath, usedShowWebHeaderInfo); if (!File.Exists(htmlFile)) { ToastNotify("GMIToHTML did not create content for " + sourceUrl + "\n\nFile: " + gmiFile, ToastMessageStyles.Error); ToggleContainerControlsForBrowser(true); } else { _urlsByHash[hash] = sourceUrl; //instead tell the browser to load the content Navigate(@"file:///" + htmlFile); } }
private string GetCommentFolderRoot() { return(Path.Combine(YetaWFManager.DataFolder, Package.AreaName, SiteIdentity.ToString(), "Comments")); }
public override string GetBaseFolder() { return(Path.Combine(YetaWFManager.DataFolder, Package.AreaName, SiteIdentity.ToString(), "Entries")); }
protected void Page_Load(object sender, EventArgs e) { if (Context.User.Identity.IsAuthenticated) { gUserInfo = (SiteIdentity)Context.User.Identity; } //iBtnShowMenu.Style.Add(HtmlTextWriterStyle.Position, "absolute"); //iBtnShowMenu.Style.Add(HtmlTextWriterStyle.Top, "75px"); //iBtnShowMenu.Style.Add(HtmlTextWriterStyle.Left, "0px"); if (!IsPostBack) { this.SetGlobalStatus(); #region FileVersion if (this.IASSEMBLY_VERSION == "") { string sVersionFormat = "[ {0} ]"; try { FileVersionInfo FVI = FileVersionInfo.GetVersionInfo(Server.MapPath("../bin/MicroBSC_deploy.dll")); this.IASSEMBLY_VERSION = String.Format(sVersionFormat, FVI.FileVersion); } catch { } } lblSysVer.Text = this.IASSEMBLY_VERSION; #endregion } else { if (hdfMenuStatus.Value == "O") { tdMenuLeft.Style.Add(HtmlTextWriterStyle.Display, "block"); } else { tdMenuLeft.Style.Add(HtmlTextWriterStyle.Display, "none"); } } this.SetNoticeBoard(); this.SetUserName(); this.SetMenu(); // 탑메뉴관련추가 - 타이틀설정 - 08.03.19 류승태 // MenuControl_Tree.ascx.cs 에서 Copy InitControlValue(); //매뉴얼 다운로드 활성화 부분 string manual_down_btn_yn = WebUtility.GetConfig("MANUAL_DOWN_YN", "N"); this.hdfManual_url.Value = WebUtility.GetConfig("MANUAL_DOWN_URL", ""); if (manual_down_btn_yn.Equals("N")) { this.ibnManual_down.Enabled = false; this.ibnManual_down.Visible = false; } if (Set_Visible_Current_Page_Info_Area()) { //divSil.Attributes.Add("style", "padding-top:5px;"); this.cPageInfo_Area.Visible = false; this.tdMenuLeft.Visible = false; } else { //divSil.Attributes.Add("style", "padding-top:0px;"); } }
// // GET: /Admin/Home/ public ActionResult Index() { SiteIdentity.Load(); return(View()); }
private void BrowserControl_Navigating(object sender, NavigatingCancelEventArgs e) { _isNavigating = true; var normalisedUri = UriTester.NormaliseUri(e.Uri); var siteIdentity = new SiteIdentity(normalisedUri, Session.Instance); var fullQuery = normalisedUri.OriginalString; //sanity check we have a valid URL syntax at least if (e.Uri.Scheme == null) { ToastNotify("Invalid URL: " + normalisedUri.OriginalString, ToastMessageStyles.Error); e.Cancel = true; } var settings = new UserSettings(); ToggleContainerControlsForBrowser(false); //these are the only ones we "navigate" to. We do this by downloading the GMI content //converting to HTML and then actually navigating to that. if (normalisedUri.Scheme == "gemini") { var geminiNavigator = new GeminiNavigator(this, this.BrowserControl); geminiNavigator.NavigateGeminiScheme(fullQuery, e, siteIdentity); } else if (normalisedUri.Scheme == "nimigem") { var nimigemNavigator = new NimigemNavigator(this, this.BrowserControl); var document = (HTMLDocument)BrowserControl.Document; var firstTextarea = (IHTMLTextAreaElement)document.getElementsByTagName("textarea").item(0); string payload; if (firstTextarea != null) { payload = firstTextarea.value; } else { payload = ""; } nimigemNavigator.NavigateNimigemScheme(fullQuery, e, payload); } else if (normalisedUri.Scheme == "gopher") { var gopherNavigator = new GopherNavigator(this, this.BrowserControl); gopherNavigator.NavigateGopherScheme(fullQuery, e, siteIdentity); } else if (normalisedUri.Scheme == "about") { var aboutNavigator = new AboutNavigator(this, this.BrowserControl); aboutNavigator.NavigateAboutScheme(e, siteIdentity); } else if (normalisedUri.Scheme.StartsWith("http")) //both http and https { var linkId = ""; ////doc might be null - you need to check when using! var doc = (HTMLDocument)BrowserControl.Document; ////this is how we could detect a click on a link to an image... if (doc?.activeElement != null) { linkId = doc.activeElement.id; } //detect ctrl click if ( Keyboard.IsKeyDown(Key.LeftCtrl) || Keyboard.IsKeyDown(Key.RightCtrl) || settings.HandleWebLinks == "System web browser" || linkId == "web-launch-external" ) { //open in system web browser var launcher = new ExternalNavigator(this); launcher.LaunchExternalUri(e.Uri.ToString()); ToggleContainerControlsForBrowser(true); e.Cancel = true; } else if (settings.HandleWebLinks == "Gemini HTTP proxy") { // use a gemini proxy for http links var geminiNavigator = new GeminiNavigator(this, this.BrowserControl); geminiNavigator.NavigateGeminiScheme(fullQuery, e, siteIdentity); } else { //use internal navigator var httpNavigator = new HttpNavigator(this, this.BrowserControl); httpNavigator.NavigateHttpScheme(fullQuery, e, siteIdentity, linkId); } } else if (normalisedUri.Scheme == "file") { //just load the converted html file //no further action. } else { //we don't care about any other protocols //so we open those in system web browser to deal with var launcher = new ExternalNavigator(this); launcher.LaunchExternalUri(e.Uri.ToString()); ToggleContainerControlsForBrowser(true); e.Cancel = true; } if (e.Cancel) { _isNavigating = false; } }
public override string GetBaseFolder() { return(Path.Combine(YetaWFManager.DataFolder, Package.AreaName, "Authorization", SiteIdentity.ToString())); }