예제 #1
0
        /// <summary>
        /// Handles the Click event of the btnConfirmarPassword 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 btnConfirmarPassword_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    propSeguridad.Usuario.PaswordPregunta = ObjSessionDataUI.ObjDTUsuario.PaswordPregunta;
                    propSeguridad.Usuario.PaswordRespuesta = ObjSessionDataUI.ObjDTUsuario.PaswordRespuesta;
                    propSeguridad.Usuario.PasswordNuevo = BLEncriptacion.Encrypt(txtPassword.Text.Trim());
                    // Ya que el nombre de usuario no lo tengo guardado (porque en el Page_Load de la Master me lo borro porque el
                    // HTTP.context era igual a null), provisoriamente lo guarda en una variable de sesion, para tenerlo disponible aqui
                    propSeguridad.Usuario.Nombre = (Session["userName"]).ToString();
                    objBLSeguridad = new BLSeguridad(propSeguridad);
                    objBLSeguridad.CambiarPassword(false);
                    HttpContext.Current.SkipAuthorization = true;
                    AccionPagina = enumAcciones.Salir;
                    FormsAuthentication.SetAuthCookie(objBLSeguridad.Data.Usuario.Nombre.Trim().ToLower(), false);

                    Master.MostrarMensaje(enumTipoVentanaInformacion.Satisfactorio.ToString(), UIConstantesGenerales.MensajeNuevoPassword, enumTipoVentanaInformacion.Satisfactorio);
                }
            }
            catch (Exception ex)
            {
                Master.ManageExceptions(ex);
            }
        }
예제 #2
0
        /// <summary>
        /// Handles the Click event of the btnConfirmarPassword 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 btnConfirmarPassword_Click(object sender, EventArgs e)
        {
            try
            {
                if (Page.IsValid)
                {
                    propSeguridad.Usuario.PaswordPregunta = ObjSessionDataUI.ObjDTUsuario.PaswordPregunta;
                    propSeguridad.Usuario.PaswordRespuesta = ObjSessionDataUI.ObjDTUsuario.PaswordRespuesta;
                    propSeguridad.Usuario.PasswordNuevo = txtPassword.Text.Trim();
                    objBLSeguridad = new BLSeguridad(propSeguridad);
                    objBLSeguridad.CambiarPassword();
                    HttpContext.Current.SkipAuthorization = true;
                    AccionPagina = enumAcciones.Salir;
                    FormsAuthentication.SetAuthCookie(objBLSeguridad.Data.Usuario.Nombre, false);

                    Master.MostrarMensaje(enumTipoVentanaInformacion.Satisfactorio.ToString(), UIConstantesGenerales.MensajeNuevoPassword, enumTipoVentanaInformacion.Satisfactorio);
                }
            }
            catch (Exception ex)
            {
                Master.ManageExceptions(ex);
            }
        }
예제 #3
0
        protected void ChangePasswordPushButton_Click(object sender, System.Web.UI.ImageClickEventArgs e)
        {
            try
            {
                DTSeguridad objDTSeguridad = new DTSeguridad
                {
                    Usuario =
                    {
                        Nombre = ObjSessionDataUI.ObjDTUsuario.Nombre,
                        Password = BLEncriptacion.Encrypt(ChangeUserPassword.CurrentPassword.Trim()),
                        PasswordNuevo = BLEncriptacion.Encrypt(ChangeUserPassword.NewPassword.Trim())
                    }
                };

                BLSeguridad objSeguridadBL = new BLSeguridad(objDTSeguridad);
                objSeguridadBL.CambiarPassword();
                Response.Redirect("~/Private/Account/ChangePasswordSuccess.aspx", false);
            }
            catch (Exception ex)
            {
                Master.ManageExceptions(ex);
            }
        }
예제 #4
0
        /// <summary>
        /// Handles the CreatedUser event of the RegisterUser 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 RegisterUser_CreatedUser(object sender, EventArgs e)
        {
            propSeguridad = new DTSeguridad();
            propSeguridad.Usuario.Nombre = RegisterUser.UserName.Trim();
            //Personal = 1,
            //Alumno = 2,
            //Tutor = 3
            DTRol rol = new DTRol();

            switch (propPersona.idTipoPersona)
            {
                case 1:
                    rol.Nombre = enumRoles.Administrativo.ToString();
                    break;
                case 2:
                    rol.Nombre = enumRoles.Alumno.ToString();
                    break;
                case 3:
                    rol.Nombre = enumRoles.Tutor.ToString();
                    break;
            }
            //asigna un rol por defecto, en función de la persona
            propSeguridad.Usuario.ListaRoles.Add(rol);
            propSeguridad.Usuario.Aprobado = true;
            propSeguridad.Usuario.EsUsuarioInicial = false;

            //encriptar la password
            propSeguridad.Usuario.PasswordNuevo = BLEncriptacion.Encrypt(RegisterUser.Password);
            propSeguridad.Usuario.Password = RegisterUser.Password;

            objBLSeguridad = new BLSeguridad(propSeguridad);
            objBLSeguridad.ActualizarUsuario();

            objBLSeguridad.CambiarPassword();

            //actualiza el nombre de usuario en la persona
            propPersona.username = propSeguridad.Usuario.Nombre;
            BLPersona objBLPersona = new BLPersona(propPersona);
            objBLPersona.Save();

            //loquea al usuario y lo redirecciona a la pagina de inicio de usuarios logueados
            Session.Abandon();
            FormsAuthentication.SignOut();
            FormsAuthentication.Initialize();
            FormsAuthentication.SetAuthCookie(propSeguridad.Usuario.Nombre, true /* createPersistentCookie */);
            ObjSessionDataUI.ObjDTUsuario = propSeguridad.Usuario;

            string continueUrl = RegisterUser.ContinueDestinationPageUrl;
            if (string.IsNullOrEmpty(continueUrl))
                continueUrl = "~/Private/Account/Welcome.aspx";
            Response.Redirect(continueUrl, false);
        }