Exemplo n.º 1
0
    private void Login1_LoggedIn(object sender, EventArgs e)
    {
        // ScreenLock - unlock screen
        IsScreenLocked = false;

        // Ensure response cookie
        CookieHelper.EnsureResponseCookie(FormsAuthentication.FormsCookieName);

        // Set cookie expiration
        if (Login1.RememberMeSet)
        {
            CookieHelper.ChangeCookieExpiration(FormsAuthentication.FormsCookieName, DateTime.Now.AddYears(1), false);
        }
        else
        {
            // Extend the expiration of the authentication cookie if required
            if (!AuthenticationHelper.UseSessionCookies && (HttpContext.Current != null) && (HttpContext.Current.Session != null))
            {
                CookieHelper.ChangeCookieExpiration(FormsAuthentication.FormsCookieName, DateTime.Now.AddMinutes(Session.Timeout), false);
            }
        }

        // Current username
        string userName = Login1.UserName;

        // Get info on the authenticated user
        UserInfo ui = UserInfo.Provider.Get(userName);

        // Check whether safe user name is required and if so get safe username
        if (ui == null && AuthenticationMode.IsMixedAuthentication() && UserInfoProvider.UseSafeUserName)
        {
            userName = ValidationHelper.GetSafeUserName(userName, SiteContext.CurrentSiteName);

            AuthenticationHelper.AuthenticateUser(userName, Login1.RememberMeSet);
        }

        // Set culture
        CMSDropDownList drpCulture = (CMSDropDownList)Login1.FindControl("drpCulture");

        if (drpCulture != null)
        {
            string selectedCulture = drpCulture.SelectedValue;

            // Not the default culture
            if (selectedCulture != "")
            {
                // Update the user
                if (ui != null)
                {
                    ui.PreferredUICultureCode = selectedCulture;
                    UserInfo.Provider.Set(ui);
                }

                // Update current user
                MembershipContext.AuthenticatedUser.PreferredUICultureCode = selectedCulture;
            }
        }

        URLHelper.LocalRedirect(ReturnUrl);
    }
Exemplo n.º 2
0
    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        TextBox  uname    = (TextBox)Login1.FindControl("UserName");
        TextBox  pword    = (TextBox)Login1.FindControl("Password");
        CheckBox remember = (CheckBox)Login1.FindControl("RememberMe");

        if (remember != null)
        {
            Login1.RememberMeSet = remember.Checked;
        }
        e.Authenticated = Membership.ValidateUser(_username, pword.Text);

        SnitzCaptchaControl ct = (SnitzCaptchaControl)Login1.FindControl("CAPTCHA");

        if (ct != null)
        {
            if (ct.Visible)
            {
                e.Authenticated = e.Authenticated && ct.IsValid;
            }
        }
        //set the return url
        if (e.Authenticated && !String.IsNullOrEmpty(returnurl) && !returnurl.ToLower().Contains("login"))
        {
            Login1.DestinationPageUrl = returnurl;
        }
    }
Exemplo n.º 3
0
    /// <summary>
    /// Handles the Load event of the Page control.
    /// </summary>
    /// <param name="sender">The source of the event.</param>
    /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString.ToString() == "logoff")
        {
            FormsAuthentication.SignOut();
            if (Request.UrlReferrer != null && Request.UrlReferrer != Request.Url)
            {
                Response.Redirect(Request.UrlReferrer.ToString(), true);
            }
            else
            {
                Response.Redirect("login.aspx");
            }
        }

        if (Page.User.Identity.IsAuthenticated)
        {
            changepassword1.Visible              = true;
            changepassword1.ContinueButtonClick += new EventHandler(changepassword1_ContinueButtonClick);
            lsLogout.Visible = true;
            Login1.Visible   = false;
            Page.Title       = Resources.labels.changePassword;
        }
        else
        {
            Login1.LoggingIn += new LoginCancelEventHandler(Login1_LoggingIn);
            Login1.LoggedIn  += new EventHandler(Login1_LoggedIn);
            Login1.FindControl("username").Focus();
        }
    }
