protected void BuildAccessControlledSelection()
 {
     StringBuilder sb = new StringBuilder();
     RoleController _role = new RoleController();
     string[] roles = _role.GetRoleNames(GetUsername, GetPortalID).ToLower().Split(',');
     if (roles.Contains(SystemSetting.SUPER_ROLE[0].ToLower()))
     {
         sb.Append("<label>");
         sb.Append("<input id='rdbPages' type='radio' name='rdbMenuItem' value='0' />");            
         sb.Append("Pages</label>");
         sb.Append("<label>");
         sb.Append("<input id='rdbExternalLink' type='radio' name='rdbMenuItem' value='2' />");            
         sb.Append("External Link</label>");
     }
     else
     {
         sb.Append("<label>");
         sb.Append("<input id='rdbPages' type='radio' name='rdbMenuItem' value='0' />");            
         sb.Append("Pages</label>");
         sb.Append("<label>");
         sb.Append("<input id='rdbExternalLink' type='radio' name='rdbMenuItem' value='2' />");            
         sb.Append("External Link</label>");
     }
     ltrMenuRadioButtons.Text = sb.ToString();
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     IncludeLanguageJS();
     appPath = GetApplicationName;
     userName = SecurityPolicy.GetUser(GetPortalID);
     Extension = SageFrameSettingKeys.PageExtension;
     if (!IsPostBack)
     {
         // BindThemes();
         //BindLayouts();
         //BindValues();
         hlnkDashboard.Visible = false;
         SageFrameConfig conf = new SageFrameConfig();
         string ExistingPortalShowProfileLink = conf.GetSettingsByKey(SageFrameSettingKeys.PortalShowProfileLink);
         lnkAccount.NavigateUrl = GetProfileLink();
         if (ExistingPortalShowProfileLink == "1")
         {
         }
         else
         {
         }
     }
     RoleController _role = new RoleController();
     string[] roles = _role.GetRoleNames(GetUsername, GetPortalID).ToLower().Split(',');
     if (roles.Contains(SystemSetting.SUPER_ROLE[0].ToLower()) || roles.Contains(SystemSetting.SITEADMIN.ToLower()))
     {
         hlnkDashboard.Visible = true;
         hlnkDashboard.NavigateUrl = GetPortalAdminPage();
         cpanel.Visible = true;
     }
     else
     {
         cpanel.Visible = false;
     }
 }
Beispiel #3
0
    private void Awake()
    {
        _instance = this;
        loginController = this.GetComponent<LoginController>();
        registerController = this.GetComponent<RegisterController>();
        roleController = this.GetComponent<RoleController>();

        roleController.OnAddRole += OnAddRole;
        roleController.OnGetRole += OnGetRole;
        roleController.OnSelectRole += OnSelectRole;

    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            IncludeLanguageJS();
            Extension = SageFrameSettingKeys.PageExtension;
            SageFrameConfig sfConfig = new SageFrameConfig();
            IsUseFriendlyUrls = sfConfig.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
            FormsAuthenticationTicket ticket = SecurityPolicy.GetUserTicket(GetPortalID);
            if (ticket != null)
            {
                int LoggedInPortalID = int.Parse(ticket.UserData.ToString());
                if (ticket.Name != ApplicationKeys.anonymousUser)
                {
                    string[] sysRoles = SystemSetting.SUPER_ROLE;
                    if (GetPortalID == LoggedInPortalID || Roles.IsUserInRole(ticket.Name, sysRoles[0]))
                    {
                        RoleController _role = new RoleController();
                        string userinroles = _role.GetRoleNames(GetUsername, LoggedInPortalID);
                        if (userinroles != string.Empty || userinroles != null)
                        {

                        }
                        else
                        {
                            lnkloginStatus.Text = SageLogInText;
                            lnkloginStatus.CommandName = "LOGIN";
                        }
                    }
                    else
                    {
                        lnkloginStatus.Text = SageLogInText;
                        lnkloginStatus.CommandName = "LOGIN";
                    }
                    lnkloginStatus.Text = SageLogOutText;
                    lnkloginStatus.CommandName = "LOGOUT";                    
                }
                else
                {
                    lnkloginStatus.Text = SageLogInText;
                    lnkloginStatus.CommandName = "LOGIN";
                }
            }
            else
            {
                lnkloginStatus.Text = SageLogInText;
                lnkloginStatus.CommandName = "LOGIN";
            }
        }
        catch
        {
        }
    }
    protected void BuildAccessControlledSelection()
    {
        StringBuilder sb = new StringBuilder();
        RoleController _role = new RoleController();
        string[] roles = _role.GetRoleNames(GetUsername, GetPortalID).ToLower().Split(',');
        if (roles.Contains(SystemSetting.SUPER_ROLE[0].ToLower()))
        {			
			sb.Append("<div class='sfRadiobutton'>");
            sb.Append("<input id='rdbGenralModules' name='ModuleSwitcher' type='radio' checked='checked' value='0'/>");
			sb.Append("<label>General</label>");
			sb.Append("<input id='rdbAdminModules' name='ModuleSwitcher' type='radio' value='1' />");
            sb.Append("<label>Admin</label></div>");
            sb.Append("<div id='divIncludeModules' class='sfLeft'><input type='checkbox' id='chkPortalModules' class='sfCheckbox'><label>Include Portal Modules</label></div>");
        }
        ltrModuleRadioButtons.Text = sb.ToString();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        IncludeLanguageJS();
        appPath = GetApplicationName;
        SecurityPolicy objSecurity = new SecurityPolicy();
        userName = objSecurity.GetUser(GetPortalID);
        Extension = SageFrameSettingKeys.PageExtension;


        if (!IsPostBack)
        {
            // BindThemes();
            //BindLayouts();
            //BindValues();
            hlnkDashboard.Visible = false;
            SageFrameConfig conf = new SageFrameConfig();
            string ExistingPortalShowProfileLink = conf.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalShowProfileLink);
            lnkAccount.NavigateUrl = GetProfileLink();
            if (ExistingPortalShowProfileLink == "1")
            {
                lnkAccount.Visible = true;
            }
            else
            {
                lnkAccount.Visible = false;
            }
            SageFrame.Application.Application app = new SageFrame.Application.Application();
            lblVersion.Text = string.Format("V {0}", app.FormatShortVersion(app.Version, true));
        }
        hypLogo.NavigateUrl = GetPortalAdminPage();
        hypLogo.ImageUrl = appPath + "/Administrator/Templates/Default/images/sagecomers-logoicon.png";
        RoleController _role = new RoleController();
        string[] roles = _role.GetRoleNames(GetUsername, GetPortalID).ToLower().Split(',');
        if (roles.Contains(SystemSetting.SUPER_ROLE[0].ToLower()) || roles.Contains(SystemSetting.SITEADMIN.ToLower()))
        {
            hlnkDashboard.Visible = true;
            hlnkDashboard.NavigateUrl = GetPortalAdminPage();
            cpanel.Visible = true;
            AspxAdminNotificationView1.Visible = true;
            IsAdmin = true;
        }
        else
        {
            cpanel.Visible = false;
        }
        
    }
Beispiel #7
0
 private void AutoAssignUsers(RoleInfo role)
 {
     if (role.AutoAssignment)
     {
         //loop through users for portal and add to role
         var arrUsers = UserController.GetUsers(role.PortalID);
         foreach (UserInfo objUser in arrUsers)
         {
             try
             {
                 var legacyRoleController = new RoleController();
                 legacyRoleController.AddUserRole(role.PortalID, objUser.UserID, role.RoleID, Null.NullDate, Null.NullDate);
             }
             catch (Exception exc)
             {
                 //user already belongs to role
                 DnnLog.Error(exc);
             }
         }
     }
 }
