public ActionResult Confirm()
        {
            var user = AuthenticationService.GetUser();
            User user1 = new SignInHandler().Find3(user.Id);

            if (user1.Banned)
            {
                if (user1.ModifiedDate <= System.DateTime.Now)
                    return RedirectToAction("BannedAccount");
            }

            Master master = new SignInHandler().Find4();
            var Token = new SwissKip.Web.Queries.TokenQuery(user.Id).ExecuteNew();
            //if (Token.Count != 0)
            //{
            Token[0].TokenSeconds = master.TokenExpirationTime;
            Session["Trying"] = Token[0];
            Session["AccessDenied"] = 1;
            return View(Token[0]);
            //}
            //else
            //{
            //    string message = "You have not completed your personal info yet!";
            //    ModelState.AddModelError("Error", message);
            //    return this.View();
            //}
        }
        public ActionResult ChangePassword(SignInModel model, string returnUrl)
        {
            User user = null;

            try
            {
                user = new SignInHandler().Handle2(model);
                return RedirectToAction("SignIn");
            }
            catch (ValidationException e)
            {
                ModelState.AddModelError(e.Key, e.Message);
                return this.View();
            }
        }
Ejemplo n.º 3
0
        public ActionResult Index()
        {
            var ownerPanelModel = new OwnerPanelQuery(Current.UserId).Execute();
            Session["username"] = Current.User.UserName;
            var folder = Server.MapPath("~/Swisskip/" + Current.User.UserName);

            //Getting Max. MB per trial version
            Master master = new SignInHandler().Find4();
            ownerPanelModel.MyAccountWidget.MaxSize = master.Size + "MB";
            ownerPanelModel.MyAccountWidget.Size = ((CalculateFolderSize(folder) / 1000) / (master.Size * 1024)).ToString("####0.00") +"%";
            return View(ownerPanelModel);
        }
        public ActionResult Confirm(int? userId, BasicInfoModel form)
        {
            BasicInfoModel data = (BasicInfoModel)Session["Trying"];
            User user = null;
            if (ModelState.IsValid)
            {
                try
                {
                    user = new SignInHandler().Handle3(form, data);
                    if (user.Banned)
                        return RedirectToAction("BannedAccount");
                }
                catch (ValidationException e)
                {
                    ModelState.AddModelError(e.Key, e.Message);
                }
            }

            if (!ModelState.IsValid)
            {
                Session["Trying"] = data;
                Session["AccessDenied"] = 1;
                return this.View(data);
            }

            Session["AccessDenied"] = 0;
            if (!user.IsOwner)
                return new RedirectToAccountType(user);

            return RedirectToAction("Index", "Owner");
        }
        public ActionResult SignIn(string V, string type, SignInModel model, string returnUrl)
        {
            User user = null;
            if (ModelState.IsValid)
            {
                try
                {
                    user = new SignInHandler().Handle(model);
                    if (user.Banned)
                        return RedirectToAction("BannedAccount");
                    //if (user.Blocked)
                    //    return RedirectToAction("BlockedAccount");

                    if (type != null)
                    {
                        Session["AccessDenied"] = 1;
                        return RedirectToAction("Signin2", "Registration", new { userId = V, type = type });
                    }
                }
                catch (ValidationException e)
                {
                    ModelState.AddModelError(e.Key, e.Message);
                }
            }
            else
            {
                ModelState.AddModelError("", "Forgot username or passoword");
                return this.View();
            }

            if (!ModelState.IsValid)
                return this.View();

            AuthenticationService.SignIn(user);
            Session["path"] = Server.MapPath("~/Swisskip/") + user.UserName;

            //Sent TOKEN by email
            int newValue = SignInHandler.SendInvitation(user);

            //Added Token into account
            UsersAddHandler usersAddHandler = new UsersAddHandler();
            user.TokenNumber = newValue;
            usersAddHandler.Update(user);

            //Validating data entry

            if (user.ColourId == 0 && user.IsOwner == false)
            {
                return RedirectToAction("Reminder");
            }
            else if (user.ColourId == 0 && user.IsOwner)
            {
                return RedirectToAction("MissingInfo", new { id = user.Id });
            }

            Session["AccessDenied"] = 1;
            return RedirectToAction("Confirm");
        }
        public ActionResult SignIn(int? V)
        {
            try
            {
                var user = AuthenticationService.GetUser();
                User user1 = new SignInHandler().Find3(user.Id);

                if (user1.Banned)
                {
                    if (user1.ModifiedDate <= System.DateTime.Now)
                        return RedirectToAction("BannedAccount");
                }
            }
            catch {

            }

            return View();
        }
 public ActionResult MissingInfo(int id)
 {
     //Handled User ID
     User user = new SignInHandler().Find3(id);
     Session["user"] = user;
     return View();
 }
        public ActionResult Maintained(int? userId, SignInModel model, string returnUrl)
        {
            User user = null;
            if (ModelState.IsValid)
            {
                try
                {
                    user = new SignInHandler().Handle(model);
                    if (user.Banned)
                        return RedirectToAction("BannedAccount");
                    //if (user.Blocked)
                    //    return RedirectToAction("BlockedAccount");
                }
                catch (ValidationException e)
                {
                    ModelState.AddModelError(e.Key, e.Message);
                }
            }
            else
            {
                ModelState.AddModelError("", "Forgot username or passoword");
                return this.View();
            }

            if (!ModelState.IsValid)
                return this.View();

            AuthenticationService.SignIn(user);
            Session["path"] = Server.MapPath("~/Swisskip/") + user.UserName;

            //Sent TOKEN by email
            int newValue = SignInHandler.SendInvitation(user);

            //Added Token into account
            UsersAddHandler usersAddHandler = new UsersAddHandler();
            user.TokenNumber = newValue;
            usersAddHandler.Update(user);

            return RedirectToAction("Confirm");
        }