Exemplo n.º 4
0
        public void Button1_Click(object sender, EventArgs e)
        {
            //string pass = password.Text;
            //string user = username.Text;
            // string user = this.username.Text;
            string pass = ((TextBox)Login1.FindControl("Password")).Text;
            string user = ((TextBox)Login1.FindControl("UserName")).Text;

            if (user == "" || pass == "")
            {
                ShowMessage("Empty Fields Detected ! Please fill up all the fields");
                return;
            }
            bool r = validate_login(user, pass);

            if (r)
            {
                Session["username"] = ((TextBox)Login1.FindControl("UserName")).Text;
                //ShowMessage("Correct Login Credentials" + Session["email"]);
                Response.Redirect("Cust_Info.aspx");
            }
            else
            {
                ShowMessage("Incorrect Login Credentials");
            }
        }
Exemplo n.º 5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Workaround for the stupid telerik "light" callback.
            // http://www.telerik.com/help/aspnet/combobox/combo_iscallback.html
            bool isComboCallBack = (_userNameCombo != null && _userNameCombo.IsCallBack);

            if (!IsPostBack && !isComboCallBack)
            {
                if (Request.QueryString["Logout"] != null)
                {
                    FormsAuthentication.SignOut();
                    Roles.DeleteCookie();
                    Cache[Globals.CacheKeys.ODS] = DateTime.Now.ToString();

                    Response.Redirect("Logon.aspx");
                }
                else
                {
                    Button loginButton = Login1.FindControl("LoginButton") as Button;
                    if (loginButton != null)
                    {
                        Page.Form.DefaultButton = loginButton.UniqueID;
                    }

                    InitOrganisation(false);
                }
            }
        }
    /// <summary>
    /// Handling login authenticate event.
    /// </summary>
    /// <param name="sender">Sender.</param>
    /// <param name="e">Authenticate event arguments.</param>
    private void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        if (MFAuthenticationHelper.IsMultiFactorRequiredForUser(Login1.UserName))
        {
            var plcPasscodeBox = Login1.FindControl("plcPasscodeBox");
            var plcLoginInputs = Login1.FindControl("plcLoginInputs");
            var txtPasscode    = Login1.FindControl("txtPasscode") as CMSTextBox;

            if (txtPasscode == null)
            {
                return;
            }
            if (plcPasscodeBox == null)
            {
                return;
            }
            if (plcLoginInputs == null)
            {
                return;
            }

            // Handle passcode
            string passcode = txtPasscode.Text;
            txtPasscode.Text = string.Empty;

            var provider = new CMSMembershipProvider();

            // Validate username and password
            if (plcLoginInputs.Visible)
            {
                if (provider.MFValidateCredentials(Login1.UserName, Login1.Password))
                {
                    // Show passcode screen
                    plcLoginInputs.Visible = false;
                    plcPasscodeBox.Visible = true;
                }
            }
            // Validate passcode
            else
            {
                if (provider.MFValidatePasscode(Login1.UserName, passcode))
                {
                    e.Authenticated = true;
                }
            }
        }
        else
        {
            try
            {
                e.Authenticated = Membership.Provider.ValidateUser(Login1.UserName, Login1.Password);
            }
            catch (ConfigurationException ex)
            {
                EventLogProvider.LogException("LogonPage", "VALIDATEUSER", ex);
                var provider = new CMSMembershipProvider();
                e.Authenticated = provider.ValidateUser(Login1.UserName, Login1.Password);
            }
        }
    }
    /// <summary>
    /// Load UI cultures for the dropdown list.
    /// </summary>
    private void LoadCultures()
    {
        CMSDropDownList drpCulture = (CMSDropDownList)Login1.FindControl("drpCulture");

        if (drpCulture != null)
        {
            DataSet  ds         = CultureInfoProvider.GetUICultures();
            DataView dvCultures = ds.Tables[0].DefaultView;
            dvCultures.Sort = "CultureName ASC";

            drpCulture.DataValueField = "CultureCode";
            drpCulture.DataTextField  = "CultureName";
            drpCulture.DataSource     = dvCultures;
            drpCulture.DataBind();

            // Add default value
            drpCulture.Items.Insert(0, new ListItem(GetString("LogonForm.DefaultCulture"), ""));

            LocalizedLabel lblCulture = (LocalizedLabel)Login1.FindControl("lblCulture");
            if (lblCulture != null)
            {
                lblCulture.AssociatedControlID = drpCulture.ID;
                lblCulture.Text    = GetString("general.select");
                lblCulture.Display = false;
            }
        }
    }
