Exemplo n.º 1
0
        public IActionResult Login(Organisations org, string returnUrl)
        {
            var Organisation = OrganisationHelper.GetOrganisation(org.Organisation_Username);

            if (!ModelState.IsValid || Organisation == null)
            {
                return(View(org));
            }

            if (Hasher.ValidatePassword(org.Organisation_Password, Organisation.Organisation_Password))
            {
                HttpContext.Session.Set("OrgId", Encoding.UTF8.GetBytes(Organisation.OrganisationID.ToString()));
                HttpContext.Session.Set("Org_Uname", Encoding.UTF8.GetBytes(Organisation.Organisation_Username));
                if (!string.IsNullOrEmpty(returnUrl))
                {
                    return(Redirect(returnUrl));
                }
                return(RedirectToAction("Index", "Home"));
            }
            else
            {
                return(View(org));
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// This gerts most of the organisation details and returns them to the user
 /// so they can see the name and username of the organisation they are in
 /// More useful for the admins who can see details about the organisations subscription.
 /// </summary>
 /// <returns>The index page of the site</returns>
 public IActionResult Index()
 {
     return(View(OrganisationHelper.GetOrganisation(HttpContext.Session)));
 }