Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            String html  = "";
            String error = "";

            LoginData login = LoginUser.LogedUser(this);

            if (login != null)
            {
                if (Session["last_page"] != null)
                {
                    Response.Redirect(Session["last_page"].ToString());
                    Session["last_page"] = null;
                }
                else
                {
                    Response.Redirect(System.Web.Hosting.HostingEnvironment.ApplicationVirtualPath + "autoservice/");
                }
            }
            else
            {
                if (Request.HttpMethod == "POST")
                {
                    try
                    {
                        Int64 userId = LoginUser.FindUser(this, Request["username"], out error);
                        if (userId > 0)
                        {
                            Session["user_info"] = userId;

                            Response.Redirect(Session["ApplicationVirtualPath"] + "login2/recover/step1/", false);
                            return;
                        }

                        /*else if ((user.Emails == null) || (user.Emails.Count == 0))
                         * {
                         *  error = MessageResource.GetMessage("user_email_list");
                         * }
                         * else
                         * {
                         *  error = user.ErrorText;
                         * }*/
                    }
                    catch (Exception ex)
                    {
                        Tools.Tool.notifyException(ex);
                        error = MessageResource.GetMessage("internal_error");
                    }
                }


                html += "<form id=\"serviceLogin\" name=\"serviceLogin\" method=\"post\" action=\"" + Session["ApplicationVirtualPath"] + "login2/recover/\"><div class=\"login_form\">";

                html += "    <ul>";
                html += "        <li>";
                html += "            <p style=\"width:270px;padding:0 0 20px 0;color:#000;\">" + MessageResource.GetMessage("login_recover_message") + "</p>";
                html += "        </li>";
                html += "        <li>";
                html += "            <span class=\"inputWrap\">";
                html += "				<input type=\"text\" id=\"username\" tabindex=\"1\" name=\"username\" value=\""+ Request["username"] + "\" style=\"\" placeholder=\"" + MessageResource.GetMessage("login_user_name") + "\" onfocus=\"$('#username').addClass('focus');\" onblur=\"$('#username').removeClass('focus');\" />";
                html += "				<span id=\"ph_userLoginIcon\" onclick=\"$('#username').focus();\"></span>";
                html += "            </span>";
                html += "        </li>";

                if (error != "")
                {
                    html += "        <li><div class=\"error-box\">" + error + "</div>";
                }

                html += "        </li>";
                html += "        <li>";
                html += "            <span class=\"forgot\"> <a href=\"" + Session["ApplicationVirtualPath"] + "login2/\">" + MessageResource.GetMessage("cancel") + "</a> </span>";
                html += "            <button tabindex=\"4\" id=\"submitBtn\" class=\"action button floatright\">" + MessageResource.GetMessage("login_recover_btn_recover") + "</button>";
                html += "        </li>";
                html += "    </ul>     ";

                html += "</div></form>";
                holderContent.Controls.Add(new LiteralControl(html));
            }
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            WebJsonResponse ret = null;

            //ResourceManager rm = new ResourceManager("Resources.Strings", System.Reflection.Assembly.Load("App_GlobalResources"));
            //CultureInfo ci = Thread.CurrentThread.CurrentCulture;


            try
            {
                Int64 enterpriseID = ((EnterpriseData)Page.Session["enterprise_data"]).Id;
                Int64 entityId     = 0;

                String err = "";
                entityId = LoginUser.FindUser(this, Request["userLogin"], out err);
                if (entityId > 0)
                {
                    Session["entityId"] = entityId;

                    LoginUser.NewCode(this, entityId, out err);
                    if (err == "")
                    {
                        String html = "";
                        using (IAMDatabase db = new IAMDatabase(IAMDatabase.GetWebConnectionString()))
                        {
                            DataTable c = db.Select("select * from vw_entity_confirmations where enterprise_id = " + enterpriseID + " and  entity_id = " + entityId);
                            html += "<form id=\"serviceRecover\" name=\"serviceRecover\" method=\"post\" action=\"/consoleapi/recover2/\">";
                            if ((c != null) && (c.Rows.Count > 0))
                            {
                                html += "<div class=\"login_form\">";
                                html += "<input type=\"hidden\" name=\"do\" value=\"recover2\" />";
                                html += "<ul>";
                                html += "    <li>";
                                html += "        <p style=\"width:100%;padding:0 0 5px 0;color:#000;\">" + MessageResource.GetMessage("send_conf_to") + "</p>";
                                html += "    </li>";

                                foreach (DataRow dr in c.Rows)
                                {
                                    String data = LoginUser.MaskData(dr["value"].ToString(), (Boolean)dr["is_mail"], (Boolean)dr["is_sms"]);
                                    if (data != "")
                                    {
                                        html += "    <li><p style=\"width:400px;padding:0 0 5px 10px;color:#000;\"><input name=\"sentTo\" type=\"radio\" value=\"" + data + "\">" + data + "</p></li>";
                                    }
                                }

                                html += "    <li>";
                                html += "        <span class=\"forgot\"> <a href=\"/\">" + MessageResource.GetMessage("cancel") + "</a> " + MessageResource.GetMessage("or") + " </span>";
                                html += "            <button tabindex=\"4\" id=\"submitBtn\" class=\"action button floatright\">" + MessageResource.GetMessage("send_code") + "</button>";
                                html += "    </li>";
                                html += "</ul>     ";
                                html += "</div>";
                            }
                            else
                            {
                                html += "<div class=\"login_form\">";
                                html += "<input type=\"hidden\" name=\"do\" value=\"recover2\" />";
                                html += "<ul>";
                                html += "    <li>";
                                html += "        <p style=\"width:100%;padding:0 0 5px 0;color:#000;\">No method available</p>";
                                html += "    </li>";
                                html += "    <li>";
                                html += "        <span class=\"forgot\"> <a href=\"/\">" + MessageResource.GetMessage("cancel") + "</a></span>";
                                html += "    </li>";
                                html += "</ul>     ";
                                html += "</div>";
                            }
                            html += "</form>";
                        }

                        //ret = new WebJsonResponse("recover1.aspx");
                        ret = new WebJsonResponse("#recover_container", html);
                    }
                    else
                    {
                        ret = new WebJsonResponse("", err, 3000, true);
                    }
                }
                else
                {
                    ret = new WebJsonResponse("", err, 3000, true);
                }
            }
            catch (Exception ex)
            {
                Tools.Tool.notifyException(ex);
                throw ex;
            }


            if (ret != null)
            {
                ReturnHolder.Controls.Add(new LiteralControl(ret.ToJSON()));
            }
        }