Exemplo n.º 8
0
    void Login1_LoggedIn(object sender, EventArgs e)
    {
        HttpCookie cookie = this.Response.Cookies[FormsAuthentication.FormsCookieName];

        UserManager.Default.SetAuthenticationCookie(cookie);

        string redirectUrl = Request.QueryString["ReturnUrl"];

        if (string.IsNullOrEmpty(redirectUrl))
        {
            string loggedInUser = ((TextBox)Login1.FindControl("UserName")).Text;

            redirectUrl = PersonalizationManager.DefaultInstance.GetGlobalValue <string>(loggedInUser, GlobalSettingConstants.StartPage);

            if (string.IsNullOrEmpty(redirectUrl))
            {
                redirectUrl = this.Login1.DestinationPageUrl;
            }
        }
        else
        {
            redirectUrl = HttpUtility.UrlDecode(redirectUrl);
        }

        this.Page.Response.Redirect(redirectUrl, true);
    }
Exemplo n.º 9
0
    /// <summary>
    /// Handle authentication.
    /// </summary>
    /// <param name="sender"></param>
    /// <param name="e"></param>
    protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
    {
        HttpContext.Current.Session.Clear();
        HttpContext.Current.User = null;

        NVFRAuth(Login1.UserName, Login1.Password);

        if (Authenticated)
        {
            //Set cookies to remember user login, will not store password information
            //user will have to enter password each time the page is visited
            CheckBox Remember = (CheckBox)Login1.FindControl("RememberMe");


            if (Remember.Checked)
            {
                HttpCookie aCookie = new HttpCookie("userInfo");
                aCookie.Values["UserName"] = Login1.UserName;
                aCookie.Expires            = DateTime.Now.AddDays(10);
                Response.Cookies.Add(aCookie);
            }



            return;
        }
        e.Authenticated = false;
    }
Exemplo n.º 10
0
    protected void Page_Load(object sender, EventArgs e)
    {
        AppConfig.initialize();
        EmployeeProfile emp = (EmployeeProfile)Session["EmployeeProfile"];

        if (null == emp)
        {
            emp         = new EmployeeProfile();
            emp.Domain  = AppConfig.Domain;
            emp.Machine = GetIPAddress();
            Session["EmployeeProfile"] = emp;
        }
        Login1.TitleText = "Employee Attendance Generator v1.0";
        TextBox TextBox1 = (TextBox)Login1.FindControl("Machine");

        if (null != TextBox1 && string.IsNullOrEmpty(TextBox1.Text))
        {
            TextBox1.Text = GetIPAddress();
        }
        if (string.IsNullOrEmpty(Login1.UserName))
        {
            Login1.UserName = emp.Name;
        }
        if (!string.IsNullOrEmpty(AppConfig.UserName) &&
            !string.IsNullOrEmpty(AppConfig.Password))
        {
            Session["autologin"]      = true;
            emp.Name                  = AppConfig.UserName;
            emp.Password              = AppConfig.Password;
            Session["EventLogReader"] = createEventQuery(emp);
            FormsAuthentication.RedirectFromLoginPage(
                String.Format("{0}@{1}", emp.Name, emp.Machine), true);
        }
    }
Exemplo n.º 11
0
    /// <summary>
    /// On page load, set focus to the user name input. Declare session variables.
    /// </summary>
    /// <param name="sender">page load</param>
    /// <param name="e">event data</param>
    protected void Page_Load(object sender, EventArgs e)
    {
        SetFocus(Login1.FindControl("UserName"));

        Session["access"]   = "";
        Session["personID"] = "";
    }
Exemplo n.º 12
0
        protected void Login1_Authenticate(object sender, AuthenticateEventArgs e)
        {
            Label linkCOnfirmError = Login1.FindControl("linkCOnfirmError") as Label;

            if (WebSecurity.UserExists(Login1.UserName))
            {
                if (!WebSecurity.IsConfirmed(Login1.UserName))
                {
                    linkCOnfirmError.Visible = true;
                    Login1.FailureText       = "";
                    e.Authenticated          = false;
                }
                else
                {
                    CheckBox RememberMe = Login1.FindControl("RememberMe") as CheckBox;
                    if (WebSecurity.Login(Login1.UserName, Login1.Password, RememberMe.Checked))
                    {
                        e.Authenticated = true;
                    }
                    else
                    {
                        e.Authenticated    = false;
                        Login1.FailureText = "Incorrect username or password";
                    }
                }
            }
            else
            {
                e.Authenticated          = false;
                linkCOnfirmError.Visible = false;
                Login1.FailureText       = "Username is not registered";
            }
        }