Beispiel #8
0
//	public int HelmID
//	{
//		get{
//			return _helmID;
//		}
//		set{
//			_helmID = value;
//		}
//	}
//
//	public int ClothID
//	{
//		get{
//			return _clothID;
//		}
//		set{
//			_clothID =value;
//		}
//	}
//
//	public int WeaponID
//	{
//		get{
//			return _weaponID;
//		}
//		set{
//			_weaponID = value;
//		}
//	}
//
//	public int ShoesID
//	{
//		get{
//			return _shoesID;
//		}
//		set{
//			_shoesID = value;
//		}
//	}
//
//
//	public int NecklaceID
//	{
//		get{
//			return _necklaceID;
//		}
//		set{
//			_necklaceID = value;
//		}
//	}
//
//	public int BraceletID
//	{
//		get{
//			return _braceletID;
//		}
//		set{
//			_braceletID = value;
//		}
//	}
//
//	public int RingID
//	{
//		get{
//			return _ringID;
//		}
//		set{
//			_ringID  = value;
//		}
//	}
//	public int WingID
//	{
//		get{
//			return _wingID;
//		}
//		set{
//			_wingID = value;
//		}
//	}


	#endregion


	#region  unity event
	void Awake()
	{
		_instance =this;
        this.OnPlayerInfoChanged += this.OnPlayerInfoChange;
        roleController = this.GetComponent<RoleController>();
	    inventoryItemDBController = this.GetComponent<InventoryItemDBController>();
	}
        /// <summary>
        /// Deletes the event having the specified <paramref name="id" />.
        /// </summary>
        /// <param name="id">The ID of the event to delete.</param>
        /// <returns>An instance of <see cref="HttpResponseMessage" />.</returns>
        /// <exception cref="System.Web.Http.HttpResponseException">Thrown when the user does not have permission to delete
        /// the event or some other error occurs.
        /// </exception>
        public HttpResponseMessage Delete(int id)
        {
            IEvent appEvent = null;

            try
            {
                appEvent = Factory.GetAppEvents().FindById(id);

                if (appEvent == null)
                {
                    // HTTP specification says the DELETE method must be idempotent, so deleting a nonexistent item must have
                    // the same effect as deleting an existing one. So we simply return HttpStatusCode.OK.
                    return(new HttpResponseMessage(HttpStatusCode.OK)
                    {
                        Content = new StringContent(String.Format("Event with ID = {0} does not exist.", id))
                    });
                }

                var isAuthorized = true;

                // If the event has a non-template gallery ID (not all do), then check the user's permission. For those errors without a gallery ID,
                // just assume the user has permission, because there is no way to verify the user can delete this event. We could do something
                // that mostly works like verifying the user is a gallery admin for at least one gallery, but the function we are trying to
                // protect is deleting an event message, which is not that important to worry about.
                if (appEvent.GalleryId != GalleryController.GetTemplateGalleryId())
                {
                    isAuthorized = Utils.IsUserAuthorized(SecurityActions.AdministerSite | SecurityActions.AdministerGallery, RoleController.GetGalleryServerRolesForUser(), int.MinValue, appEvent.GalleryId, false, false);
                }

                if (isAuthorized)
                {
                    Events.EventController.Delete(id);
                    CacheController.RemoveCache(CacheItem.AppEvents);

                    return(new HttpResponseMessage(HttpStatusCode.OK)
                    {
                        Content = new StringContent("Event deleted...")
                    });
                }
                else
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
                }
            }
            catch (Exception ex)
            {
                if (appEvent != null)
                {
                    AppEventController.LogError(ex, appEvent.GalleryId);
                }
                else
                {
                    AppEventController.LogError(ex);
                }

                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content      = Utils.GetExStringContent(ex),
                    ReasonPhrase = "Server Error"
                });
            }
        }
    protected void LoginButton_Click(object sender, EventArgs e)
    {
        MembershipController member = new MembershipController();
        RoleController role = new RoleController();
        UserInfo user = member.GetUserDetails(GetPortalID, UserName.Text);
        if (user.UserExists && user.IsApproved)
        {
            if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(PasswordAspx.Text)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, PasswordAspx.Text, user.Password, user.PasswordSalt))
                {
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
                        sessionTracker.PortalID = GetPortalID.ToString();
                        sessionTracker.Username = UserName.Text;
                        Session["Tracker"] = sessionTracker;
                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());

                        if (Request.QueryString["ReturnUrl"] != null)
                        {
                            FormsAuthentication.SetAuthCookie(UserName.Text, RememberMe.Checked);
                            string PageNotFoundPage = Path.Combine(this.Request.ApplicationPath.ToString(), pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotFound) + ".aspx").Replace("\\", "/"); ;
                            string UserRegistrationPage = Path.Combine(this.Request.ApplicationPath.ToString(), pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalRegistrationPage) + ".aspx").Replace("\\", "/"); ;
                            string PasswordRecoveryPage = Path.Combine(this.Request.ApplicationPath.ToString(), pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalPasswordRecovery) + ".aspx").Replace("\\", "/"); ;
                            string ForgotPasswordPage = Path.Combine(this.Request.ApplicationPath.ToString(), pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalForgotPassword) + ".aspx").Replace("\\", "/"); ;
                            string PageNotAccessiblePage = Path.Combine(this.Request.ApplicationPath.ToString(), pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalPageNotAccessible) + ".aspx").Replace("\\", "/"); ;

                            string ReturnUrlPage = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();

                            if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage)
                            {
                                Response.Redirect("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx", false);
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()), false);
                            }
                        }
                        else
                        {
                            FormsAuthentication.SetAuthCookie(UserName.Text, RememberMe.Checked);
                            if (IsUseFriendlyUrls)
                            {
                                if (GetPortalID > 1)
                                {
                                    Response.Redirect("~/portal/" + GetPortalSEOName + "/" + "Single-Address-Checkout.aspx", false);
                                }
                                else
                                {
                                    Response.Redirect("~/" + "Single-Address-Checkout" + ".aspx", false);
                                }
                            }
                            else if (!IsUseFriendlyUrls)
                            {
                                if (GetPortalID > 1)
                                {
                                    Response.Redirect("~/portal/" + GetPortalSEOName + "/" + "Single-Address-Checkout", false);
                                }
                                else
                                {
                                    Response.Redirect("~/" + "Single-Address-Checkout", false);
                                }
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)), false);
                            }
                        }

                        //update Cart for that User in AspxCommerce
                        //TODO:: get customerID from userNAme 
                        int customerID = GetCustomerID;
                        if (customerID == 0)
                        {
                            SettingProvider objSP = new SettingProvider();
                            CustomerGeneralInfo sageUserCust = objSP.CustomerIDGetByUsername(user.UserName, GetPortalID, GetStoreID);
                            if (sageUserCust != null)
                            {
                                customerID = sageUserCust.CustomerID;
                            }
                        }
                        UpdateCartAnonymoususertoRegistered(GetStoreID, GetPortalID, customerID, sessionCode);
                    }
                    else
                    {
                        FailureText.Text = GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal");//"You are not authenticated to this portal!";
                    }
                }
                else
                {
                    FailureText.Text = GetSageMessage("UserLogin", "UsernameandPasswordcombinationdoesntmatched");//"Username and Password combination doesn't matched!";
                }
            }
        }
        else
        {
            FailureText.Text = GetSageMessage("UserLogin", "UserDoesnotExist");
        }
    }
Beispiel #11
0
 public static RoleController Fixture()
 {
     RoleController controller = new RoleController(new RoleRepository());
     return controller;
 }
	private void LogInPublicModeRegistration()
	{
		string strRoles = string.Empty;
		MembershipController member = new MembershipController();
		RoleController role = new RoleController();
		UserInfo user = member.GetUserDetails(GetPortalID, UserName.Text);

		if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
		{
			if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
			{
				string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
				strRoles += userRoles;
				if (strRoles.Length > 0)
				{
					SetUserRoles(strRoles);
                    //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                    //sessionTracker.PortalID = GetPortalID.ToString();
                    //sessionTracker.Username = UserName.Text;
                    //Session[SessionKeys.Tracker] = sessionTracker;
                    SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                    SLog.SessionTrackerUpdateUsername(UserName.Text, GetPortalID.ToString());
					{
						FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
								 user.UserName,
								 DateTime.Now,
								 DateTime.Now.AddMinutes(30),
								 true,
								 GetPortalID.ToString(),
								 FormsAuthentication.FormsCookiePath);

						// Encrypt the ticket.
						string encTicket = FormsAuthentication.Encrypt(ticket);

						// Create the cookie.
						Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName, encTicket));
						bool IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
						if (IsUseFriendlyUrls)
						{
                            if (!IsParent)
							{
                                Response.Redirect(ResolveUrl(GetParentURL + "/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
							}
							else
							{
								Response.Redirect(ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + SageFrameSettingKeys.PageExtension), false);
							}
						}
						else
						{
							Response.Redirect(ResolveUrl("~/Default"+SageFrameSettingKeys.PageExtension+"?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)), false);
						}

					}
				}

			}

		}
	}
Beispiel #13
0
 public override void Start()
 {
     base.Start();
     roleController = this.GetComponent<RoleController>();
 }
