public ActionResult Login(Models.Membership model, FacultyTable faculty) { using (var context = new MailProEntities()) { FacultyTable Fac = new FacultyTable(); FacultyTable faculty1 = new FacultyTable(); faculty1 = context.FacultyTable.SingleOrDefault(m => m.FacultyEmail == model.FacultyEmail); var abc = faculty1.IsEmailVerified; Fac = context.FacultyTable.SingleOrDefault(n => n.FacultyEmail == model.FacultyEmail); int fid = Fac.FacultyID; var y = Crypto.Hash(model.Password); bool IsValid = context.FacultyTable.Any(x => x.FacultyEmail == model.FacultyEmail && x.Password == y && abc != null); if (IsValid) { FormsAuthentication.SetAuthCookie(model.FacultyEmail, false); Session["FacultyID"] = fid; return(RedirectToAction("ShowSentEmail", "Email")); } else { ViewBag.Msg = "Invalid Email or Password"; } context.SaveChanges(); ModelState.AddModelError("", "Invalid Email or Password"); return(View()); } }
public ActionResult Login(Models.Membership model) { var result = db.Users.Where(a => a.UserName == model.UserName && a.Password == model.Password).ToList(); if (result.Count > 0) { Session["Id"] = result[0].UserId; FormsAuthentication.SetAuthCookie(result[0].UserName, false); if (result[0].Isadmin == 1) { return(RedirectToAction("Front", "Admin")); } if (result[0].Isadmin == 2) { return(RedirectToAction("Index", "User")); } } else { ModelState.AddModelError("", "invalid username and password"); } return(View(model)); }
public ActionResult VerifyAccount(string id, Models.Membership model) { bool status = false; using (var context = new MailProEntities()) { FacultyTable Fac = new FacultyTable(); //Mp.Configuration.ValidateOnSaveEnabled = false; var v = context.FacultyTable.Where(a => a.ActivationCode == new Guid(id)).FirstOrDefault(); if (v != null) { Fac.IsEmailVerified = true; v.IsEmailVerified = Convert.ToBoolean(Fac.IsEmailVerified); context.SaveChanges(); status = true; } else { ViewBag.Message = "invalid request"; } Session["IsEmailVerified"] = model.IsEmailVerified; } ViewBag.Status = status; return(View()); }
public async Task <IActionResult> OnPostAsync() { if (!ModelState.IsValid) { return(Page()); } try { await repo.SaveMembershipAsync(Membership); } catch (DbUpdateConcurrencyException) { Models.Membership x = await repo.GetMembershipAsync(Membership.TeamId, Membership.PersonId); if (x == null) { return(NotFound()); } else { throw; } } return(RedirectToPage("MembershipIndex", new { teamId = Membership?.TeamId })); }
public ActionResult Login(Models.Membership model) { using (var context = new DBSIMSEntities()) { bool isValid = false; var query = context.User.FirstOrDefault(u => u.UserName == model.UserName && u.Password == model.Password); if (model != null) { isValid = true; } // String.Compare(u.Password, model.Password, false) == 0 // bool isValid = context.User.Any(x => x.UserName == model.UserName && x.Password == model.Password); if (isValid) { FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction("Index", "Staff")); } else { ModelState.AddModelError("", "Invalid username and password"); return(View()); } } }
public void OnGet(int?teamId) { Team team = meProvider.GetManagedTeam(teamId); Membership = new Models.Membership() { Team = team, TeamId = team.Id, Person = new Person() }; }
public ActionResult signup(Models.Membership s) { if (ModelState.IsValid) { var member = new Models.Membership { password = s.password, username = s.username }; ContactService.insertuser(member); return(RedirectToAction("Index")); } return(View()); }
public ActionResult Login(Models.Membership model) { using (var context = new ProductDatabaseEntities()) { bool isvalid = context.users.Any(x => x.username == model.username && x.password == model.password); if (isvalid) { FormsAuthentication.SetAuthCookie(model.username, false); return(RedirectToAction("Index", "ProductListDatas")); } ModelState.AddModelError("", "Invalid Username or Password"); return(View()); } }
public ActionResult Login(Models.Membership model) { using (var context = new projekt_baza_danych_wycieczki()) { bool isValid = context.User.Any(x => x.UserName == model.UserName && x.Password == model.Password); if (isValid) { FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("", "Błędna nazwa lub hasło."); return(View()); } }
public ActionResult Login(Models.Membership model) { using (var context = new OfficeEntities()) { bool Isvalid = context.User.Any(a => a.UserName == model.UserName && a.Password == model.Password); if (Isvalid) { FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction("Index", "Employees")); } ModelState.AddModelError("", "Invalid username & password"); return(View()); } }
public ActionResult Login(Models.Membership model) { using (var context = new KitchenEntities()) { bool isValid = context.Users.Any(x => x.UserName == model.UserName && x.Password == model.password); if (isValid) { FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction("Index", "Recipes")); } ModelState.AddModelError("", "Invalid username and password"); return(View()); } }
public Models.Membership UpdateMembership(Models.Membership m) { var membership = _acc.UpdateMembership(m); if (membership.MembershipStatus != MembershipStatus.MEMBER && membership.MembershipStatus != MembershipStatus.ADMIN) //if this member is active then we know the team is active without querying all memberships { int membersLeft = _acc.GetActiveMemberships(membership.TeamID).Where(m8 => m8.ID != membership.ID).Count(); if (membersLeft == 0) { _teamAcc.DeleteTeam(membership.TeamID); } } return(membership); }
public ActionResult Login(Models.Membership model) { using (var contex = new EmployeeDBEntities()) { bool isValid = contex.User.Any(x => x.UserName == model.UserName && x.Password == model.Password); if (isValid) { FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction("Index", "Employee2")); } ModelState.AddModelError("", "Invalid Username or Password"); return(View()); } }
public ActionResult Login(Models.Membership model) { using (var context = new BloodBankEntities()) { bool isValid = context.Users.Any(x => x.UserName == model.UserName && x.Password == model.Password && x.Email == model.Email); if (isValid) { FormsAuthentication.SetAuthCookie(model.UserName, false); return(RedirectToAction("Index", "Employees")); } ModelState.AddModelError("", "Invalid Username,Password and Email"); return(View()); } }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Membership = await _context.Membership.FirstOrDefaultAsync(m => m.Id == id); if (Membership == null) { return(NotFound()); } return(Page()); }
public ActionResult Login(Models.Membership model) { using (var context = new MailProEntities()) { var y = Crypto.Hash(model.Password); bool IsValid = context.FacultyTable.Any(x => x.FacultyEmail == model.FacultyEmail && x.Password == y); if (IsValid) { FormsAuthentication.SetAuthCookie(model.FacultyEmail, false); return(RedirectToAction("Home", "Create")); } ModelState.AddModelError("", "Invalid Email or Password"); return(View()); } }
public ActionResult login(Models.Membership member) { using (var context = new formAuthenticationEntities()) { bool isValid = context.tblLogins.Any(x => x.userName == member.userName && x.password == member.password); if (isValid) { FormsAuthentication.SetAuthCookie(member.userName, false); return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("", "Invalid username or password"); return(View()); } }
public ActionResult Login(Models.Membership model) { using (var context = new DESACDCEntities()) { bool isValid = context.tb_Usuarios.Any(x => x.NIC_USU == model.NIC_USU && x.PWD_USU == model.PWD_USU); if (isValid) { FormsAuthentication.SetAuthCookie(model.NIC_USU, false); //Session["Login"] = model.NIC_USU.ToString(); return(RedirectToAction("Index", "Home")); } ModelState.AddModelError("", "Invalid username or password"); return(View()); } }
public void Export(Models.Membership membership, System.IO.Stream outputStream) { var fileSystemProvider = Kooboo.CMS.Common.Runtime.EngineContext.Current.Resolve <Kooboo.CMS.Membership.Persistence.Default.MembershipProvider>(); fileSystemProvider.Add(membership); //Transfer groups TransferData <MembershipGroup, MembershipGroupProvider, Kooboo.CMS.Membership.Persistence.Default.MembershipGroupProvider>(membership); //Transfer membership users TransferData <MembershipUser, MembershipUserProvider, Kooboo.CMS.Membership.Persistence.Default.MembershipUserProvider>(membership); TransferData <MembershipConnect, MembershipConnectProvider, Kooboo.CMS.Membership.Persistence.Default.MembershipConnectProvider>(membership); fileSystemProvider.Export(membership, outputStream); fileSystemProvider.Remove(membership); }
public async Task <IActionResult> OnPostAsync(int?id) { if (id == null) { return(NotFound()); } Membership = await _context.Membership.FindAsync(id); if (Membership != null) { _context.Membership.Remove(Membership); await _context.SaveChangesAsync(); } return(RedirectToPage("./Index")); }
public ActionResult Login(Models.Membership model) { using (var context = new FormAuthEntities()) { //check whether username and pwd are found or not bool isValid = context.Users.Any(x => x.Username == model.Username && x.Password == model.Password); if (isValid) { FormsAuthentication.SetAuthCookie(model.Username, false); return(RedirectToAction("Index", "Employees")); } else { ModelState.AddModelError("", "Invalid Username & Password"); return(View()); } } }
public ActionResult Login(Models.Membership model) { using (var db = new OlxDbEntities()) { bool IsTrue = db.Users.Any(x => x.Email == model.Email); if (IsTrue) { bool IsValid = db.Users.Any(x => x.Email == model.Email && x.Password == model.Password && x.EmailVerification == true); if (IsValid) { var result = (from user in db.Users join role in db.UserRoles on user.Id equals role.UserId where user.Email == model.Email select role.Role).ToArray(); if (result.Contains("admin")) { FormsAuthentication.SetAuthCookie(model.Email, false); return(RedirectToAction("Index", "admin")); } else { FormsAuthentication.SetAuthCookie(model.Email, false); return(RedirectToAction("Index", "Home")); } } else { ModelState.AddModelError("", "Invalid information plz Try again"); return(View()); } } else { ModelState.AddModelError("", "Account Does not exist"); return(View()); } } }
public ActionResult Index(Models.Membership u) { if (ModelState.IsValid) { int count = 0; foreach (var i in ContactService.members()) { if (i.password.Equals(u.password) && i.username.Equals(u.username)) { count = 1; break; } } if (count == 1) { FormsAuthentication.SetAuthCookie(u.username, false); return(RedirectToAction("Index", "Home")); } } return(View()); }
public ActionResult Login(Models.Membership model) { using (var db = new ForumEntities()) { bool IsTrue = db.Users.Any(x => x.Email == model.Email && x.Status == true); if (IsTrue) { bool IsValid = db.Users.Any(x => x.Email == model.Email && x.Password == model.Password && x.Status == true); if (IsValid) { var result = (from user in db.Users join role in db.UserRoles on user.Id equals role.UserId where user.Email == model.Email select role.Roles).ToArray(); if (result.Contains("admin")) { FormsAuthentication.SetAuthCookie(model.Email, false); return(RedirectToAction("Index", "Admin")); } else { FormsAuthentication.SetAuthCookie(model.Email, false); return(RedirectToAction("Index", "Posts")); } } } //else { ModelState.AddModelError("", "Your Account Is Not Approved"); return(View()); } } ModelState.AddModelError("", "Invalid username and password"); return(View()); }
private async Task LoadContextAsync(int?teamId, int?eventId) { Me = meProvider.Me; MyTeams = Me.Membership.Select(x => x.Team).ToList() ?? new List <Team>(); Event = await eventRepo.GetEventAsync(eventId); if (Event == null) { Team = meProvider.GetTeam(teamId); Event = Team?.Event.OrderBy(x => x.Date).FirstOrDefault(x => x.Date > DateTime.Now); } else { Team = meProvider.GetTeam(Event.TeamId); if (Team?.Id != Event.TeamId) { Event = null; } } Membership = Me.Membership.FirstOrDefault(x => x.TeamId == Team?.Id); Participation = Event?.Participation.FirstOrDefault(x => x.PersonId == Me.Id); NextEvents = Team.Event .OrderBy(x => x.Date) .Where(x => !x.Special && x.Date > DateTime.Now.AddHours(-1) && x.Id != Event?.Id) .Take(5) .ToList(); SpecialEvents = Team.Event .OrderBy(x => x.Date) .Where(x => x.Special && x.Date > DateTime.Now.AddHours(-1) && x.Id != Event?.Id) .ToList(); Posts = Team.Post.TakeLast(50).OrderByDescending(x => x.Id).ToList(); if (Posts.Count > 0 && Posts[0].PersonId == Me?.Id) { MyLastPost = Posts[0]; } }
public ActionResult Login(Models.Membership model) { ConnectionString(); con.Open(); cmd.Connection = con; cmd.CommandText = "Select * from dbo.Users WHERE Username='******' AND Password='******'"; // UNSAFE AGAINST SQL INJECTION // cmd.CommandText = "Select * from dbo.Users WHERE Username= @Username AND Password= @Password"; // SAFE // cmd.Parameters.AddWithValue("@Username", model.Username); // SAFE // cmd.Parameters.AddWithValue("@Password", model.Password); // SAFE dr = cmd.ExecuteReader(); if (dr.Read()) { FormsAuthentication.SetAuthCookie(model.Username, false); return(RedirectToAction("index", "Employees")); } else { return(View()); } }
public ActionResult Login(Models.Membership model) { using (var Context = new EduMartEntities()) { bool isvalid = Context.Student.Any(x => x.Email == model.Email && x.Password == model.Password); if (isvalid) { var username = (from s in Context.Student where s.Email == model.Email && s.Password == model.Password select s.FirstName).FirstOrDefault(); var id = (from s in Context.Student where s.Email == model.Email && s.Password == model.Password select s.StudentID).FirstOrDefault(); Session["username"] = username; Session["id"] = id; ViewBag.username = username; FormsAuthentication.SetAuthCookie(username, false); return(RedirectToAction("Index", "Applications/Index")); } ModelState.AddModelError("", "Invalid Username and Password"); return(View()); } }
public Models.Membership UpdateMembership(Models.Membership m) { db.Entry(m).State = System.Data.Entity.EntityState.Modified; return(m); }
public void Add(Models.Membership item) { _dbContext.Set <Kooboo.CMS.Membership.Models.Membership>().Add(item); _dbContext.SaveChanges(); }
public Models.Membership CreateMembership(Models.Membership m) { db.Memberships.Add(m); //TODO check this to ensure we get ID back at some point, perhaps after Save() is called? return(m); }