Exemplo n.º 13
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Page.Title = "Reward Login";
            if (WebSecurity.IsAuthenticated)
            {
                if (Session != null)
                {
                    Response.Redirect("UserAsses.aspx");
                }
                else
                {
                    WebSecurity.Logout();
                }
            }
            HyperLink RegisterHyperLink = Login1.FindControl("RegisterHyperLink") as HyperLink;

            RegisterHyperLink.NavigateUrl = "~/Registration";
            //OpenAuthLogin.ReturnUrl = Request.QueryString["ReturnUrl"];

            var returnUrl = HttpUtility.UrlEncode(Request.QueryString["ReturnUrl"]);

            if (!String.IsNullOrEmpty(returnUrl))
            {
                RegisterHyperLink.NavigateUrl += "?ReturnUrl=" + returnUrl;
            }
        }
Exemplo n.º 14
0
    protected void Login1_LoggingIn(object sender, LoginCancelEventArgs e)
    {
        try
        {
            MembershipUser mu = Membership.GetUser(Login1.UserName);
            if (mu != null)
            {
                if (Roles.GetRolesForUser(Login1.UserName).Contains("Admin"))
                {
                    ((Literal)Login1.FindControl("FailureText")).Text = "هذا الحساب غير فعال";
                    e.Cancel = true;
                    return;
                }

                OnlineSchoolEntities km = new OnlineSchoolEntities();

                var emp        = (from k in km.Employees where k.IdentityNumber.Trim() == mu.UserName select k).FirstOrDefault();
                var userSchool = (from k in km.Schools where k.Id == emp.SchoolId select k).FirstOrDefault();

                if (userSchool != null && userSchool.IsActive == false)
                {
                    ((Literal)Login1.FindControl("FailureText")).Text = "تم ايقاف اشتراك المدرسة";
                    e.Cancel = true;
                }
            }
        }catch (Exception exx)
        {
            ((Literal)Login1.FindControl("FailureText")).Text = "هذا الحساب غير فعال";
            e.Cancel = true;
        }
    }
Exemplo n.º 15
0
        protected void Login1_LoggedIn(object sender, EventArgs e)
        {
            SqlConnection conn = new SqlConnection("Data Source=(LocalDB)\\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\\ArtworkGallery.mdf;Integrated Security=SSPI");
            SqlCommand    cmd;
            SqlDataReader reader;

            TextBox tbName = (TextBox)Login1.FindControl("UserName");

            conn.Open();
            Guid   userID = new Guid();
            String role   = "";

            cmd = new SqlCommand("select aspnet_Users.UserId, aspnet_Roles.RoleName from aspnet_Users inner join aspnet_UsersInRoles on " +
                                 "aspnet_Users.UserId = aspnet_UsersInRoles.UserId inner join aspnet_Roles on " +
                                 "aspnet_Roles.RoleId = aspnet_UsersInRoles.RoleId where aspnet_Users.UserName='******'", conn);
            reader = cmd.ExecuteReader();
            while (reader.Read())
            {
                userID = (Guid)reader.GetValue(0);
                role   = (String)reader.GetValue(1);
            }
            conn.Close();

            Session["UserID"]   = userID.ToString();
            Session["Username"] = tbName.Text;
            Session["Role"]     = role;
        }