Beispiel #14
0
        private void LogInPublicModeRegistration()
        {
            string strRoles             = string.Empty;
            MembershipController member = new MembershipController();
            RoleController       role   = new RoleController();
            UserInfo             user   = member.GetUserDetails(GetPortalID, UserName.Text);

            if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
                {
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        sessionTracker.PortalID      = GetPortalID.ToString();
                        sessionTracker.Username      = UserName.Text;
                        Session[SessionKeys.Tracker] = sessionTracker;
                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                        {
                            FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                             user.UserName,
                                                                                             DateTime.Now,
                                                                                             DateTime.Now.AddMinutes(30),
                                                                                             true,
                                                                                             GetPortalID.ToString(),
                                                                                             FormsAuthentication.FormsCookiePath);

                            StoreSettingConfig ssc = new StoreSettingConfig();


                            if (ssc.GetStoreSettingsByKey(StoreSetting.AllowRealTimeNotifications, GetStoreID, GetPortalID, GetCurrentCultureName).ToLower() == "true")
                            {
                                RealTimeHelper.UpdateAdminNotifications(GetStoreID, GetPortalID);
                            }


                            // Encrypt the ticket.
                            string encTicket = FormsAuthentication.Encrypt(ticket);

                            // Create the cookie.
                            string randomCookieValue = GenerateRandomCookieValue();
                            Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                            SecurityPolicy  objSecurity            = new SecurityPolicy();
                            HttpCookie      cookie                 = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket);
                            SageFrameConfig objConfig              = new SageFrameConfig();
                            string          ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration);
                            int             expiryTime             = Math.Abs(int.Parse(ServerCookieExpiration));
                            expiryTime     = expiryTime < 5 ? 5 : expiryTime;
                            cookie.Expires = DateTime.Now.AddMinutes(expiryTime);
                            Response.Cookies.Add(cookie);
                            string sessionCode = string.Empty;
                            if (HttpContext.Current.Session.SessionID != null)
                            {
                                sessionCode = HttpContext.Current.Session.SessionID.ToString();
                            }
                            int CustomerID = GetUserDetailsByUserName(UserName.Text, GetPortalID).CustomerID;
                            UpdateCartAnonymoususertoRegistered(GetStoreID, GetPortalID, CustomerID, sessionCode);
                            if (!IsParent)
                            {
                                Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + Extension), false);
                            }
                        }
                    }
                }
            }
        }
    protected void BuildAccessControlledSelection()
    {


        StringBuilder sb = new StringBuilder();
        RoleController _role = new RoleController();
        string[] roles = _role.GetRoleNames(GetUsername, GetPortalID).ToLower().Split(',');
        if (roles.Contains(SystemSetting.SUPER_ROLE[0].ToLower()))
        {
            sb.Append("<div class='sfRadiobutton'>");           
            sb.Append("<input type='radio' id='rdbFronMenu' checked='checked' name='PageMode'/>");
            sb.Append("<label>Portal Pages</label>");          
            sb.Append("<input type='radio' id='rdbAdmin' name='PageMode'/><label>Admin Pages</label></div>");
        }
        ltrPageRadioButtons.Text = sb.ToString();        
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        IncludeLanguageJS();
        appPath = GetApplicationName;
        SecurityPolicy objSecurity = new SecurityPolicy();

        userName  = objSecurity.GetUser(GetPortalID);
        Extension = SageFrameSettingKeys.PageExtension;
        IncludeJs("topstickybar", "/js/popup.js", "/js/TopStickyBar.js");
        SageFrameConfig conf = new SageFrameConfig();

        if (!IsPostBack)
        {
            // BindThemes();
            //BindLayouts();
            //BindValues();
            hlnkDashboard.Visible = false;
            hypEdit.Visible       = false;

            string ExistingPortalShowProfileLink = conf.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalShowProfileLink);
            lnkAccount.NavigateUrl = GetProfileLink();
            if (ExistingPortalShowProfileLink == "1")
            {
                lnkAccount.Visible = true;
            }
            else
            {
                lnkAccount.Visible = false;
            }
            SageFrame.Version.SageFrameVersion app = new SageFrame.Version.SageFrameVersion();
            string value = SageFrame.Utilities.Config.GetVersionConfigSettingValue("SageFrameVersionLoad");
            if (!IsPostBack)
            {
                if (value.ToLower() == "true")
                {
                    // showVersion();
                }
                else
                {
                    // hideVersion();
                }
            }
        }
        hypEdit.NavigateUrl = GetParentURL + "/" + conf.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage).Replace(" ", "-") + SageFrameSettingKeys.PageExtension;

        string LogoPath = Server.MapPath(appPath + "~/Administrator/Templates/Default/images/SageLogo.png");

        if (File.Exists(LogoPath))
        {
            hypLogo.NavigateUrl = GetPortalAdminPage();
            hypLogo.ImageUrl    = appPath + "/Administrator/Templates/Default/images/SageLogo.png";
            //if (GetUsername != SystemSetting.SYSTEM_USER)
            //  lblHideLogo.Visible = false;
        }
        else
        {
            divLogo.Visible = false;
        }
        RoleController _role = new RoleController();
        bool           isDashboardAccessible = _role.IsDashboardAccesible(GetUsername, GetPortalID);

        if (isDashboardAccessible)
        {
            hlnkDashboard.Visible     = true;
            hypEdit.Visible           = true;
            hlnkDashboard.NavigateUrl = GetPortalAdminPage();
            cpanel.Visible            = true;
        }
        else
        {
            cpanel.Visible = false;
        }
    }
        public HttpResponseMessage AddUserToRole(UserRoleDto userRoleDto, bool notifyUser, bool isOwner)
        {
            try
            {
                Validate(userRoleDto);

                if (!AllowExpired(userRoleDto.UserId, userRoleDto.RoleId))
                {
                    userRoleDto.StartTime = userRoleDto.ExpiresTime = Null.NullDate;
                }
                HttpResponseMessage response;
                var user = GetUser(userRoleDto.UserId, out response);
                if (user == null)
                {
                    return(response);
                }

                var role = RoleController.Instance.GetRoleById(PortalId, userRoleDto.RoleId);
                if (role.SecurityMode != SecurityMode.SocialGroup && role.SecurityMode != SecurityMode.Both)
                {
                    isOwner = false;
                }
                if (role.Status != RoleStatus.Approved)
                {
                    return(Request.CreateErrorResponse(HttpStatusCode.BadRequest,
                                                       Localization.GetString("CannotAssginUserToUnApprovedRole",
                                                                              Components.Constants.LocalResourcesFile)));
                }

                RoleController.AddUserRole(user, role, PortalSettings, RoleStatus.Approved, userRoleDto.StartTime,
                                           userRoleDto.ExpiresTime, notifyUser, isOwner);

                var addedUser = RoleController.Instance.GetUserRole(PortalId, userRoleDto.UserId, userRoleDto.RoleId);
                var portal    = PortalController.Instance.GetPortal(PortalId);

                return(Request.CreateResponse(HttpStatusCode.OK,
                                              new UserRoleDto
                {
                    UserId = addedUser.UserID,
                    RoleId = addedUser.RoleID,
                    DisplayName = addedUser.FullName,
                    StartTime = addedUser.EffectiveDate,
                    ExpiresTime = addedUser.ExpiryDate,
                    AllowExpired = AllowExpired(addedUser.UserID, addedUser.RoleID),
                    AllowDelete = RoleController.CanRemoveUserFromRole(portal, addedUser.UserID, addedUser.RoleID)
                }));
            }
            catch (ArgumentException ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (SecurityException ex)
            {
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Beispiel #18
0
        public static void AuthenticateRequest(HttpContextBase context, bool allowUnknownExtensinons)
        {
            HttpRequestBase  request  = context.Request;
            HttpResponseBase response = context.Response;

            //First check if we are upgrading/installing
            if (request == null || request.Url == null ||
                request.Url.LocalPath.ToLower().EndsWith("install.aspx") ||
                request.Url.LocalPath.ToLower().EndsWith("upgradewizard.aspx") ||
                request.Url.LocalPath.ToLower().EndsWith("installwizard.aspx"))
            {
                return;
            }

            //exit if a request for a .net mapping that isn't a content page is made i.e. axd
            if (allowUnknownExtensinons == false &&
                request.Url.LocalPath.ToLower().EndsWith(".aspx") == false &&
                request.Url.LocalPath.ToLower().EndsWith(".asmx") == false &&
                request.Url.LocalPath.ToLower().EndsWith(".ashx") == false)
            {
                return;
            }

            //Obtain PortalSettings from Current Context
            PortalSettings portalSettings = PortalController.GetCurrentPortalSettings();

            if (request.IsAuthenticated && portalSettings != null)
            {
                var      roleController = new RoleController();
                UserInfo user           = UserController.GetCachedUser(portalSettings.PortalId, context.User.Identity.Name);

                //authenticate user and set last login ( this is necessary for users who have a permanent Auth cookie set )
                if (user == null || user.IsDeleted || user.Membership.LockedOut ||
                    (!user.Membership.Approved && !user.IsInRole("Unverified Users")) ||
                    user.Username.ToLower() != context.User.Identity.Name.ToLower())
                {
                    var portalSecurity = new PortalSecurity();
                    portalSecurity.SignOut();

                    //Remove user from cache
                    if (user != null)
                    {
                        DataCache.ClearUserCache(portalSettings.PortalId, context.User.Identity.Name);
                    }

                    //Redirect browser back to home page
                    response.Redirect(request.RawUrl, true);
                    return;
                }

                if (!user.IsSuperUser && user.IsInRole("Unverified Users") && !HttpContext.Current.Items.Contains(DotNetNuke.UI.Skins.Skin.OnInitMessage))
                {
                    HttpContext.Current.Items.Add(DotNetNuke.UI.Skins.Skin.OnInitMessage, Localization.GetString("UnverifiedUser"));
                }

                //if users LastActivityDate is outside of the UsersOnlineTimeWindow then record user activity
                if (DateTime.Compare(user.Membership.LastActivityDate.AddMinutes(Host.UsersOnlineTimeWindow), DateTime.Now) < 0)
                {
                    //update LastActivityDate and IP Address for user
                    user.Membership.LastActivityDate = DateTime.Now;
                    user.LastIPAddress = request.UserHostAddress;
                    UserController.UpdateUser(portalSettings.PortalId, user, false);
                }

                //check for RSVP code
                if (request.QueryString["rsvp"] != null && !string.IsNullOrEmpty(request.QueryString["rsvp"]))
                {
                    foreach (var role in TestableRoleController.Instance.GetRoles(portalSettings.PortalId, r => r.SecurityMode != SecurityMode.SocialGroup && r.Status == RoleStatus.Approved))
                    {
                        if (role.RSVPCode == request.QueryString["rsvp"])
                        {
                            roleController.UpdateUserRole(portalSettings.PortalId, user.UserID, role.RoleID);
                        }
                    }
                }

                //save userinfo object in context
                context.Items.Add("UserInfo", user);

                //Localization.SetLanguage also updates the user profile, so this needs to go after the profile is loaded
                Localization.SetLanguage(user.Profile.PreferredLocale);
            }

            if (context.Items["UserInfo"] == null)
            {
                context.Items.Add("UserInfo", new UserInfo());
            }
        }
Beispiel #19
0
 private string[] GetRolesForNewUser()
 {
     return(ViewMode == PageMode.CreateAdmin ? new[] { RoleController.ValidateSysAdminRole() } : GallerySettings.DefaultRolesForSelfRegisteredUser);
 }
Beispiel #20
0
        static void Main(string[] args)
        {
            int choice;

            do
            {
                Console.Clear();
                Console.WriteLine("=======MENU=======");
                Console.WriteLine("1. User");
                Console.WriteLine("2. Role");
                Console.WriteLine("3. Departments");
                Console.WriteLine("4. Type");
                Console.WriteLine("5. Category");
                Console.WriteLine("6. Travel");
                Console.WriteLine("7. Hotel Cost");
                Console.WriteLine("8. Transport Cost");
                Console.WriteLine("9. Exit");
                Console.WriteLine("==================");
                Console.Write("Pilih Action : ");
                choice = Convert.ToInt32(System.Console.ReadLine());
                switch (choice)
                {
                case 1:
                    UserController callUser = new UserController();
                    callUser.Menu();
                    break;

                case 2:
                    RoleController callRole = new RoleController();
                    callRole.Menu();
                    break;

                case 3:
                    DepartmentController callDepartments = new DepartmentController();
                    callDepartments.Menu();
                    break;

                case 4:
                    TypeController callType = new TypeController();
                    callType.Menu();
                    break;

                case 5:
                    CategoryController callCategory = new CategoryController();
                    callCategory.Menu();
                    break;

                case 6:
                    TravelController callTravel = new TravelController();
                    callTravel.Menu();
                    break;

                case 7:
                    HotelCostController callHotelCost = new HotelCostController();
                    callHotelCost.Menu();
                    break;

                case 8:
                    TransportController callTransprotCost = new TransportController();
                    callTransprotCost.Menu();
                    break;

                default:
                    System.Console.Write("Exit Cuy!");
                    System.Console.Read();
                    break;
                }
            } while (choice != 9);
        }
    protected void LoginButton_Click(object sender, EventArgs e)
    {
        MembershipController member = new MembershipController();
        RoleController role = new RoleController();
        UserInfo user = member.GetUserDetails(GetPortalID, UserName.Text);
        if (user.UserExists && user.IsApproved)
        {
            if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(PasswordAspx.Text)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, PasswordAspx.Text, user.Password, user.PasswordSalt))
                {
                    string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                    strRoles += userRoles;
                    if (strRoles.Length > 0)
                    {
                        SetUserRoles(strRoles);
                        //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        //SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                        //sessionTracker.PortalID = GetPortalID.ToString();
                        //sessionTracker.Username = UserName.Text;
                        //Session[SessionKeys.Tracker] = sessionTracker;
                        SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                        SLog.SessionTrackerUpdateUsername(UserName.Text, GetPortalID.ToString());

                        StringBuilder redirectURL = new StringBuilder();
                        SecurityPolicy objSecurity = new SecurityPolicy();
                        FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                          user.UserName,
                          DateTime.Now,
                          DateTime.Now.AddMinutes(30),
                          true,
                          GetPortalID.ToString(),
                          FormsAuthentication.FormsCookiePath);

                        string encTicket = FormsAuthentication.Encrypt(ticket);

                        string randomCookieValue = GenerateRandomCookieValue();
                        Session[SessionKeys.RandomCookieValue] = randomCookieValue;
                        HttpCookie cookie = new HttpCookie(objSecurity.FormsCookieName(GetPortalID), encTicket);
                        SageFrameConfig objConfig = new SageFrameConfig();
                        string ServerCookieExpiration = objConfig.GetSettingValueByIndividualKey(SageFrameSettingKeys.ServerCookieExpiration);
                        int expiryTime = Math.Abs(int.Parse(ServerCookieExpiration));
                        expiryTime = expiryTime < 5 ? 5 : expiryTime;
                        cookie.Expires = DateTime.Now.AddMinutes(expiryTime);
                        Response.Cookies.Add(cookie);
                        ServiceSecurity.IssueToken(GetPortalID);
                        if (Request.QueryString["ReturnUrl"] != null)
                        {
                            string PageNotFoundPage = PortalAPI.PageNotFoundURLWithRoot;
                            string UserRegistrationPage = PortalAPI.RegistrationURLWithRoot;
                            string PasswordRecoveryPage = PortalAPI.PasswordRecoveryURLWithRoot;
                            string ForgotPasswordPage = PortalAPI.ForgotPasswordURL;
                            string PageNotAccessiblePage = PortalAPI.PageNotAccessibleURLWithRoot;

                            string ReturnUrlPage = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();

                            if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage)
                            {
                                redirectURL.Append(GetParentURL);
                                redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                            }
                            else
                            {
                                redirectURL.Append(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()));
                            }
                        }
                        else
                        {




                            if (!IsParent)
                            {
                                redirectURL.Append(GetParentURL);
                                redirectURL.Append("/portal/");
                                redirectURL.Append(GetPortalSEOName);
                                redirectURL.Append("/");
                                redirectURL.Append(ssc.GetStoreSettingsByKey(StoreSetting.SingleCheckOutURL, GetStoreID, GetPortalID, GetCurrentCultureName));
                                redirectURL.Append(SageFrameSettingKeys.PageExtension);
                            }
                            else
                            {
                                redirectURL.Append(GetParentURL);
                                redirectURL.Append("/");
                                redirectURL.Append(ssc.GetStoreSettingsByKey(StoreSetting.SingleCheckOutURL, GetStoreID, GetPortalID, GetCurrentCultureName));
                                redirectURL.Append(SageFrameSettingKeys.PageExtension);
                            }

                        }

                        int customerID = GetCustomerID;
                        if (customerID == 0)
                        {
                            CustomerGeneralInfo sageUserCust = CustomerGeneralInfoController.CustomerIDGetByUsername(user.UserName, storeID, portalID);
                            if (sageUserCust != null)
                            {
                                customerID = sageUserCust.CustomerID;
                            }
                        }
                        AspxCommonController objCommonCont = new AspxCommonController();
                        objCommonCont.UpdateCartAnonymoususertoRegistered(storeID, portalID, customerID, sessionCode);
                        Response.Redirect(redirectURL.ToString(), false);
                    }
                    else
                    {
                        FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal"));
                    }
                }
                else
                {
                    FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "UsernameandPasswordcombinationdoesntmatched"));//"Username and Password combination doesn't matched!";
                }
            }
        }
        else
        {
            FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "UserDoesnotExist"));
        }
    }
