Exemple #1
0
        /// <summary>
        /// Create new user. 
        /// </summary>
        /// <param name="sender">The object that raised this event.</param>
        /// <param name="e">An EventArgs that contains the event data.</param>
        protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
        {
            //Set status text to show nothing
            status_msg.Text = "";

            //Check if email is in correct form
            if (!Regex.IsMatch(RegisterUser.Email,
              @"^(?("")(""[^""]+?""@)|(([0-9a-zA-Z]((\.(?!\.))|[-!#\$%&'\*\+/=\?\^`\{\}\|~\w])*)(?<=[0-9a-zA-Z])@))" +
              @"(?(\[)(\[(\d{1,3}\.){3}\d{1,3}\])|(([0-9a-zA-Z][-\w]*[0-9a-zA-Z]\.)+[a-zA-Z]{2,6}))$"))
            {
                //Alert user what the error is
                status_msg.Text = "The email is invalid.";

                // Cancel the create user workflow
                e.Cancel = true;
            }
            //Check if user with the entered email already exists
            else if (Membership.GetUserNameByEmail(RegisterUser.Email) == RegisterUser.Email)
            {
                //Alert user what the error is
                duplicateUserMsg.Text = "A user with this email already exists. Please try again with a different email.";

                // Cancel the create user workflow
                e.Cancel = true;
            }
            else
            {
                //If everything is good, set email to be the creating username
                RegisterUser.UserName = RegisterUser.Email;
            }
        }
 protected void LoggingOut(object sender, LoginCancelEventArgs e)
 {
     Response.Cookies.Clear();
     FormsAuthentication.SignOut();
     this.Session["Redirection"] = 0;
     Response.Redirect("~/Pages/Index.aspx");
 }
Exemple #3
0
        protected void LoginControl_loggingIn(object sender, LoginCancelEventArgs e)
        {
            var login = sender as Login;

            if (login != null && login.UserName.IndexOf("\\") == -1)
            {
                var domain = (String.IsNullOrEmpty(this.DefaultDomain) ?
                    System.Web.Configuration.WebConfigurationManager.AppSettings["DefaultDomain"] :
                    this.DefaultDomain) ??
                    string.Empty;

                login.UserName = string.Concat(domain, "\\", login.UserName);
            }

            if (OnUserLoggingIn != null)
                OnUserLoggingIn(sender, e);

            if (login != null)
            {
                var info = new CancellableLoginInfo { UserName = login.UserName };
                LoginExtender.OnLoggingIn(info);
                e.Cancel = info.Cancel;
                login.UserName = info.UserName;
                _message = info.Message;
            }
        }
        /// <summary>
        /// Handles the CreatingUser event of the RegisterUser control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Web.UI.WebControls.LoginCancelEventArgs"/> instance containing the event data.</param>
        protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
        {
            App_Code.Controls.RecaptchaControl captcha =
                (App_Code.Controls.RecaptchaControl)RegisterUser.CreateUserStep.ContentTemplateContainer.FindControl("recaptcha") as App_Code.Controls.RecaptchaControl;

            if (Membership.GetUser(this.RegisterUser.UserName) != null)
            {
                e.Cancel = true;
                this.Master.SetStatus("warning", Resources.labels.anotherUserName);
            }
            else if (Membership.GetUserNameByEmail(this.RegisterUser.Email) != null)
            {
                e.Cancel = true;
                this.Master.SetStatus("warning", Resources.labels.anotherEmail);
            }
            else if (captcha != null)
            {
                captcha.Validate();

                if (!captcha.IsValid)
                {
                    e.Cancel = true;
                    this.Master.SetStatus("warning", "Captcha invalid.");
                }
            }
        }
