public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            if (!(filterContext.Controller is AccountController || filterContext.Controller is HomeController))
            {
                string id = IdStore.GetUserId();

                if (id == null)
                {
                    return;
                }
                else
                {
                    var user = new Users().Single(id);

                    if (user == null)
                    {
                        IdStore.RemoveClientAccess();
                        return;
                    }

                    if (user.IsFirstVisit)
                    {
                        filterContext.Result = new RedirectToRouteResult(new RouteValueDictionary { { "action", "ClickThru" }, { "controller", "Account" } });
                    }
                }

                base.OnActionExecuting(filterContext);
            }
        }
 public UserControllerTests()
 {
     StubIdStore store = new StubIdStore();
     _db = new Users();
     _controller = new UserController(store, new NLogger());
     _act = new AccountController(store, new NLogger());
 }
示例#3
0
 public void Init()
 {
     _jobs.Delete(where: "1=@0", args: 1);
     Users user = new Users();
     var result = user.Register("*****@*****.**", "password", "password");
     valid_user_id = (long)result.UserId;
 }
示例#4
0
        private bool ValidateUser(long userID)
        {
            Users users = new Users();
               dynamic result = users.Single(userID);

               if (result != null)
               return true;
               else
               return false;
        }
 public AccountControllerTests()
 {
     _db = new Users();
     _controller = new AccountController(new StubIdStore(), new NLogger());
 }
 public MembershipSpecs()
 {
     _users = new Users();
 }
 /// <summary>
 /// The overloaded constructor for the Account Controller
 /// </summary>
 /// <param name="idStore">The Forms Authentication Abstraction</param>
 /// <param name="logger">The Logging Abstraction</param>
 public AccountController(IIdStore idStore, ILogger logger)
     : base(idStore, logger)
 {
     _users = new Users();
 }