Beispiel #22
0
        public static void Main(string[] args)
        {
            int pilih;

            do
            {
                Console.Clear();
                Console.WriteLine("=======MENU=======");
                Console.WriteLine("1. Employee");
                Console.WriteLine("2. Data Overtime");
                Console.WriteLine("3. Department");
                Console.WriteLine("4. Role");
                Console.WriteLine("5. Customer");
                Console.WriteLine("6. Tax");
                Console.WriteLine("7. Tipe Overtime");
                Console.WriteLine("8. Exit");
                Console.WriteLine("==================");
                Console.Write("Pilih Action : ");
                pilih = Convert.ToInt32(System.Console.ReadLine());
                switch (pilih)
                {
                case 1:
                    EmployeeController callEmp = new EmployeeController();
                    callEmp.Menu();
                    break;

                case 2:
                    DataOvertimeController callDOV = new DataOvertimeController();
                    callDOV.Menu();
                    break;

                case 3:
                    DepartmentController callDept = new DepartmentController();
                    callDept.Menu();
                    break;

                case 4:
                    RoleController callRole = new RoleController();
                    callRole.Menu();
                    break;

                case 5:
                    CustomerController callCust = new CustomerController();
                    callCust.Menu();
                    break;

                case 6:
                    TaxController callTax = new TaxController();
                    callTax.Menu();
                    break;

                case 7:
                    TypeOvertimeController callType = new TypeOvertimeController();
                    break;

                default:
                    System.Console.Write("Exit Cuy!");
                    System.Console.Read();
                    break;
                }
            } while (pilih != 2);
        }
    public UserInfoMob IsUserValid(string userName, string password, int portalID, int storeID, bool isChecked, string sessionCode)
    {
        SageFrameConfig pagebase = new SageFrameConfig();
        MembershipController member = new MembershipController();
        RoleController role = new RoleController();
        UserInfo user = member.GetUserDetails(portalID, userName);
        UserInfoMob userinfo = member.GetUserDetailsMob(portalID, userName);
        if (user.UserExists && user.IsApproved)
        {
            if (!(string.IsNullOrEmpty(password) && string.IsNullOrEmpty(password)))
            {
                if (PasswordHelper.ValidateUser(user.PasswordFormat, password, user.Password, user.PasswordSalt))
                {

                    int customerID = GetCustomerID();
                    if (customerID == 0)
                    {
                        CustomerGeneralInfo sageUserCust = CustomerGeneralInfoController.CustomerIDGetByUsername(user.UserName, portalID, storeID);
                        if (sageUserCust != null)
                        {
                            customerID = sageUserCust.CustomerID;
                            userinfo.CustomerID = customerID;
                        }
                    }

                    UpdateCartAnonymoususertoRegistered1(storeID, portalID, customerID, sessionCode);
                    userinfo.Status = 1;


                }
                else
                {
                    userinfo = new UserInfoMob();
                    userinfo.Status = 2;//User and Password Combination Doesnot match
                }
            }
        }
        else
        {
            userinfo = new UserInfoMob();
            userinfo.Status = 3;//User Doesnot Exist

        }
        return userinfo;
    }
Beispiel #24
0
        protected void Page_Load(Object sender, EventArgs e)
        {
            try
            {
                string       strName;
                StreamWriter objStream;
                bool         blnValid = true;
                string       strTransactionID;
                string       strTransactionType;
                int          intRoleID   = 0;
                int          intPortalID = PortalSettings.PortalId;
                int          intUserID   = 0;
                string       strDescription;
                double       dblAmount = 0;
                string       strEmail;
                string       strBody;
                bool         blnCancel   = false;
                string       strPayPalID = String.Empty;

                RoleController   objRoles            = new RoleController();
                PortalController objPortalController = new PortalController();

                string strPost = "cmd=_notify-validate";
                foreach (string tempLoopVar_strName in Request.Form)
                {
                    strName = tempLoopVar_strName;
                    string strValue = Request.Form[strName];
                    switch (strName)
                    {
                    case "txn_type":     // get the transaction type

                        strTransactionType = strValue;
                        switch (strTransactionType)
                        {
                        case "subscr_signup":
                            break;

                        case "subscr_payment":
                            break;

                        case "web_accept":

                            break;

                        case "subscr_cancel":

                            blnCancel = true;
                            break;

                        default:

                            blnValid = false;
                            break;
                        }
                        break;

                    case "payment_status":     // verify the status

                        if (strValue != "Completed")
                        {
                            blnValid = false;
                        }
                        break;

                    case "txn_id":     // verify the transaction id for duplicates

                        strTransactionID = strValue;
                        break;

                    case "receiver_email":     // verify the PayPalId

                        strPayPalID = strValue;
                        break;

                    case "mc_gross":     // verify the price

                        dblAmount = double.Parse(strValue);
                        break;

                    case "item_number":     // get the RoleID

                        intRoleID = int.Parse(strValue);
                        RoleInfo objRole = objRoles.GetRole(intRoleID, intPortalID);
                        break;

                    case "item_name":     // get the product description

                        strDescription = strValue;
                        break;

                    case "custom":     // get the UserID

                        intUserID = int.Parse(strValue);
                        break;

                    case "email":     // get the email

                        strEmail = strValue;
                        break;
                    }
                    // reconstruct post for postback validation
                    strPost += string.Format("&{0}={1}", strName, Globals.HTTPPOSTEncode(strValue));
                }
                // postback to verify the source
                if (blnValid)
                {
                    HttpWebRequest objRequest = (HttpWebRequest)WebRequest.Create("https://www.paypal.com/cgi-bin/webscr");
                    objRequest.Method        = "POST";
                    objRequest.ContentLength = strPost.Length;
                    objRequest.ContentType   = "application/x-www-form-urlencoded";

                    objStream = new StreamWriter(objRequest.GetRequestStream());
                    objStream.Write(strPost);
                    objStream.Close();

                    HttpWebResponse objResponse = (HttpWebResponse)objRequest.GetResponse();
                    StreamReader    sr;
                    sr = new StreamReader(objResponse.GetResponseStream());
                    string strResponse = sr.ReadToEnd();
                    sr.Close();

                    switch (strResponse)
                    {
                    case "VERIFIED":

                        break;

                    default:

                        // possible fraud
                        blnValid = false;
                        break;
                    }
                }

                if (blnValid)
                {
                    int        intAdministratorRoleId = 0;
                    string     strProcessorID         = String.Empty;
                    PortalInfo objPortalInfo          = objPortalController.GetPortal(intPortalID);
                    if (objPortalInfo != null)
                    {
                        intAdministratorRoleId = objPortalInfo.AdministratorRoleId;
                        strProcessorID         = objPortalInfo.ProcessorUserId.ToLower();
                    }
                    if (intRoleID == intAdministratorRoleId)
                    {
                        // admin portal renewal
                        strProcessorID = Convert.ToString(PortalSettings.HostSettings["ProcessorUserId"]).ToLower();
                        float portalPrice = objPortalInfo.HostFee;
                        if ((portalPrice.ToString() == dblAmount.ToString()) && (HttpUtility.UrlDecode(strPayPalID.ToLower()) == strProcessorID))
                        {
                            objPortalController.UpdatePortalExpiry(intPortalID);
                        }
                        else
                        {
                            try
                            {
                                EventLogController objEventLog     = new EventLogController();
                                LogInfo            objEventLogInfo = new LogInfo();
                                objEventLogInfo.LogPortalID   = intPortalID;
                                objEventLogInfo.LogPortalName = PortalSettings.PortalName;
                                objEventLogInfo.LogUserID     = intUserID;
                                objEventLogInfo.LogTypeKey    = "POTENTIAL PAYPAL PAYMENT FRAUD";
                                objEventLog.AddLog(objEventLogInfo);
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                    else
                    {
                        // user subscription
                        RoleInfo objRoleInfo = objRoles.GetRole(intRoleID, intPortalID);
                        double   rolePrice   = objRoleInfo.ServiceFee;
                        if ((rolePrice.ToString() == dblAmount.ToString()) && (HttpUtility.UrlDecode(strPayPalID.ToLower()) == strProcessorID))
                        {
                            objRoles.UpdateUserRole(intPortalID, intUserID, intRoleID, blnCancel);
                        }
                        else
                        {
                            try
                            {
                                //let's use the new logging provider.
                            }
                            catch (Exception)
                            {
                            }
                        }
                    }
                }
            }
            catch (Exception exc)  //Page failed to load
            {
                Exceptions.ProcessPageLoadException(exc);
            }
        }
Beispiel #25
0
        public static RoleController Fixture()
        {
            RoleController controller = new RoleController(new RoleRepository(), "", new LoginView());

            return(controller);
        }
Beispiel #26
0
        private void LoginUser()
        {
            MembershipController member = new MembershipController();
            RoleController       role   = new RoleController();
            UserInfo             user   = member.GetUserDetails(GetPortalID, UserName.Text);

            HttpContext.Current.Session["IsLoginClick" + user.UserName] = false;
            if (user.UserExists && user.IsApproved)
            {
                if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
                {
                    if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
                    {
                        SucessFullLogin(user);
                    }
                    else
                    {
                        if (Session[SessionKeys.LoginHitCount] == null)
                        {
                            Session[SessionKeys.LoginHitCount] = 1;
                        }
                        else
                        {
                            loginhit = Convert.ToInt32(Session[SessionKeys.LoginHitCount]);
                            loginhit++;
                            Session[SessionKeys.LoginHitCount] = loginhit;
                        }
                        CaptchaValue.Text = string.Empty;
                        if (loginhit == 3)
                        {
                            Page.Response.Redirect(Page.Request.Url.ToString(), true);
                        }
                        if (loginhit > 3)
                        {
                            InitializeCaptcha();
                            CaptchaValue.Text = string.Empty;
                        }
                        FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "UsernameandPasswordcombinationdoesntmatched"));//"Username and Password combination doesn't matched!";
                    }
                }
            }
            else
            {
                if (Session[SessionKeys.LoginHitCount] == null)
                {
                    Session[SessionKeys.LoginHitCount] = 1;
                }
                else
                {
                    loginhit = Convert.ToInt32(Session[SessionKeys.LoginHitCount]);
                    loginhit++;
                    Session[SessionKeys.LoginHitCount] = loginhit;
                }
                FailureText.Text  = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "UserDoesnotExist"));
                CaptchaValue.Text = string.Empty;
                if (loginhit == 3)
                {
                    Page.Response.Redirect(Page.Request.Url.ToString(), true);
                }
                if (loginhit > 3)
                {
                    InitializeCaptcha();
                    CaptchaValue.Text = string.Empty;
                }
            }
        }