Exemple #5
0
        protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
        {
            

            

        }
        protected void OnRegister(object sender, LoginCancelEventArgs e)
        {
            if (this.IsValid)
            {
                try
                {
                   Account account = new Account(tbxEmail.Text, tbxName.Text, AccountType.User);
                    if(accountManagement.CreateAccount(account, tbxPassword.Text))
                    {
                        Response.Redirect("/Login.aspx");
                    }
                    else
                    {
                        FailureText.Text = "Email is al bezet.";
                        e.Cancel = true;
                    }
                }
                catch
                {
                    FailureText.Text = "Account kon niet worden aan gemaakt.";
                    e.Cancel = true;
                }

            }
        }
Exemple #7
0
 protected void OnLoggingOut(object sender, LoginCancelEventArgs e)
 {
     string connectionString = ConfigurationManager.ConnectionStrings["BlogEntities"].ConnectionString;
     IUserRepository userRepository = new EFUserRepository(connectionString);
     ISecurityManager securityManager = new FormsSecurityManager(userRepository);
     securityManager.Logout();
 }
        protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
        {
            /*
            string trimmedUserName = RegisterUser.UserName.Trim();
            if (RegisterUser.UserName.Length != trimmedUserName.Length)
            {
                // Show the error message
                InvalidUserNameOrPasswordMessage.Text = "The username cannot contain leading or trailing spaces.";
                InvalidUserNameOrPasswordMessage.Visible = true;

                // Cancel the create user workflow
                e.Cancel = true;
            }
            else
            {
                // Username is valid, make sure that the password does not contain the username
                if (RegisterUser.Password.IndexOf(RegisterUser.UserName, StringComparison.OrdinalIgnoreCase) >= 0)
                {
                    // Show the error message
                    InvalidUserNameOrPasswordMessage.Text = "The username may not appear anywhere in the password.";
                    InvalidUserNameOrPasswordMessage.Visible = true;

                    // Cancel the create user workflow
                    e.Cancel = true;
                }
            }
            */
        }
 protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
 {
     Session["AccCls"] = null;
     Session.Abandon();
     Session.RemoveAll();
     Response.Redirect("~/pages/Login.aspx");
 }
		protected void loginTemplate_LoggingIn(object sender, LoginCancelEventArgs e) {
			if (FormsAuthentication.Authenticate(loginTemplate.UserName, loginTemplate.Password)) {
				FormsAuthentication.RedirectFromLoginPage(loginTemplate.UserName, false);
			} else {
				divMsg.Visible = true;
			}
		}
 protected void lgnGeneral_LoggingIn(object sender, LoginCancelEventArgs e)
 {
     if (Request.ServerVariables["REMOTE_USER"] != null)
     {
         Session["UserId"] = Util.ReturnUserId(Request.ServerVariables["REMOTE_USER"]);
     }
 }
 protected void cuwRegister_CreatingUser(object sender, LoginCancelEventArgs e)
 {
     if (cuwRegister.UserName !="") {
         DropDownList role = (DropDownList)cuwRegister.CreateUserStep.ContentTemplateContainer.FindControl("ddlRoles");
         Roles.AddUserToRole(cuwRegister.UserName, role.SelectedItem.Text);
     }
 }
