コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                this.ProfileRedirect(Constants.UserPermission.InternationalUser, null, true);
            }
            else
            {
                //this.ReturnRedirect();
            }

            uxEmailAddress.Attributes["placeholder"] = DictionaryConstants.EnterEmailAddressWatermark;
            uxPassword.Attributes["placeholder"]     = DictionaryConstants.EnterPasswordWatermark;
            uxSignIn.Text = DictionaryConstants.SignInButtonText;

            SignInPageItem context = (SignInPageItem)Sitecore.Context.Item;

            uxForgotPassword.NavigateUrl = ForgotPasswordItem.GetForgotPassword().GetUrl();
            uxForgotPassword.Text        = context.ForgotPasswordText;

            this.Page.Form.DefaultButton = this.uxSignIn.UniqueID;

            if (!string.IsNullOrEmpty(AccessToken))
            {
                doLogin();
            }
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (this.CurrentMember != null && this.CurrentUser != null)
            {
                Response.Redirect(MyAccountItem.GetMyAccountPage().GetUrl());
            }

            //assign placeholders
            uxEmailAddress.Attributes["placeholder"]    = DictionaryConstants.EnterEmailAddressWatermark;
            uxFirstName.Attributes["placeholder"]       = DictionaryConstants.FirstNameWatermark;
            uxPassword.Attributes["placeholder"]        = DictionaryConstants.EnterPasswordWatermark;
            uxPasswordConfirm.Attributes["placeholder"] = DictionaryConstants.ReEnterNewPasswordWatermark;
            uxZipCode.Attributes["placeholder"]         = DictionaryConstants.ZipCodeWatermark;

            //assign button text and mark as default button for form
            uxSubmit.Text = DictionaryConstants.SubmitButtonText;
            this.Page.Form.DefaultButton = this.uxSubmit.UniqueID;

            //setup signup text and navigation
            uxSignIn.Text        = DictionaryConstants.SignInButtonText;
            uxSignIn.NavigateUrl = SignInPageItem.GetSignInPage().GetUrl();

            //set validation
            valFirstName.ErrorMessage           = DictionaryConstants.FirstNameErrorMessage;
            valEmail.ErrorMessage               = valRegEmail.ErrorMessage = DictionaryConstants.EmailAddressErrorMessage;
            valRegEmail.ValidationExpression    = Constants.Validators.Email;
            valPassword.ErrorMessage            = valPasswordConfirm.ErrorMessage = DictionaryConstants.PasswordErrorMessage;
            valRegPassword.ValidationExpression = valRegPasswordConfirm.ValidationExpression = Constants.Validators.Password;
            //TODO: move to dictionary
            valRegPassword.ErrorMessage = valRegPasswordConfirm.ErrorMessage = DictionaryConstants.PasswordErrorMessage;
            //TODO: move to dictionary
            valCompPassword.ErrorMessage    = valCompPasswordConfirm.ErrorMessage = DictionaryConstants.PasswordMatchError;
            valZipCode.ErrorMessage         = DictionaryConstants.ZipCodeErrorMessage;
            valZipCode.ValidationExpression = Constants.Validators.ZipCode;

            if (!string.IsNullOrEmpty(AccessToken))
            {
                var     client = new Facebook.FacebookClient(AccessToken);
                dynamic me     = client.Get("me", new { fields = "name,email" });

                uxEmailAddress.Text = me.email;
                uxFirstName.Text    = me.name;

                var pass = Guid.NewGuid().ToString().Substring(0, 12);

                uxPassword.Attributes["value"]        = pass;
                uxPasswordConfirm.Attributes["value"] = pass;

                uxPassword.Enabled        = false;
                uxPasswordConfirm.Enabled = false;
            }
        }
コード例 #3
0
        public void BaseRegistration_Load(object sender, EventArgs e)
        {
            string facebookId = "var fbAppId = '{0}';";
            string appId      = ConfigurationManager.AppSettings[Constants.Settings.FacebookAppId];

            Page.ClientScript.RegisterClientScriptBlock(GetType(), "fbAppId", string.Format(facebookId, appId), true);

            var item = Sitecore.Context.Item;

            if (this.CurrentMember == null && this.CurrentUser == null && item.TemplateID.ToGuid() != Guid.Parse(SignInPageItem.TemplateId) && item.TemplateID.ToGuid() != Guid.Parse(SignUpPageItem.TemplateId))
            {
                Response.Redirect(SignInPageItem.GetSignInPage().GetUrl());
            }
        }