Beispiel #27
0
        // Promote / Demote users
        private void promoteDemoteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int SelectedUsersCount = listView_Users.SelectedItems.Count;

            if (SelectedUsersCount == 0)
            {
                return;
            }

            long AdminCount;
            long SelectedAdminCount;

            long AdminRoleID;
            long UserRoleID;

            using (UserController userController = new UserController())
                using (RoleController roleController = new RoleController())
                {
                    AdminRoleID = roleController.GetRoleID("Admin");
                    UserRoleID  = roleController.GetRoleID("User");

                    // Check if Admin want to demote all Admins
                    List <UserModelDataTransferObject> AdminsList = userController.GetUsersByRoleID(AdminRoleID);
                    AdminCount         = AdminsList.Count;
                    SelectedAdminCount = 0;

                    foreach (ListViewItem item in listView_Users.SelectedItems)
                    {
                        long UserID = Convert.ToInt64(item.Tag);
                        UserModelDataTransferObject CurrentUser = userController.GetUserByID(UserID);
                        if (CurrentUser.IsAdministrator())
                        {
                            ++SelectedAdminCount;
                        }
                    }
                }

            if (AdminCount == SelectedAdminCount && AdminCount == listView_Users.SelectedItems.Count)
            {
                MaterialMessageBox.Show("You cannot demote all Administrators.", "Easy Survey - Demote Users", MaterialMessageBox.MessageBoxButtons.OK, MaterialMessageBox.MessageBoxIcon.Error);
                return;
            }


            // Check if Admin wants to demote himself
            bool AdminSelectedHimself = false;

            foreach (ListViewItem item in listView_Users.SelectedItems)
            {
                long UserID = Convert.ToInt64(item.Tag);
                if (LoggedUser.UserID == UserID)
                {
                    AdminSelectedHimself = true; break;
                }
            }
            if (AdminSelectedHimself)
            {
                MaterialMessageBox.Show("You cannot demote yourself.", "Easy Survey - Demote Users", MaterialMessageBox.MessageBoxButtons.OK, MaterialMessageBox.MessageBoxIcon.Error);
                return;
            }

            // Demote / Promote selected users.
            using (UserController userController = new UserController())
                using (UserRoleController userRoleController = new UserRoleController())
                    foreach (ListViewItem item in listView_Users.SelectedItems)
                    {
                        long UserID = Convert.ToInt64(item.Tag);
                        UserModelDataTransferObject CurrentUser = userController.GetUserByID(UserID);
                        if (CurrentUser.IsAdministrator()) // Demote to standard user.
                        {
                            userRoleController.SetUserRole(UserID, UserRoleID);
                            item.Group = listView_Users.Groups["User"];
                        }
                        else if (!CurrentUser.IsAdministrator()) // Promote to admin.
                        {
                            userRoleController.SetUserRole(UserID, AdminRoleID);
                            item.Group = listView_Users.Groups["Administrator"];
                        }
                    }
        }
    private void LogInPublicModeRegistration()
    {
        string strRoles = string.Empty;
        MembershipController member = new MembershipController();
        RoleController role = new RoleController();
        UserInfo user = member.GetUserDetails(GetPortalID, UserName.Text);

        if (!(string.IsNullOrEmpty(UserName.Text) && string.IsNullOrEmpty(Password.Text)))
        {
            if (PasswordHelper.ValidateUser(user.PasswordFormat, Password.Text, user.Password, user.PasswordSalt))
            {
                string userRoles = role.GetRoleNames(user.UserName, GetPortalID);
                strRoles += userRoles;
                if (strRoles.Length > 0)
                {
                    SetUserRoles(strRoles);
                    SessionTracker sessionTracker = (SessionTracker)Session["Tracker"];
                    sessionTracker.PortalID = GetPortalID.ToString();
                    sessionTracker.Username = UserName.Text;
                    Session["Tracker"] = sessionTracker;
                    SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                    SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                    {
                        FormsAuthentication.SetAuthCookie(UserName.Text, true);
                        bool IsUseFriendlyUrls = pagebase.GetSettingBollByKey(SageFrameSettingKeys.UseFriendlyUrls);
                        if (IsUseFriendlyUrls)
                        {
                            if (GetPortalID > 1)
                            {
                                Response.Redirect(ResolveUrl("~/portal/" + GetPortalSEOName + "/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx"), false);
                            }
                            else
                            {
                                Response.Redirect(ResolveUrl("~/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage) + ".aspx"), false);
                            }
                        }
                        else
                        {
                            Response.Redirect(ResolveUrl("~/Default.aspx?ptlid=" + GetPortalID + "&ptSEO=" + GetPortalSEOName + "&pgnm=" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalDefaultPage)), false);
                        }

                    }
                }

            }

        }
    }
Beispiel #29
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            int SelectedUsersCount = listView_Users.SelectedItems.Count;

            if (SelectedUsersCount == 0)
            {
                return;
            }

            IEnumerable <ListViewItem> SelectedUsers = listView_Users.SelectedItems.Cast <ListViewItem>();

            using (UserController userController = new UserController())
                using (RoleController roleController = new RoleController())
                {
                    // Check if Admin selected all Admins to be deleted.
                    long AdminRoleID = roleController.GetRoleID("Admin");
                    List <UserModelDataTransferObject> AdminsList = userController.GetUsersByRoleID(AdminRoleID);
                    long AdminCount         = AdminsList.Count;
                    long SelectedAdminCount = 0;
                    foreach (ListViewItem item in SelectedUsers)
                    {
                        long UserID = Convert.ToInt64(item.Tag);
                        UserModelDataTransferObject SelectedUser = userController.GetUserByID(UserID);
                        if (SelectedUser.IsAdministrator())
                        {
                            ++SelectedAdminCount;
                        }
                    }
                    if (AdminCount == SelectedAdminCount)
                    {
                        MaterialMessageBox.Show("You cannot delete all Administrators.", "Easy Survey - Delete Users", MaterialMessageBox.MessageBoxButtons.OK, MaterialMessageBox.MessageBoxIcon.Error);
                        return;
                    }

                    // Check if Admin selected his account to de deleted.
                    bool SelectedSelfAccount = false;
                    foreach (ListViewItem item in SelectedUsers)
                    {
                        long UserID = Convert.ToInt64(item.Tag);
                        if (LoggedUser.UserID == UserID)
                        {
                            SelectedSelfAccount = true; break;
                        }
                    }
                    if (SelectedSelfAccount)
                    {
                        MaterialMessageBox.Show("You cannot delete your own account.", "Easy Survey - Delete Users", MaterialMessageBox.MessageBoxButtons.OK, MaterialMessageBox.MessageBoxIcon.Error);
                        return;
                    }

                    // Delete selected users.
                    MaterialMessageBox.MessageBoxResult result = MaterialMessageBox.MessageBoxResult.None;
                    result = MaterialMessageBox.Show("Are you sure you want to delete all " + SelectedUsersCount + " selected users?", "Easy Survey - Delete Users", MaterialMessageBox.MessageBoxButtons.YesNo, MaterialMessageBox.MessageBoxIcon.Warning);

                    if (result == MaterialMessageBox.MessageBoxResult.Yes)
                    {
                        foreach (ListViewItem item in SelectedUsers)
                        {
                            long UserID = Convert.ToInt64(item.Tag);

                            // Delete from Database
                            userController.Delete(UserID);

                            // Delete from ListView
                            foreach (ListViewItem listViewItemToDelete in listView_Users.SelectedItems)
                            {
                                long ListViewUserID = Convert.ToInt64(listViewItemToDelete.Tag);
                                if (UserID == ListViewUserID)
                                {
                                    listView_Users.Items.Remove(listViewItemToDelete);
                                }
                            }
                        }
                    }
                }
        }
