예제 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //把single sign on 之後的工號抓到
            string getAD = GetSSOAttribute("SM_USER");

            string AllHttpAttrs = Request.ServerVariables["ALL_HTTP"];

            AccountInfo accInfo = new sAccount().ExecLogon(getAD);

            //如果accinfo不等於空值
            if (accInfo != null)
            {
                //將該物件accinfo傳給Session["AccountInfo"]保存
                Session["pwerRowData"] = accInfo;
                string querystr = Request.QueryString["en"].ToString();
                if (Request.UrlReferrer.OriginalString.ToString().IndexOf("enVersion") != -1)
                {
                    Response.Redirect("~/sfts/enVersion/VeryflyEn.aspx?en=" + querystr);
                }
                else
                {
                    Response.Redirect("~/sfts/Veryfly.aspx?en=" + querystr);
                }
            }
            else
            {
                Application["ErrorMsg"] = "您沒有權限";
                Response.Redirect("~/errorPage.aspx");
            }
        }
예제 #2
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                string tbxUserName = context.Request.Form["tbxUserName"];
                string tbxPwd      = context.Request.Form["tbxPwd"];

                string   returnValue = string.Empty;
                security sec         = new security();
                Email    myEmail     = new Email();
                //底下為登入後之判斷
                AccountInfo accInfo = new sAccount().ExecLogonOutCompany(tbxUserName, encode.sha1en(tbxPwd.ToString()));
                //如果accinfo不等於空值
                if (accInfo != null)
                {
                    //將該物件accinfo傳給Session["AccountInfo"]保存
                    context.Session["pwerRowData"] = accInfo;
                    DateTime lastlogdate = DateTime.Parse(accInfo.LastLogDate);
                    DateTime nowdate     = DateTime.Now;
                    TimeSpan Total       = nowdate.Subtract(lastlogdate);
                    int      daysub      = Total.Days;
                    login_DB mylog       = new login_DB();
                    if (daysub > 90)
                    {
                        returnValue = "此帳號已超過90天未登入,系統將會重新寄送密碼變更連結,請至您的信箱收取信件並由信內之連結登入";

                        //寄送密碼變更連結
                        StringBuilder sb = new StringBuilder();
                        sb.Append(@"親愛的" + accInfo.Title + " 您好:<br /><br />");
                        sb.Append(@"由於您已超過90天未登入,系統需要您重新變更密碼再嘗試重新登入<br /><br />");
                        sb.Append(@"請點擊下方連結回系統變更密碼<br /><br />");
                        sb.Append(@"<a href='" + AppConfig.MailUrl + "valid.aspx?vid=" + accInfo.QueryStr + "'>" + AppConfig.MailUrl + "valid.aspx?vid=" + accInfo.QueryStr + "</a><br /><br />");
                        sb.Append(@"謝謝您!");
                        myEmail.sendEmail(accInfo.Account, "[ITRI]工研院大檔案傳輸密碼通知", sb.ToString(), "");
                    }
                    else
                    {
                        returnValue = "success";
                        //更新最後登入日期
                        mylog.UPDATElastlogdate(accInfo.IDmem);
                    }
                }
                else
                {
                    returnValue = "登入失敗 請檢查您輸入之E-mail與密碼是否正確";
                }

                context.Response.Write(returnValue);
            }
            catch (Exception ex)
            {
                throw new Exception(MessageUtil.loginlogError + ex.HelpLink);
            }
        }
예제 #3
0
        public void ProcessRequest(HttpContext context)
        {
            try
            {
                string tbxUserName = context.Request.Form["tbxUserName"];
                string tbxPwd      = context.Request.Form["tbxPwd"];

                string   returnValue = string.Empty;
                security sec         = new security();
                Email    myEmail     = new Email();
                //底下為登入後之判斷
                AccountInfo accInfo = new sAccount().ExecLogonOutCompany(tbxUserName, encode.sha1en(tbxPwd.ToString()));
                //如果accinfo不等於空值
                if (accInfo != null)
                {
                    //將該物件accinfo傳給Session["AccountInfo"]保存
                    context.Session["pwerRowData"] = accInfo;
                    DateTime lastlogdate = DateTime.Parse(accInfo.LastLogDate);
                    DateTime nowdate     = DateTime.Now;
                    TimeSpan Total       = nowdate.Subtract(lastlogdate);
                    int      daysub      = Total.Days;
                    login_DB mylog       = new login_DB();
                    if (daysub > 90)
                    {
                        returnValue = "This account has not logged more than 90 days, the system will re-send password change link to your mailbox";

                        //寄送密碼變更連結
                        StringBuilder sb = new StringBuilder();
                        sb.Append(@"Dear " + accInfo.Title + " :<br /><br />");
                        sb.Append(@"Since you have more than 90 days are not logged in,<br /> the system requires you to change your password and then try to re-login again <br /><br />");
                        sb.Append(@"Please click on the link below to change the password back to the system<br /><br />");
                        sb.Append(@"<a href='" + AppConfig.MailUrl + "?vid=" + accInfo.QueryStr + "'>" + AppConfig.MailUrl + "?vid=" + accInfo.QueryStr + "</a><br /><br />");
                        sb.Append(@"Thank you!");
                        myEmail.sendEmail(accInfo.Account, "[ITRI]Notification from ITRI WebFTP - Change password", sb.ToString(), "");
                    }
                    else
                    {
                        returnValue = "success";
                        //更新最後登入日期
                        mylog.UPDATElastlogdate(accInfo.IDmem);
                    }
                }
                else
                {
                    returnValue = "login Fail, Please check that you enter the E-mail and password are correct";
                }

                context.Response.Write(returnValue);
            }
            catch (Exception ex)
            {
                throw new Exception(MessageUtil.loginlogError + ex.HelpLink);
            }
        }
예제 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //把single sign on 之後的工號抓到
            string getAD = GetSSOAttribute("SM_USER");

            string AllHttpAttrs = Request.ServerVariables["ALL_HTTP"];

            AccountInfo accInfo = new sAccount().ExecLogon(getAD);

            //如果accinfo不等於空值
            if (accInfo != null)
            {
                //將該物件accinfo傳給Session["AccountInfo"]保存
                Session["pwerRowData"] = accInfo;
                if (Request.QueryString["en"] != null)
                {
                    if (Request.QueryString["lang"] != null && Request.QueryString["lang"].ToString().Trim() == "en")
                    {
                        Response.Redirect("~/sfts/enVersion/VeryflyEn.aspx?en=" + Request.QueryString["en"].ToString());
                    }
                    else
                    {
                        Response.Redirect("~/sfts/Veryfly.aspx?en=" + Request.QueryString["en"].ToString());
                    }
                }
                else
                {
                    //Response.Write(Request.UrlReferrer.ToString());
                    if (Request.QueryString["lang"] != null && Request.QueryString["lang"].ToString().Trim() == "en")
                    {
                        Response.Redirect("~/sfts/enVersion/FileEditPageEn.aspx");
                    }
                    else
                    {
                        Response.Redirect("~/sfts/FileEditPage.aspx");
                    }
                }
            }
        }