Exemplo n.º 16
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            Panel pnlLogoutControl = (Panel)Login1.FindControl("pnlLogoutControl");
            pnlLogoutControl.Visible = false;
            Panel pnlLoginControl = (Panel)Login1.FindControl("pnlLoginControl");
            pnlLoginControl.Visible = true;
            Label          lblUsername = (Label)pnlLogoutControl.FindControl("lblUsername");
            MembershipUser user        = null;
            if (Login1.UserName != null && Login1.UserName.Length > 0)
            {
                MembershipUserCollection users = Membership.FindUsersByName(Login1.UserName);
                user = users[Login1.UserName];
            }

            if (user != null)
            {
                // show logout button
                pnlLogoutControl.Visible = true;
                pnlLoginControl.Visible  = false;
                lblUsername.Text         = user.UserName;
            }
            else if (User.Identity.IsAuthenticated)
            {
                // show logout button
                pnlLogoutControl.Visible = true;
                pnlLoginControl.Visible  = false;
                lblUsername.Text         = User.Identity.Name;
            }
        }
    }
    private void btnItem_Click(object sender, EventArgs e)
    {
        // Check if should send password
        if (IsForgottenPassword)
        {
            SetForgottenPasswordMode();

            TextBox txtUserName = (TextBox)Login1.FindControl("UserName");
            var     email       = "";
            if (txtUserName != null)
            {
                email = txtUserName.Text.Trim();
            }

            if (!string.IsNullOrEmpty(email) && ValidationHelper.IsEmail(email))
            {
                // Reset password
                string siteName = SiteContext.CurrentSiteName;

                // Prepare URL to which may user return after password reset
                string returnUrl = RequestContext.CurrentURL;
                if (!string.IsNullOrEmpty(Login1.UserName))
                {
                    returnUrl = URLHelper.AddParameterToUrl(returnUrl, "username", Login1.UserName);
                }

                AuthenticationHelper.ForgottenEmailRequest(email, siteName, "Logon page", SettingsKeyInfoProvider.GetValue(siteName + ".CMSSendPasswordEmailsFrom"), null, AuthenticationHelper.GetResetPasswordUrl(siteName), returnUrl);
                DisplayInformation(String.Format(GetString("LogonForm.EmailSent"), email));
            }
            else
            {
                DisplayError(GetString("LogonForm.EmailNotValid"));
            }
        }
    }
    /// <summary>
    /// Sets SkinId to all controls in logon form.
    /// </summary>
    private void SetSkinID(string skinId)
    {
        if (skinId != "")
        {
            Login1.SkinID = skinId;

            var controlNames = new string[]
            {
                "lblUserName",
                "lblPassword",
                "UserName",
                "Password",
                "chkRememberMe",
                "LoginButton"
            };

            foreach (string controlName in controlNames)
            {
                var control = Login1.FindControl(controlName);
                if (control != null)
                {
                    control.SkinID = skinId;
                }
            }
        }
    }
Exemplo n.º 19
0
        protected void public_Click(object sender, EventArgs e)
        {
            string user    = Context.User.Identity.GetUserName();
            string message = ((TextBox)Login1.FindControl("UserName")).Text;

            this.KomentariServices.AddCommentForTeam(user, message, "totthnam");
            ((TextBox)Login1.FindControl("UserName")).Text = "";
        }
Exemplo n.º 20
0
 protected void Page_Load(object sender, EventArgs e)
 {
     SetFocus(Login1.FindControl("Password"));
     if (!IsPostBack)
     {
         Login1.UserName = "******";
     }
 }
Exemplo n.º 21
0
    private void Login1_LoginError(object sender, EventArgs e)
    {
        bool showError = true;

        if (FailureLabel != null)
        {
            if (AuthenticationHelper.DisplayAccountLockInformation(SiteContext.CurrentSiteName) && MembershipContext.UserAccountLockedDueToInvalidLogonAttempts)
            {
                DisplayAccountLockedError(GetString("invalidlogonattempts.unlockaccount.accountlocked"));
            }
            else if (AuthenticationHelper.DisplayAccountLockInformation(SiteContext.CurrentSiteName) && MembershipContext.UserAccountLockedDueToPasswordExpiration)
            {
                DisplayAccountLockedError(GetString("passwordexpiration.accountlocked"));
            }
            else if (MembershipContext.UserIsPartiallyAuthenticated && !MembershipContext.UserAuthenticationFailedDueToInvalidPasscode)
            {
                if (MembershipContext.MFAuthenticationTokenNotInitialized && MFAuthenticationHelper.DisplaySetupCode)
                {
                    var lblTokenID   = Login1.FindControl("lblTokenID") as LocalizedLabel;
                    var plcTokenInfo = Login1.FindControl("plcTokenInfo");

                    if ((lblTokenID != null) && (plcTokenInfo != null))
                    {
                        DisplayWarning(string.Format("<strong>{0}</strong> {1}", GetString("mfauthentication.isRequired"), GetString("mfauthentication.token.get")));

                        lblTokenID.Text      = MFAuthenticationHelper.GetSetupCodeForUser(Login1.UserName);
                        plcTokenInfo.Visible = true;
                    }
                }

                showError = false;
            }
            else if (!MembershipContext.UserIsPartiallyAuthenticated)
            {
                // Show login and password screen
                var plcPasscodeBox = Login1.FindControl("plcPasscodeBox");
                var plcLoginInputs = Login1.FindControl("plcLoginInputs");
                var plcTokenInfo   = Login1.FindControl("plcTokenInfo");
                if (plcLoginInputs != null)
                {
                    plcLoginInputs.Visible = true;
                }
                if (plcPasscodeBox != null)
                {
                    plcPasscodeBox.Visible = false;
                }
                if (plcTokenInfo != null)
                {
                    plcTokenInfo.Visible = false;
                }
            }

            if (showError && string.IsNullOrEmpty(FailureLabel.Text))
            {
                DisplayError(GetString("Login_FailureText"));
            }
        }
    }