Beispiel #30
0
        private void Create_Click(object sender, EventArgs e)
        {
            RoleController roleController = new RoleController();

            Security.PortalSecurity ps = new Security.PortalSecurity();
            txtGroupName.Text = ps.InputFilter(txtGroupName.Text, Security.PortalSecurity.FilterFlag.NoScripting);
            txtGroupName.Text = ps.InputFilter(txtGroupName.Text, Security.PortalSecurity.FilterFlag.NoMarkup);

            txtDescription.Text = ps.InputFilter(txtDescription.Text, Security.PortalSecurity.FilterFlag.NoScripting);
            txtDescription.Text = ps.InputFilter(txtDescription.Text, Security.PortalSecurity.FilterFlag.NoMarkup);
            if (roleController.GetRoleByName(PortalId, txtGroupName.Text) != null)
            {
                reqGroupName.Visible = true;
                return;
            }
            List <RoleInfo> modRoles = new List <RoleInfo>();

            foreach (ModulePermissionInfo modulePermissionInfo in ModulePermissionController.GetModulePermissions(ModuleId, TabId))
            {
                if (modulePermissionInfo.PermissionKey == "MODGROUP" && modulePermissionInfo.AllowAccess)
                {
                    modRoles.Add(roleController.GetRole(modulePermissionInfo.RoleID, PortalId));
                }
            }
            RoleInfo roleInfo = new RoleInfo()
            {
                PortalID     = PortalId,
                RoleName     = txtGroupName.Text,
                Description  = txtDescription.Text,
                SecurityMode = SecurityMode.SocialGroup,
                Status       = RoleStatus.Approved,
                IsPublic     = rdAccessTypePublic.Checked
            };
            var userRoleStatus = RoleStatus.Pending;

            if (GroupModerationEnabled)
            {
                roleInfo.Status = RoleStatus.Pending;
                userRoleStatus  = RoleStatus.Pending;
            }
            else
            {
                userRoleStatus = RoleStatus.Approved;
            }

            var objModulePermissions = new ModulePermissionCollection(CBO.FillCollection(DataProvider.Instance().GetModulePermissionsByModuleID(ModuleId, -1), typeof(ModulePermissionInfo)));

            if (ModulePermissionController.HasModulePermission(objModulePermissions, "MODGROUP"))
            {
                roleInfo.Status = RoleStatus.Approved;
                userRoleStatus  = RoleStatus.Approved;
            }
            roleInfo.RoleGroupID = DefaultRoleGroupId;

            roleInfo.RoleID = roleController.AddRole(roleInfo);
            roleInfo        = roleController.GetRole(roleInfo.RoleID, PortalId);
            roleInfo.Settings.Add("URL", Globals.NavigateURL(GroupViewTabId, "", new String[] { "groupid=" + roleInfo.RoleID.ToString() }));
            roleInfo.Settings.Add("GroupCreatorName", UserInfo.DisplayName);
            roleInfo.Settings.Add("ReviewMembers", chkMemberApproved.Checked.ToString());

            TestableRoleController.Instance.UpdateRoleSettings(roleInfo, true);
            if (inpFile.PostedFile.ContentLength > 0)
            {
                IFileManager   _fileManager   = FileManager.Instance;
                IFolderManager _folderManager = FolderManager.Instance;
                var            rootFolderPath = PathUtils.Instance.FormatFolderPath(PortalSettings.HomeDirectory);

                IFolderInfo groupFolder = _folderManager.GetFolder(PortalSettings.PortalId, "Groups/" + roleInfo.RoleID);
                if (groupFolder == null)
                {
                    groupFolder = _folderManager.AddFolder(PortalSettings.PortalId, "Groups/" + roleInfo.RoleID);
                }
                if (groupFolder != null)
                {
                    var fileName = Path.GetFileName(inpFile.PostedFile.FileName);
                    var fileInfo = _fileManager.AddFile(groupFolder, fileName, inpFile.PostedFile.InputStream, true);
                    roleInfo.IconFile = "FileID=" + fileInfo.FileId;
                    roleController.UpdateRole(roleInfo);
                }
            }

            Components.Notifications notifications = new Components.Notifications();


            roleController.AddUserRole(PortalId, UserId, roleInfo.RoleID, userRoleStatus, true, Null.NullDate, Null.NullDate);
            if (roleInfo.Status == RoleStatus.Pending)
            {
                //Send notification to Group Moderators to approve/reject group.
                notifications.AddGroupNotification(Constants.GroupPendingNotification, GroupViewTabId, ModuleId, roleInfo, UserInfo, modRoles);
            }
            else
            {
                //Send notification to Group Moderators informing of new group.
                notifications.AddGroupNotification(Constants.GroupCreatedNotification, GroupViewTabId, ModuleId, roleInfo, UserInfo, modRoles);

                //Add entry to journal.
                GroupUtilities.CreateJournalEntry(roleInfo, UserInfo);
            }

            Response.Redirect(Globals.NavigateURL(GroupViewTabId, "", new String[] { "groupid=" + roleInfo.RoleID.ToString() }));
        }
Beispiel #31
0
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            try
            {
                bool blnValid = true;
//                string strTransactionID;
                int intRoleID   = 0;
                int intPortalID = PortalSettings.PortalId;
                int intUserID   = 0;
//                string strDescription;
                double dblAmount = 0;
//                string strEmail;
                bool   blnCancel           = false;
                string strPayPalID         = Null.NullString;
                var    objRoles            = new RoleController();
                var    objPortalController = new PortalController();
                string strPost             = "cmd=_notify-validate";
                foreach (string strName in Request.Form)
                {
                    string strValue = Request.Form[strName];
                    switch (strName)
                    {
                    case "txn_type":     //get the transaction type
                        string strTransactionType = strValue;
                        switch (strTransactionType)
                        {
                        case "subscr_signup":
                        case "subscr_payment":
                        case "web_accept":
                            break;

                        case "subscr_cancel":
                            blnCancel = true;
                            break;

                        default:
                            blnValid = false;
                            break;
                        }
                        break;

                    case "payment_status":     //verify the status
                        if (strValue != "Completed")
                        {
                            blnValid = false;
                        }
                        break;

                    case "txn_id":     //verify the transaction id for duplicates
//                            strTransactionID = strValue;
                        break;

                    case "receiver_email":     //verify the PayPalId
                        strPayPalID = strValue;
                        break;

                    case "mc_gross":     // verify the price
                        dblAmount = double.Parse(strValue);
                        break;

                    case "item_number":     //get the RoleID
                        intRoleID = Int32.Parse(strValue);
                        //RoleInfo objRole = objRoles.GetRole(intRoleID, intPortalID);
                        break;

                    case "item_name":     //get the product description
//                            strDescription = strValue;
                        break;

                    case "custom":     //get the UserID
                        intUserID = Int32.Parse(strValue);
                        break;

                    case "email":     //get the email
//                            strEmail = strValue;
                        break;
                    }

                    //reconstruct post for postback validation
                    strPost += string.Format("&{0}={1}", Globals.HTTPPOSTEncode(strName), Globals.HTTPPOSTEncode(strValue));
                }

                //postback to verify the source
                if (blnValid)
                {
                    Dictionary <string, string> settings = PortalController.GetPortalSettingsDictionary(PortalSettings.PortalId);
                    string strPayPalURL;

                    // Sandbox mode
                    if (settings.ContainsKey("paypalsandbox") && !String.IsNullOrEmpty(settings["paypalsandbox"]) && settings["paypalsandbox"].Equals("true", StringComparison.InvariantCultureIgnoreCase))
                    {
                        strPayPalURL = "https://www.sandbox.paypal.com/cgi-bin/webscr?";
                    }
                    else
                    {
                        strPayPalURL = "https://www.paypal.com/cgi-bin/webscr?";
                    }
                    var objRequest = Globals.GetExternalRequest(strPayPalURL);
                    objRequest.Method        = "POST";
                    objRequest.ContentLength = strPost.Length;
                    objRequest.ContentType   = "application/x-www-form-urlencoded";
                    using (var objStream = new StreamWriter(objRequest.GetRequestStream()))
                    {
                        objStream.Write(strPost);
                    }

                    string strResponse;
                    using (var objResponse = (HttpWebResponse)objRequest.GetResponse())
                    {
                        using (var sr = new StreamReader(objResponse.GetResponseStream()))
                        {
                            strResponse = sr.ReadToEnd();
                        }
                    }
                    switch (strResponse)
                    {
                    case "VERIFIED":
                        break;

                    default:
                        //possible fraud
                        blnValid = false;
                        break;
                    }
                }
                if (blnValid)
                {
                    int        intAdministratorRoleId = 0;
                    string     strProcessorID         = Null.NullString;
                    PortalInfo objPortalInfo          = objPortalController.GetPortal(intPortalID);
                    if (objPortalInfo != null)
                    {
                        intAdministratorRoleId = objPortalInfo.AdministratorRoleId;
                        strProcessorID         = objPortalInfo.ProcessorUserId.ToLower();
                    }

                    if (intRoleID == intAdministratorRoleId)
                    {
                        //admin portal renewal
                        strProcessorID = Host.ProcessorUserId.ToLower();
                        float portalPrice = objPortalInfo.HostFee;
                        if ((portalPrice.ToString() == dblAmount.ToString()) && (HttpUtility.UrlDecode(strPayPalID.ToLower()) == strProcessorID))
                        {
                            objPortalController.UpdatePortalExpiry(intPortalID);
                        }
                        else
                        {
                            var objEventLog     = new EventLogController();
                            var objEventLogInfo = new LogInfo();
                            objEventLogInfo.LogPortalID   = intPortalID;
                            objEventLogInfo.LogPortalName = PortalSettings.PortalName;
                            objEventLogInfo.LogUserID     = intUserID;
                            objEventLogInfo.LogTypeKey    = "POTENTIAL PAYPAL PAYMENT FRAUD";
                            objEventLog.AddLog(objEventLogInfo);
                        }
                    }
                    else
                    {
                        //user subscription
                        RoleInfo objRoleInfo = TestableRoleController.Instance.GetRole(intPortalID, r => r.RoleID == intRoleID);
                        float    rolePrice   = objRoleInfo.ServiceFee;
                        float    trialPrice  = objRoleInfo.TrialFee;
                        if ((rolePrice.ToString() == dblAmount.ToString() || trialPrice.ToString() == dblAmount.ToString()) && (HttpUtility.UrlDecode(strPayPalID.ToLower()) == strProcessorID))
                        {
                            objRoles.UpdateUserRole(intPortalID, intUserID, intRoleID, blnCancel);
                        }
                        else
                        {
                            var objEventLog     = new EventLogController();
                            var objEventLogInfo = new LogInfo();
                            objEventLogInfo.LogPortalID   = intPortalID;
                            objEventLogInfo.LogPortalName = PortalSettings.PortalName;
                            objEventLogInfo.LogUserID     = intUserID;
                            objEventLogInfo.LogTypeKey    = "POTENTIAL PAYPAL PAYMENT FRAUD";
                            objEventLog.AddLog(objEventLogInfo);
                        }
                    }
                }
            }
            catch (Exception exc) //Page failed to load
            {
                Exceptions.ProcessPageLoadException(exc);
            }
        }
