Esempio n. 1
0
        public async Task <IActionResult> Create([Bind("UserId,FirstName,LastName,EndlasEmail,AuthString")] Admin admin)
        {
            if (ModelState.IsValid)
            {
                admin.UserId = Guid.NewGuid();
                // save emails as lower case
                admin.EndlasEmail = admin.EndlasEmail.ToLower();
                // **** HASH AUTH STRING ****
                admin.AuthString = Utility.Security.ComputeSha256Hash(admin.AuthString);
                // update shadow properties
                SetUIDs();
                await _repo.AddAdmin(admin);

                return(RedirectToAction(nameof(Index)));
            }
            return(View(admin));
        }