Exemplo n.º 22
0
    /// <summary>
    /// Sets forgotten password mode.
    /// </summary>
    private void SetForgottenPasswordMode()
    {
        LocalizedButton btnItem = (LocalizedButton)Login1.FindControl("LoginButton");

        if (btnItem != null)
        {
            btnItem.ResourceString = "LogonForm.SendRequest";
            btnItem.CommandName    = string.Empty;
        }

        TextBox txtPassword = (TextBox)Login1.FindControl("Password");

        if (txtPassword != null)
        {
            txtPassword.Visible = false;
        }

        LocalizedLabel lblItem = (LocalizedLabel)Login1.FindControl("lblPassword");

        if (lblItem != null)
        {
            lblItem.Visible = false;
        }

        CheckBox chkRemeber = (CheckBox)Login1.FindControl("chkRememberMe");

        if (chkRemeber != null)
        {
            chkRemeber.Visible = false;
        }

        LocalizedLabel lblLogOn = (LocalizedLabel)Login1.FindControl("lblLogOn");

        if (lblLogOn != null)
        {
            lblLogOn.ResourceString = "logonform.lnkpasswordretrieval";
        }

        LocalizedLabel lblUserName = (LocalizedLabel)Login1.FindControl("lblUserName");

        if (lblUserName != null)
        {
            lblUserName.ResourceString = "logonform.lblpasswordretrieval";
        }

        ImageButton lnkPassword = (ImageButton)Login1.FindControl("lnkPassword");

        if (lnkPassword != null)
        {
            lnkPassword.ToolTip = GetString("logonform.logonbutton");
        }

        tablePadding = "TablePadding";
        labelClass  += " PasswordLabel";

        IsForgottenPassword = true;
    }
Exemplo n.º 23
0
        protected void Login1_LoggedIn(object sender, EventArgs e)
        {
            TextBox usernameTextBox = (TextBox)Login1.FindControl("UserName");

            if (usernameTextBox != null)
            {
                Session["username"] = usernameTextBox.Text;
            }
        }