Beispiel #32
0
 void Awake()
 {
     _instance = this;
     roleController=this.GetComponent<RoleController>();
     itemDBController = this.GetComponent<InventoryItemDBController>();
 }
    void Start()
    {
        EventDelegate.Set(btn_start_user.onClick, () => { On_Start_Username_Click();});
        EventDelegate.Set(btn_start_server.onClick, () => { On_Start_Server_Click();});
        EventDelegate.Set(btn_start_enter.onClick, () => { On_Start_Enter_Click();});

        EventDelegate.Set(btn_login_login.onClick, () => { On_Login_login_Click(); });
        EventDelegate.Set(btn_login_reg.onClick, () => { On_Login_reg_Click(); });
        EventDelegate.Set(btn_login_close.onClick, () => { On_Login_close_Click();});

        EventDelegate.Set(btn_reg_cancel.onClick, () => { On_Reg_cancel_Click(); });
        EventDelegate.Set(btn_reg_reg.onClick, () => { On_Reg_reg_Click(); });
        EventDelegate.Set(btn_reg_close.onClick, () => { On_Reg_close_Click(); });
        EventDelegate.Set(btn_server_selected.onClick, () => {On_server_selected_Click(); });

        EventDelegate.Set(btn_select_return.onClick, () => { On_select_return_Click(); });
        EventDelegate.Set(btn_select_change.onClick, () => { On_select_change_Click(); });

        EventDelegate.Set(btn_selectshow_sure.onClick, () => { On_selectedshow_sure_click(); });
        EventDelegate.Set(btn_selectshow_back.onClick, () => { On_selectedshow_back_Clik(); });
        if(instance==null)
        {
            instance = this;
        }
        login = this.GetComponent<LoginController>();
        register = this.GetComponent<RegisterController>();
        roleControll = this.GetComponent<RoleController>();

        roleControll.OnGetRole += this.OnGetRole;
        roleControll.OnGetEmptyRole += this.OnGetEmptyRole;
        roleControll.OnAddRole += this.OnAddRole;
        roleControll.OnseletRole += this.OnSelectRole;
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            IncludeLanguageJS();

            GetPortalCommonInfo(out storeID, out portalID, out customerID, out userName, out cultureName, out sessionCode);
            AspxCommonInfo aspxCommonObj = new AspxCommonInfo(storeID, portalID, userName, cultureName, customerID, sessionCode);

            List<CouponSession> cs = new List<CouponSession>();
            cs = CheckOutSessions.Get<List<CouponSession>>("CouponSession");
            Coupon = json_serializer.Serialize(cs);

            List<GiftCardUsage> gc = CheckOutSessions.Get<List<GiftCardUsage>>("UsedGiftCard");
            GiftCard = json_serializer.Serialize(gc);

            Discount = CheckOutSessions.Get<Decimal>("DiscountAmount", 0);

            string templateName = TemplateName;
            IncludeCss("CheckOutInformationContent", "/Templates/" + templateName + "/css/MessageBox/style.css", "/Templates/" + templateName + "/css/JQueryUIFront/jquery.ui.all.css",
                "/Templates/" + templateName + "/css/ToolTip/tooltip.css", "/Modules/AspxCommerce/AspxCheckoutWithSingleAddress/css/module.css");
            IncludeJs("CheckOutInformationContent", "/js/encoder.js", "/js/FormValidation/jquery.validate.js", "/js/jquery.cookie.js", "/js/MessageBox/jquery.easing.1.3.js", "/js/MessageBox/alertbox.js", "/js/jquery.tipsy.js", "/Modules/AspxCommerce/AspxCheckoutWithSingleAddress/js/SingleCheckOut.js");

            ssc.GetStoreSettingParamEleven(StoreSetting.DefaultProductImageURL, StoreSetting.ShoppingCartURL, StoreSetting.MyAccountURL,
                StoreSetting.AllowedShippingCountry, StoreSetting.AllowedBillingCountry, StoreSetting.SingleCheckOutURL,
                StoreSetting.DimensionUnit, StoreSetting.WeightUnit, StoreSetting.AskCustomerToSubscribe, StoreSetting.ShipDetailPageURL,
                StoreSetting.AllowUsersToCreateMultipleAddress, out noImageCheckOutInfoPath, out ShoppingCartURL, out myAccountURL,
                out AllowededShippingCountry, out AllowededBillingCountry, out SingleAddressCheckOutURL, out DimentionalUnit,
                out WeightUnit, out ShowSubscription, out ShippingDetailPage, out allowMultipleAddress, storeID, portalID, cultureName);

            if (!IsPostBack)
            {

                HideSignUp();
                PasswordAspx.Attributes.Add("onkeypress", "return clickButton(event,'" + LoginButton.ClientID + "')");

                if (!IsParent)
                {
                    hypForgotPassword.NavigateUrl =
                        ResolveUrl(GetParentURL + "/portal/" + GetPortalSEOName + "/sf/" +
                                   pagebase.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalForgotPassword) + SageFrameSettingKeys.PageExtension);
                }
                else
                {
                    hypForgotPassword.NavigateUrl =
                        ResolveUrl("~/sf/" + pagebase.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalForgotPassword) +
                                  SageFrameSettingKeys.PageExtension);
                }
                string registerUrl =
                    ResolveUrl("~/sf/" + pagebase.GetSettingValueByIndividualKey(SageFrameSettingKeys.PortalUserRegistration) +
                               SageFrameSettingKeys.PageExtension);
                signup.Attributes.Add("href", ResolveUrl("~/sf/sfUser-Registration" + SageFrameSettingKeys.PageExtension));
                signup1.Attributes.Add("href", ResolveUrl("~/sf/sfUser-Registration" + SageFrameSettingKeys.PageExtension));

                if (Boolean.Parse(pagebase.GetSettingValueByIndividualKey(SageFrameSettingKeys.RememberCheckbox)))
                {
                    RememberMe.Visible = true;
                    lblrmnt.Visible = true;
                }
                else
                {
                    RememberMe.Visible = false;
                    lblrmnt.Visible = false;
                }

                object serverVars = new
                {
                    noImageCheckOutInfoPath = noImageCheckOutInfoPath,
                    ShoppingCartURL = ShoppingCartURL,
                    myAccountURL = myAccountURL,
                    singleAddressCheckOutURL = SingleAddressCheckOutURL,
                    CartUrl = ShoppingCartURL,
                    AllowedShippingCountry = AllowededShippingCountry,
                    AllowedBillingCountry = AllowededBillingCountry,
                    dimentionalUnit = DimentionalUnit,
                    weightunit = WeightUnit,
                    showSubscription = ShowSubscription,
                    allowMultipleAddress = allowMultipleAddress,
                    shippingDetailPage = ShippingDetailPage,
                    Discount = Discount

                };

                ServerVars = json_serializer.Serialize(serverVars);
                LoadCartDetails(aspxCommonObj);
                LoadCountry();
                LoadAddress(aspxCommonObj);
                LoadPaymentGateway(aspxCommonObj);
                LoadRewardPoints(aspxCommonObj);
            }


            if (HttpContext.Current.User != null)
            {
                SecurityPolicy objSecurity = new SecurityPolicy();
                FormsAuthenticationTicket ticket = objSecurity.GetUserTicket(GetPortalID);
                if (ticket != null && ticket.Name != ApplicationKeys.anonymousUser)
                {
                    int LoggedInPortalID = int.Parse(ticket.UserData.ToString());
                    string[] sysRoles = SystemSetting.SUPER_ROLE;
                    MembershipController member = new MembershipController();
                    UserInfo userDetail = member.GetUserDetails(GetPortalID, GetUsername);
                    if (GetPortalID == LoggedInPortalID || Roles.IsUserInRole(userDetail.UserName, sysRoles[0]))
                    {
                        RoleController _role = new RoleController();
                        string userinroles = _role.GetRoleNames(GetUsername, LoggedInPortalID);
                        if (userinroles != "" || userinroles != null)
                        {
                            MultiView1.ActiveViewIndex = 1;
                        }
                        else
                        {
                            MultiView1.ActiveViewIndex = 0;
                        }
                    }
                    else
                    {
                        MultiView1.ActiveViewIndex = 0;
                    }
                }
                else
                {
                    MultiView1.ActiveViewIndex = 0;
                }
            }

        }
        catch (Exception ex)
        {
            ProcessException(ex);
        }

    }
Beispiel #35
0
        protected void SucessFullLogin(UserInfo user)
        {
            RoleController role = new RoleController();

            Session[SessionKeys.LoginHitCount] = null;
            string userRoles = role.GetRoleNames(user.UserName, GetPortalID);

            strRoles += userRoles;
            if (strRoles.Length > 0)
            {
                SetUserRoles(strRoles);
                SessionTracker sessionTracker = (SessionTracker)Session[SessionKeys.Tracker];
                sessionTracker.PortalID      = GetPortalID.ToString();
                sessionTracker.Username      = UserName.Text;
                Session[SessionKeys.Tracker] = sessionTracker;
                SageFrame.Web.SessionLog SLog = new SageFrame.Web.SessionLog();
                SLog.SessionTrackerUpdateUsername(sessionTracker, sessionTracker.Username, GetPortalID.ToString());
                StringBuilder redirectURL = new StringBuilder();
                if (Request.QueryString["ReturnUrl"] != null)
                {
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                     user.UserName,
                                                                                     DateTime.Now,
                                                                                     DateTime.Now.AddMinutes(30),
                                                                                     true,
                                                                                     GetPortalID.ToString(),
                                                                                     FormsAuthentication.FormsCookiePath);
                    // Encrypt the ticket.
                    string encTicket = FormsAuthentication.Encrypt(ticket);
                    // Create the cookie.
                    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName + "_" + GetApplicationName + "_" + GetPortalID, encTicket));
                    string PageNotFoundPage      = PortalAPI.PageNotFoundURLWithRoot;
                    string UserRegistrationPage  = PortalAPI.RegistrationURLWithRoot;
                    string PasswordRecoveryPage  = PortalAPI.PasswordRecoveryURLWithRoot;
                    string ForgotPasswordPage    = PortalAPI.ForgotPasswordURL;
                    string PageNotAccessiblePage = PortalAPI.PageNotAccessibleURLWithRoot;

                    string ReturnUrlPage = Request.QueryString["ReturnUrl"].Replace("%2f", "-").ToString();

                    if (ReturnUrlPage == PageNotFoundPage || ReturnUrlPage == UserRegistrationPage || ReturnUrlPage == PasswordRecoveryPage || ReturnUrlPage == ForgotPasswordPage || ReturnUrlPage == PageNotAccessiblePage)
                    {
                        redirectURL.Append("~/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                    else
                    {
                        redirectURL.Append(ResolveUrl(Request.QueryString["ReturnUrl"].ToString()));
                    }
                }
                else
                {
                    FormsAuthenticationTicket ticket = new FormsAuthenticationTicket(1,
                                                                                     user.UserName,
                                                                                     DateTime.Now,
                                                                                     DateTime.Now.AddMinutes(30),
                                                                                     true,
                                                                                     GetPortalID.ToString(),
                                                                                     FormsAuthentication.FormsCookiePath);

                    // Encrypt the ticket.
                    string encTicket = FormsAuthentication.Encrypt(ticket);

                    // Create the cookie.
                    Response.Cookies.Add(new HttpCookie(FormsAuthentication.FormsCookieName + "_" + GetApplicationName + "_" + GetPortalID, encTicket));
                    if (GetPortalID > 1)
                    {
                        redirectURL.Append("~/portal/");
                        redirectURL.Append(GetPortalSEOName);
                        redirectURL.Append("/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                    else
                    {
                        redirectURL.Append("~/");
                        redirectURL.Append(PortalAPI.DefaultPageWithExtension);
                    }
                }
                HttpContext.Current.Session["IsLoginClick" + user.UserName] = true;
                Response.Redirect(redirectURL.ToString(), false);
            }
            else
            {
                FailureText.Text = string.Format("<p class='sfError'>{0}</p>", GetSageMessage("UserLogin", "Youarenotauthenticatedtothisportal"));//"You are not authenticated to this portal!";
            }
        }
        /// <summary>
        /// Gets an HTML formatted string representing the specified event <paramref name="id" />.
        /// </summary>
        /// <param name="id">The event ID.</param>
        /// <returns>A string.</returns>
        /// <exception cref="System.Web.Http.HttpResponseException">Thrown when the event does not exist in the data store,
        /// the user does not have permission to view it, or some other error occurs.</exception>
        public string Get(int id)
        {
            IEvent appEvent = null;

            try
            {
                appEvent = Factory.GetAppEvents().FindById(id);

                if (appEvent == null)
                {
                    throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)
                    {
                        Content      = new StringContent(String.Format("Could not find event with ID = {0}", id)),
                        ReasonPhrase = "Event Not Found"
                    });
                }

                // If the event has a non-template gallery ID (not all do), then check the user's permission. For those errors without a gallery ID,
                // just assume the user has permission, because there is no way to verify the user can view this event. We could do something
                // that mostly works like verifying the user is a gallery admin for at least one gallery, but the function we are trying to
                // protect is viewing an event message, which is not that important to worry about.
                if (appEvent.GalleryId != GalleryController.GetTemplateGalleryId())
                {
                    SecurityManager.ThrowIfUserNotAuthorized(SecurityActions.AdministerSite | SecurityActions.AdministerGallery, RoleController.GetGalleryServerRolesForUser(), int.MinValue, appEvent.GalleryId, Utils.IsAuthenticated, false, false);
                }

                return(appEvent.ToHtml());
            }
            catch (GallerySecurityException)
            {
                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.Forbidden));
            }
            catch (Exception ex)
            {
                if (appEvent != null)
                {
                    AppEventController.LogError(ex, appEvent.GalleryId);
                }
                else
                {
                    AppEventController.LogError(ex);
                }

                throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content      = Utils.GetExStringContent(ex),
                    ReasonPhrase = "Server Error"
                });
            }
        }