Exemple #13
0
    protected void LoginStatus1_OnLoggingOut(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
    {
        Session.Abandon();
        Session.Clear();

        FormsAuthentication.SignOut();
        Response.Redirect(Request.RawUrl);
    }
 protected void prRecoverPassword_VerifyingUser1(object sender, LoginCancelEventArgs e)
 {
     if (prRecoverPassword.UserName.Contains("@"))
     {
         string username = Membership.GetUserNameByEmail(prRecoverPassword.UserName);
         if (!string.IsNullOrEmpty(username))
             prRecoverPassword.UserName = username;
     }
 }
 protected void LoginUser_LoggingIn(object sender, LoginCancelEventArgs e)
 {
     if (LoginUser.UserName.Contains("@"))
     {
         string username = Membership.GetUserNameByEmail(LoginUser.UserName);
         if (!string.IsNullOrEmpty(username))
             LoginUser.UserName = username;
     }
 }
Exemple #16
0
 protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
 {
     (Membership.Provider as CustomMembershipProvider).FirstName = (CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtFirstName") as TextBox).Text;
     (Membership.Provider as CustomMembershipProvider).LastName = (CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("txtLastName") as TextBox).Text;
     (Membership.Provider as CustomMembershipProvider).Address = string.Empty;
     (Membership.Provider as CustomMembershipProvider).City = string.Empty;
     (Membership.Provider as CustomMembershipProvider).Phone = string.Empty;
     (Membership.Provider as CustomMembershipProvider).UserType = (CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("cmbUserType") as DropDownList).SelectedItem.Text;
 }
Exemple #17
0
        /// <summary>
        /// Handles the CreateUser event of the CreateUserWizard1 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 CreatingUser(object sender, LoginCancelEventArgs e)
        {
            HIPControl captcha = (HIPControl)CreateUserWizardStep1.ContentTemplateContainer.FindControl("CapchaTest");

            if (!captcha.IsValid || !Page.IsValid)
            {
                e.Cancel = true;
            }
        }
Exemple #18
0
 /// <summary>
 /// Si el usuario cierra sesión desde la opcion 'Cerrar sesion' del header, 
 /// actualiza el 'Estatus' de 'En linea' a 'Fuera de linea'
 /// </summary>
 /// <param name="sender">object sender</param>
 /// <param name="e">Ext.Net.DirectEventArgs e</param>
 protected void HeadLoginStatus_LoggingOut(object sender, LoginCancelEventArgs e)
 {
     //  Verifica que la variable de sesion 'Ejecutivo' no sea nula 
     if (Session["Ejecutivo"] != null)
     {
         //  Cambia el estatus del usuario a fuera de linea al cerrar sesión
         GlobalOBD.EstatusUser((int)(Session["Ejecutivo"]), 4);
     }
 }
        protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
        {
            // Log out the current user
            FormsAuthentication.SignOut();

            Session.Abandon();

            // Redirect back to the homepage
            Response.Redirect("~/Default.aspx");
        }
    protected void OnCreatingUser(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
    {
        CreateUserWizard.UserName = CreateUserWizard.UserName.Trim().ToLower();

        if (!Util.IsValidEmail(CreateUserWizard.Email.Trim()))
        {
            Util.PageMessageAlertify(this, "The specified e-mail address is not valid, please try again with a valid address.<br/><br/>The user was not created.", "Invalid E-mail");
            e.Cancel = true;
        }
    }
Exemple #21
0
        void login_LoggingIn(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
        {
            string user = login.UserName;
            string pwrd = login.Password;
            SPSite site = SPContext.Current.Site;

            if (Membership.ValidateUser(user, pwrd))
            {
            }
        }
Exemple #22
0
 protected void OnLoggingIn(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
 {
     if (!IsValidEmail(Login1.UserName))
     {
         Login1.InstructionText = "You must enter a valid e-mail address.";
         e.Cancel = true;
     }
     else
     {
         Login1.InstructionText = String.Empty;
     }
 }
        protected void LoginStatus1_LoggingOut(object sender, LoginCancelEventArgs e)
        {
            Member member = BLL.Member.CurrentMember;
            member.IsOnLine = false;
            member.Save();

            IHubContext _Rcontext = GlobalHost.ConnectionManager.GetHubContext<ChatRoomHub>();
            _Rcontext.Clients.All.updateMember(member.MemberID, "IsOnline", false);

            // clear all session vars
            Session.Abandon();
        }
Exemple #24
0
 /// <summary>
 /// Handles the CreatingUser event of the RegisterUser control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Web.UI.WebControls.LoginCancelEventArgs"/> instance containing the event data.</param>
 protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
 {
     if (Membership.GetUser(this.RegisterUser.UserName) != null)
     {
         e.Cancel = true;
         this.Master.SetStatus("warning", Resources.labels.anotherUserName);
     }
     else if (Membership.GetUserNameByEmail(this.RegisterUser.Email) != null)
     {
         e.Cancel = true;
         this.Master.SetStatus("warning", Resources.labels.anotherEmail);
     }
 }
 /// <summary>
 /// Handles the CreatingUser event of the RegisterUser control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="System.Web.UI.WebControls.LoginCancelEventArgs"/> instance containing the event data.</param>
 protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
 {
     if (Membership.GetUser(this.RegisterUser.UserName) != null)
     {
         e.Cancel = true;
         this.Master.SetStatus("warning", "Please select another user name.");
     }
     else if (Membership.GetUserNameByEmail(this.RegisterUser.Email) != null)
     {
         e.Cancel = true;
         this.Master.SetStatus("warning", "Please select another email address.");
     }
 }
Exemple #26
0
 protected void OnLoggingIn(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
 {
     if (!IsValidEmail(Login1.UserName))
     {
         Login1.InstructionText = "Taper une adresse email valide.";
         Login1.InstructionTextStyle.ForeColor = System.Drawing.Color.RosyBrown;
         e.Cancel = true;
     }
     else
     {
         Login1.InstructionText = String.Empty;
     }
 }
Exemple #27
0
 protected void cuwReview_CreatingUser(object sender, LoginCancelEventArgs e)
 {
     CheckBox c = (CheckBox)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("cbxTandC");
     Label l = (Label)cuwReview.CreateUserStep.ContentTemplateContainer.FindControl("lblPleaseAgree");
     e.Cancel = !c.Checked;
     if (!c.Checked)
     {
         c.Focus();
         l.Visible = true;
     }
     else
         l.Visible = false;
 }
        protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
        {
            XDocument doc = XDocument.Load(Filepath);
            var newElement = new XElement("Person", new XElement("Username", CreateUserWizard1.UserName.Trim().ToString()), new XElement("Password", CreateUserWizard1.Password.Trim().ToString())
                , new XElement("ConfirmPassword", CreateUserWizard1.ConfirmPassword.Trim().ToString())
                , new XElement("Email", CreateUserWizard1.Email.Trim().ToString())
                , new XElement("Question", CreateUserWizard1.Question.Trim().ToString())
                , new XElement("Answer", CreateUserWizard1.Answer.Trim().ToString())

                );
            doc.Element("Persons").Add(newElement);
            doc.Save(Filepath);
        }
 protected void ChangePassword1_ChangingPassword(Object sender, LoginCancelEventArgs e)
 {
     if (ChangePassword1.CurrentPassword.ToString() == ChangePassword1.NewPassword.ToString())
     {
         LabelChangePassword.Visible = true;
         LabelChangePassword.Text = "Old password and new password must be different.  Please try again.";
         e.Cancel = true;
     }
     else
     {
         //This line prevents the error showing up after a first failed attempt.
         LabelChangePassword.Visible = false;
     }
 }
 protected void OnLoggingIn(object sender, LoginCancelEventArgs e)
 {
     if (SettingManager.GetSettingValueBoolean("Common.LoginCaptchaImageEnabled"))
     {
         var CaptchaCtrl = LoginForm.FindControl("CaptchaCtrl") as CaptchaControl;
         if (CaptchaCtrl != null)
         {
             if (!CaptchaCtrl.ValidateCaptcha())
             {
                 e.Cancel = true;
             }
         }
     }
 }
        protected void CreateUserWizard1_CreatingUser(object sender, LoginCancelEventArgs e)
        {
            //***********************************************************************************************************************************************
            //TODO: REMOVE IN PRODUCTION
            //TextBox UserNameTextBox = (TextBox)UserNameWizardStep.ContentTemplateContainer.FindControl("UserName");
            //MembershipUser mUser = Membership.GetUser(UserNameTextBox.Text);
            //if (mUser != null)
            //{
            //    object UserGUID = mUser.ProviderUserKey;

            //    Membership.DeleteUser(mUser.UserName);
            //}
            //***********************************************************************************************************************************************
        }
        protected void LoginCtrl_LoggingIn(object sender, LoginCancelEventArgs e)
        {
            try
            {
                string userName = (LoginCtrl.FindControl("UserName") as TextBox).Text;
                MembershipUser user = Membership.GetUser(userName);
                if(user!=null)
                    Session["CompanyCode"] = XBDataProvider.User.GetCompanyCodeByUserId(user.UserName);
            }
            catch(Exception ex)
            {

            }
        }
 protected void RegisterUser_CreatingUser(object sender, LoginCancelEventArgs e)
 {
     try
     {
         var companyNameTextbox = Page.Master.FindControl("MainContent").FindControl("RegisterUser").FindControl("CreateUserStepContainer").FindControl("CompanyName");
         _companyName = ((TextBox)companyNameTextbox).Text;
         _contactName = RegisterUser.UserName;
     }
     catch (Exception ex)
     {
         lblErrorMessage.Text = string.Format("An error has occured. Please tell tech support that you saw this: <br />{0}: {1}", ex.GetType(), ex.Message);
         e.Cancel = true;
     }
 }
Exemple #34
0
        protected void LoginUser_LoggingIn(object sender, LoginCancelEventArgs e)
        {
            //Dictionary<string, DateTime> activeUsers = (Dictionary<string, DateTime>)Application["activeUsers"];

            //if (activeUsers.ContainsKey(LoginUser.UserName))
            //{
            //    e.Cancel = true;
            //    this.LoginUser.FailureText = "Ya ingresaste";
            //}
            if (SessionMannager.Any_ActiveSession(LoginUser.UserName))
            {
                e.Cancel = true;
                this.LoginUser.FailureText = "Ya ingresaste desde otra ubicacion";
            }
        }
        protected void changePassword_ChangingPassword(object sender, LoginCancelEventArgs e)
        {
            e.Cancel = true;

            string newPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(this.changePassword.NewPassword, "SHA1");

            Configuration webConfig;
            AuthenticationSection authenticationSection = this.GetFormsAuthConfig(out webConfig);

            authenticationSection.Forms.Credentials.PasswordFormat = FormsAuthPasswordFormat.SHA1;
            authenticationSection.Forms.Credentials.Users[0].Password = newPassword;

            webConfig.Save();

            this.Response.Redirect(this.Request.Url.ToString());
        }
Exemple #36
0
        protected void OnLoggingIn(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
        {
            string query = "SELECT customer.id, customer.full_name, customer.nric, customer.registration_date, customer.phone, account.balance FROM customer INNER JOIN account ON customer.id = account.owner WHERE customer.username = @username AND customer.password = @password";

            TextBox UserName = Login1.FindControl("UserName") as TextBox;
            TextBox Password = Login1.FindControl("Password") as TextBox;

            using (SqlConnection con = new SqlConnection(ConnectionString))
            {
                con.Open();

                SqlCommand cmd = new SqlCommand(query, con);
                cmd.Parameters.AddWithValue("@username", UserName.Text);
                cmd.Parameters.AddWithValue("@password", Password.Text);

                using (SqlDataReader reader = cmd.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        Session["id"]        = reader["id"];
                        Session["full_name"] = reader["full_name"];
                        Session["nric"]      = reader["nric"];
                        Session["reg_date"]  = reader["registration_date"];
                        Session["phone"]     = reader["phone"];
                        Session["balance"]   = reader["balance"];
                        Response.Redirect("/Details.aspx");
                    }
                }
            }

            // When RememberMe checkbox is checked, set session timeout to 525600 minutes (1 year), longest period available for ASP .NET
            CheckBox rmbMe = Login1.FindControl("RememberMe") as CheckBox;

            if (rmbMe.Checked)
            {
                Session.Timeout = 525600;
            }
        }
 protected void CreateUserForm_CreatingUser(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
 {
 }
Exemple #38
0
 /// <summary>
 /// Called when [logging in].
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="T:System.Web.UI.WebControls.LoginCancelEventArgs"/> instance containing the event data.</param>
 protected void OnLoggingIn(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
 {
 }
Exemple #39
0
 protected void LoginStatus1_OnLoggingOut(object sender, System.Web.UI.WebControls.LoginCancelEventArgs e)
 {
     Session.Abandon();
     Session.Clear();
 }