Exemplo n.º 24
0
    protected void Page_Load(object sender, EventArgs e)
    {
        string oauth_token    = Request.QueryString["oauth_token"];
        string oauth_verifier = Request.QueryString["oauth_verifier"];

        if (oauth_token != null && oauth_verifier != null)
        {
            Application["oauth_token"]    = oauth_token;
            Application["oauth_verifier"] = oauth_verifier;
            Response.Redirect("LinkedInAccountDetails.aspx?oauth_verifier=" + oauth_verifier + "");
        }

        if (!IsPostBack)
        {
            //////svn
            string login = "";
            try
            {
                login = Request.QueryString["Login"].ToString();
            }
            catch
            {
                login = "";
            }
            if (Request.Cookies["myScrlCookie"] != null)
            {
                HttpCookie myScrlCookie = new HttpCookie("myScrlCookie");
                myScrlCookie    = Request.Cookies.Get("myScrlCookie");
                Login1.UserName = myScrlCookie.Values["UserName"].ToString();
                TextBox txtbox = (TextBox)Login1.FindControl("Password");
                txtbox.Attributes["Value"] = myScrlCookie.Values["Password"].ToString();

                DataTable dt = new DataTable();
                objLogin.Username = Login1.UserName;
                objLogin.Password = txtbox.Attributes["Value"];
                dt = objLoginDB.GetDataSet(objLogin, DA_SKORKEL.DA_Login.Login_1.UserLogin);

                if (dt.Rows.Count > 0)
                {
                    if (login == "")
                    {
                        UserSession.UserInfo UInfo = new UserSession.UserInfo();
                        string LoginName           = Convert.ToString(dt.Rows[0]["LoginName"]);
                        UInfo.UserName = Convert.ToString(dt.Rows[0]["vchrUserName"]);
                        UInfo.UserID   = Convert.ToInt64(dt.Rows[0]["intRegistrationId"]);
                        int TypeId = Convert.ToInt32(dt.Rows[0]["intUserTypeID"]);
                        Session.Add("UserTypeId", TypeId);

                        Session.Add("UInfo", UInfo);
                        Session.Add("LoginName", LoginName);
                        Session.Add("ExternalUserId", Convert.ToString(dt.Rows[0]["intRegistrationId"]));
                        //Response.Redirect("Home.aspx");
                    }
                }
            }
        }
    }
Exemplo n.º 25
0
    /// <summary>
    /// Displays error.
    /// </summary>
    /// <param name="msg">Message.</param>
    private void DisplayError(string msg)
    {
        var failureLit = Login1.FindControl("FailureText") as LocalizedLabel;

        if (failureLit != null)
        {
            failureLit.Text    = msg;
            failureLit.Visible = !string.IsNullOrEmpty(msg);
        }
    }
Exemplo n.º 26
0
    /// <summary>
    /// Displays locked account error message.
    /// </summary>
    /// <param name="specificMessage">Specific part of the message.</param>
    private void DisplayAccountLockedError(string specificMessage)
    {
        var failureLabel = Login1.FindControl("FailureText") as LocalizedLabel;

        if (failureLabel != null)
        {
            string link = "<a href=\"#\" onclick=\"" + Page.ClientScript.GetCallbackEventReference(this, "null", "UpdateLabel_" + ClientID, "'" + failureLabel.ClientID + "'") + ";\">" + GetString("general.clickhere") + "</a>";
            DisplayError(string.Format(specificMessage + " " + GetString("invalidlogonattempts.unlockaccount.accountlockedlink"), link));
        }
    }
Exemplo n.º 27
0
    /// <summary>
    /// Displays error.
    /// </summary>
    /// <param name="msg">Message.</param>
    private void DisplayError(string msg)
    {
        var plcError = Login1.FindControl("plcError");

        if (plcError != null)
        {
            FailureLabel.Text = msg;
            plcError.Visible  = !string.IsNullOrEmpty(msg);
        }
    }
Exemplo n.º 28
0
    private void Login1_LoggingIn(object sender, LoginCancelEventArgs e)
    {
        // Ensure all cookies
        if (CookieHelper.CurrentCookieLevel <= CookieLevel.All)
        {
            CookieHelper.ChangeCookieLevel(CookieLevel.All);
        }

        Login1.RememberMeSet = ((CMSCheckBox)Login1.FindControl("chkRememberMe")).Checked;
    }
Exemplo n.º 29
0
    protected override void OnPreRender(EventArgs e)
    {
        base.OnPreRender(e);
        string script = "var txtBox = '" + Login1.FindControl("UserName").ClientID + "';";

        this.Page.ClientScript.RegisterStartupScript(
            this.GetType(),
            "focus",
            script, true);
    }
Exemplo n.º 30
0
    /// <summary>
    /// Display invalid logon attempts.
    /// </summary>
    private string GetLogonAttemptsUnlockingLink()
    {
        LocalizedLabel failureLit = Login1.FindControl("FailureText") as LocalizedLabel;

        if (failureLit == null)
        {
            return(string.Empty);
        }
        return("<a href=\"#\" onclick=\"" + Page.ClientScript.GetCallbackEventReference(this, "null", "UpdateLabel_" + ClientID, "'" + failureLit.ClientID + "'") + ";\">" + GetString("general.clickhere") + "</a>");
    }