Beispiel #37
0
        protected void Page_Load(object sender, EventArgs e)
        {
            IncludeLanguageJS();
            Extension = SageFrameSettingKeys.PageExtension;
            if (!IsPostBack)
            {
                int logHit = Convert.ToInt32(Session[SessionKeys.LoginHitCount]);
                if (logHit >= 3)
                {
                    dvCaptchaField.Visible = true;
                    InitializeCaptcha();
                    GenerateCaptchaImage();
                }
                else
                {
                    dvCaptchaField.Visible = false;
                }

                Refresh.ImageUrl = GetTemplateImageUrl("imgrefresh.png", true);
                HideSignUp();
                Password.Attributes.Add("onkeypress", "return clickButton(event,'" + LoginButton.ClientID + "')");
                if (GetPortalID > 1)
                {
                    hypForgotPassword.NavigateUrl =
                        ResolveUrl("~/portal/" + GetPortalSEOName + "/sf/" +
                                   pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalForgotPassword) + Extension);
                }
                else
                {
                    hypForgotPassword.NavigateUrl =
                        ResolveUrl("~/sf/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalForgotPassword) +
                                   Extension);
                }
                string registerUrl =
                    ResolveUrl("~/sf/" + pagebase.GetSettingsByKey(SageFrameSettingKeys.PortalUserRegistration) +
                               Extension);

                if (pagebase.GetSettingBollByKey(SageFrameSettingKeys.RememberCheckbox))
                {
                    chkRememberMe.Visible = true;
                    lblrmnt.Visible       = true;
                }
                else
                {
                    chkRememberMe.Visible = false;
                    lblrmnt.Visible       = false;
                }
            }

            FormsAuthenticationTicket ticket = SecurityPolicy.GetUserTicket(GetPortalID);

            if (ticket != null && ticket.Name != ApplicationKeys.anonymousUser)
            {
                int      LoggedInPortalID = int.Parse(ticket.UserData.ToString());
                string[] sysRoles         = SystemSetting.SUPER_ROLE;
                if (GetPortalID == LoggedInPortalID || Roles.IsUserInRole(ticket.Name, sysRoles[0]))
                {
                    RoleController _role       = new RoleController();
                    string         userinroles = _role.GetRoleNames(GetUsername, LoggedInPortalID);
                    if (userinroles != "" || userinroles != null)
                    {
                        MultiView1.ActiveViewIndex = 1;
                    }
                    else
                    {
                        MultiView1.ActiveViewIndex = 0;
                    }
                }
                else
                {
                    MultiView1.ActiveViewIndex = 0;
                }
            }
            else
            {
                MultiView1.ActiveViewIndex = 0;
            }
            // Added For openID services
            divOpenIDProvider.Visible = false;
            if (bool.Parse(pagebase.GetSettingsByKey(SageFrameSettingKeys.ShowOpenID)) == true)
            {
                divOpenIDProvider.Visible = true;
                CheckOpenID();
            }
        }
Beispiel #38
0
        private void GetControl(string view, string options)
        {
            try
            {
                if (!Page.IsPostBack)
                {
                    plhLoader.Controls.Clear();
                }
                ForumBase ctl = null;
                if (view.ToUpperInvariant() == "FORUMVIEW")
                {
                    ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.ForumView());
                }
                else if (view.ToUpperInvariant() == "ADVANCED")
                {
                    ctl = (ForumBase)(LoadControl("~/desktopmodules/activeforums/advanced.ascx"));
                }
                else if ((view.ToUpperInvariant() == Views.Topics.ToUpperInvariant()) || (view.ToUpperInvariant() == "topics".ToUpperInvariant()))
                {
                    ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.TopicsView());
                }
                else if ((view.ToUpperInvariant() == Views.Topic.ToUpperInvariant()) || (view.ToUpperInvariant() == "topic".ToUpperInvariant()))
                {
                    ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.TopicView());
                }
                else if (view.ToUpperInvariant() == "USERSETTINGS".ToUpperInvariant())
                {
                    string ctlPath = string.Empty;
                    ctlPath = "~/DesktopModules/ActiveForums/controls/af_profile.ascx";
                    if (!(System.IO.File.Exists(Server.MapPath(ctlPath))))
                    {
                        ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.ForumView());
                    }
                    else
                    {
                        ctl = (ForumBase)(LoadControl(ctlPath));
                    }
                }
                else
                {
                    // this is where af_post.ascx is used
                    string ctlPath = string.Empty;
                    ctlPath = "~/DesktopModules/ActiveForums/controls/af_" + view + ".ascx";
                    if (!(System.IO.File.Exists(Server.MapPath(ctlPath))))
                    {
                        ctl = (ForumBase)(new DotNetNuke.Modules.ActiveForums.Controls.ForumView());
                    }
                    else
                    {
                        ctl = (ForumBase)(LoadControl(ctlPath));
                    }
                }
                if (ForumId > 0 & ForumInfo != null)
                {
                    ctl.ForumInfo = ForumInfo;
                }
                ctl.ID            = view;
                ctl.ForumId       = ForumId;
                ctl.ForumModuleId = ForumModuleId;
                if (ForumTabId == -1)
                {
                    ForumTabId = TabId;
                }
                ctl.ForumTabId   = ForumTabId;
                ctl.ForumGroupId = ForumGroupId;
                ctl.DefaultForumViewTemplateId  = DefaultForumViewTemplateId;
                ctl.DefaultTopicsViewTemplateId = DefaultTopicsViewTemplateId;
                ctl.DefaultTopicViewTemplateId  = DefaultTopicViewTemplateId;
                ctl.UseTemplatePath             = UseTemplatePath;
                ctl.TemplatePath  = TemplatePath;
                ctl.ParentForumId = ParentForumId;
                if (string.IsNullOrEmpty(ForumIds))
                {
                    ForumIds = UserForumsList;
                }

                if (SocialGroupId > 0)
                {
                    ForumController fc = new ForumController();
                    ForumIds = fc.GetForumIdsBySocialGroup(PortalId, SocialGroupId);

                    if (string.IsNullOrEmpty(ForumIds))
                    {
                        RoleController rc   = new RoleController();
                        RoleInfo       role = rc.GetRole(SocialGroupId, PortalId);
                        //Create new forum
                        bool isPrivate = false;
                        if (!role.IsPublic)
                        {
                            isPrivate = true;
                        }
                        Entities.Modules.ModuleController objModules = new Entities.Modules.ModuleController();
                        Hashtable htSettings = objModules.GetTabModuleSettings(TabModuleId);

                        fc.CreateGroupForum(PortalId, ModuleId, SocialGroupId, Convert.ToInt32(htSettings["ForumGroupTemplate"].ToString()), role.RoleName + " Discussions", role.Description, isPrivate, htSettings["ForumConfig"].ToString());
                        ForumIds = fc.GetForumIdsBySocialGroup(PortalId, SocialGroupId);
                    }
                }
                ctl.ForumIds      = ForumIds;
                ctl.SocialGroupId = SocialGroupId;

                //ctl.PostID = PostID
                ctl.ModuleConfiguration = this.ModuleConfiguration;
                if (!(options == string.Empty))
                {
                    ctl.Params = options;
                }
                ControlsConfig cc = new ControlsConfig();
                cc.AppPath          = Page.ResolveUrl("~/DesktopModules/ActiveForums/");
                cc.ThemePath        = Page.ResolveUrl("~/DesktopModules/ActiveForums/themes/" + MainSettings.Theme + "/");
                cc.TemplatePath     = cc.ThemePath + "templates/";
                cc.SiteId           = PortalId;
                cc.PageId           = TabId;
                cc.InstanceId       = ModuleId;
                cc.User             = ForumUser;
                cc.DefaultViewRoles = Permissions.GetRoleIds(this.ModuleConfiguration.AuthorizedViewRoles.Split(';'), PortalId);
                cc.AdminRoles       = Permissions.GetRoleIds(this.ModuleConfiguration.AuthorizedEditRoles.Split(';'), PortalId);
                cc.ProfileLink      = ""; //GetProfileLink()
                cc.MembersLink      = ""; // GetMembersLink()
                this.ControlConfig  = cc;
                ctl.ControlConfig   = cc;
                LinkControls(ctl.Controls);
                if (!(plhLoader.Controls.Contains(ctl)))
                {
                    plhLoader.Controls.Add(ctl);
                }
                string sOut = null;
                sOut  = System.Environment.NewLine + "<!--  © 2004 - 2013 DNN Corp.,  All Rights Reserved -->" + System.Environment.NewLine;
                sOut += "<!-- Active Forums 5.0  -->" + System.Environment.NewLine;

                Literal lit = new Literal();
                lit.Text = sOut;
                plhLoader.Controls.Add(lit);
            }
            catch (Exception ex)
            {
                DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(this, ex);
            }
        }