コード例 #4
0
        protected void Page_Load(object sender, EventArgs e)
        {
            HomePageItem ContextItem = Sitecore.Context.Item;

            CompleteMyProfileUrl = IsUserLoggedIn
                ? MyProfileStepOneItem.GetCompleteMyProfileStepOne().GetUrl()
                : SignInPageItem.GetSignInPage().GetUrl();

            if (UnauthenticatedSessionMember != null)
            {
                ActiveMember = UnauthenticatedSessionMember;
            }

            //Load Text
            litHelpmsg.Text        = DictionaryConstants.HowCanHelp;
            litStruggle.Text       = DictionaryConstants.ChildStruggles;
            litStruggle2.Text      = DictionaryConstants.ChildStruggles;
            litStruggle3.Text      = DictionaryConstants.ChildStruggles;
            litSelectAll.Text      = DictionaryConstants.SelectAll;
            litChildEnrolled.Text  = DictionaryConstants.ChildEnrolled;
            litChildEnrolled2.Text = DictionaryConstants.ChildEnrolled;
            litComplete1.Text      = DictionaryConstants.CompleteMyProfile;
            btnSubmit.Text         = DictionaryConstants.SeeMyRecommendationsButtonText;

            if (!IsPostBack)
            {
                GetSliderItem(ContextItem);

                InitGuideMe();
            }
            else
            {
                // Non-standard controls used for grades, values stored in hidden field via JS
                if (!String.IsNullOrEmpty(hfGradeChoice.Value))
                {
                    SetSelectedGrade(hfGradeChoice.Value);
                }
            }
        }
コード例 #5
0
 protected void lbSignIn_Click(object sender, EventArgs e)
 {
     Logout(SignInPageItem.GetSignInPage().GetUrl());
 }
        protected void lnkSignIn_Click(object sender, EventArgs e)
        {
            AuthorizeInternationalUser();

            Response.Redirect(SignInPageItem.GetSignInPage().GetUrl());
        }
コード例 #7
0
        /// <summary>
        /// Function to save the current page reference in session and redirect to signup/signin page
        /// </summary>
        /// <param name="currentPage"></param>
        /// <param name="permission">Defines user permission for current action to be performed</param>
        /// <param name="UrlToGoto">Alternative URL to be redirected (Note: Session reference to previous page will be cleared).</param>
        static public void ProfileRedirect(this BaseSublayout page, UnderstoodDotOrg.Common.Constants.UserPermission permission, string UrlToGoto = null, bool preserveURL = false)
        {
            // only set redirect if we don't already have a place to go back to - this will allow us to "chain" permission checks without losing original return URL
            if (page.Session[Constants.SessionPreviousUrl] == null && !preserveURL)
            {
                page.Session[Constants.SessionPreviousUrl] = page.Page.Request.RawUrl;
            }

            switch (permission)
            {
            case Constants.UserPermission.CommunityUser:
                //is user logged in?
                if (page.CurrentMember == null)
                {
                    //not logged in, please log in
                    page.Page.Response.Redirect(SignInPageItem.GetSignInPage().GetUrl());
                }
                else
                {
                    //is user registered for community?
                    if (String.IsNullOrEmpty(page.CurrentMember.ScreenName))
                    {
                        //redirect to community sign-up
                        redirect(page, RegisterCommunityProfileItem.GetRegisterCommunityProfilePage().GetUrl());
                    }
                }
                break;

            case Constants.UserPermission.RegisteredUser:
                //is user logged in?
                if (page.CurrentMember == null)
                {
                    //not logged in, please log in
                    redirect(page, SignInPageItem.GetSignInPage().GetUrl());
                }
                break;

            case Constants.UserPermission.AnonymousUser:
                break;

            case Constants.UserPermission.AdminUser:
                break;

            case Constants.UserPermission.Moderator:
                break;

            case Constants.UserPermission.Blogger:
                break;

            case Constants.UserPermission.Expert:
                break;

            case Constants.UserPermission.InternationalUser:
                //redirect to international user page
                if (page.isInternationalUser == Constants.GeoIPLookup.InternationalStatus.UnknownInternationalUser)
                {
                    redirect(page, InternationalUserPageItem.GetInternationalUserPage().GetUrl());
                }
                break;

            case Constants.UserPermission.AgreedToTerms:
                //redirect to T&C if they have not agreed yet
                var termsUrl = TermsandConditionsItem.GetTermsAndConditionsPage().GetUrl();

                if (page.CurrentMember != null && !page.CurrentMember.AgreedToSignUpTerms && !page.Request.RawUrl.Contains(termsUrl))
                {
                    redirect(page, termsUrl);
                }
                break;

            case Constants.UserPermission.CanPersonalize:
                if (page.CurrentMember == null)
                {
                    redirect(page, SignInPageItem.GetSignInPage().GetUrl());
                }
                else
                {
                    if (page.CurrentMember.Children == null || page.CurrentMember.Children.Count == 0)
                    {
                        redirect(page, RegisterChildInformationItem.GetRegisterChildInfoPage().GetUrl());
                    }
                }

                break;

            default:
                break;
            }

            if (!preserveURL)
            {
                //everything's fine, redirect to page if it was passed
                page.Page.Session[Constants.SessionPreviousUrl] = null;
            }

            if (!String.IsNullOrEmpty(UrlToGoto))
            {
                redirect(page, UrlToGoto);
            }
        }
コード例 #8
0
 void btnAnonConnect_Click(object sender, EventArgs e)
 {
     // TODO: implement redirect manager
     Response.Redirect(SignInPageItem.GetSignInPage().GetUrl());
 }