コード例 #1
0
 public override void DoProcessRequest(IExecutionContext context)
 {
     // The runtime will react to the null by setting the Anonymous 
     // profile as the current user. the other option is the Abandon
     // method on the context.
     context.Authenticate(null);
 }
コード例 #2
0
        public override void DoProcessRequest(IExecutionContext context)
        {
            userProfile profile = UserHelper.Instance.LoadUser(username);
            if (profile == null || !profile.Authenticate(password))
            {
                ReportError(null, "The user name or password is incorrect");
                return;
            }

            else
                // this is the key line. this sets the profile as the 
                // current user, and marks the session as authenticated
                context.Authenticate(profile);

            if (ContentTypeHelper.Instance.Parse(defaultContentType) != profile.UserType.ContentType)
                defaultContentType = ContentTypeHelper.Instance.GetSimpleName(profile.UserType.ContentType);

            // hack. we didn't create a table to store the roles, so now 
            // we're faking them through here
            if (profile.UserType.Equals(UserType.Company)) {
                var node = profile.role.AppendNode();
                node.Name = "company";
            }

            if (String.IsNullOrEmpty(originalRequest))
                context.Transfer("/default");
            else
                context.Transfer(HttpUtility.UrlDecode(originalRequest));
        }
コード例 #3
0
        /// <summary>
        /// Controller implementation. User signout is performed by calling Authenticate with null as the
        /// user.
        /// </summary>
        /// <param name="context">The context.</param>
        public override void DoProcessRequest(IExecutionContext context)
        {
            FormsAuth.SignOut();
            context.Authenticate(null);

            context.Transfer("home/index");
        }
コード例 #4
0
        /// <summary>
        /// Controller implementation. User signout is performed by calling Authenticate with null as the 
        /// user. 
        /// </summary>
        /// <param name="context">The context.</param>
        public override void DoProcessRequest(IExecutionContext context)
        {
            FormsAuth.SignOut();
            context.Authenticate(null);

            context.Transfer("home/index");
        }
コード例 #5
0
        /// <summary>
        /// Controller implementation
        /// </summary>
        /// <param name="context">The context.</param>
        public override void DoProcessRequest(IExecutionContext context)
        {
            if (!ValidateLogon())
                return;

            context.Authenticate(FormsAuth.SignIn(username, rememberMe));

            context.Transfer("/home/index");
        }
コード例 #6
0
        /// <summary>
        /// Controller implementation
        /// </summary>
        /// <param name="context">The context.</param>
        public override void DoProcessRequest(IExecutionContext context)
        {
            if (!ValidateLogon())
            {
                return;
            }

            context.Authenticate(FormsAuth.SignIn(username, rememberMe));

            context.Transfer("/home/index");
        }
コード例 #7
0
        public override void DoProcessRequest(IExecutionContext context)
        {
            UserProfile profile = UserDataAccess.Instance.LoadUser(username);
            if (profile == null || !profile.Authenticate(password))
            {
                ReportError(null, "The user name or password is incorrect");
                return;
            }

            else
                // this is the key line. this sets the profile as the 
                // current user, and marks the session as authenticated
                context.Authenticate(profile);

            ContentType userContentType = UserTypeUtility.AsContentType(profile.UserType);
            if (ContentTypeUtility.FromString(defaultContentType) != userContentType)
                defaultContentType = ContentTypeUtility.AsString(userContentType);

            if (String.IsNullOrEmpty(originalRequest))
                context.Transfer("/default");
            else
                context.Transfer(HttpUtility.UrlDecode(originalRequest));
        }