Exemplo n.º 1
0
        public ApplicationUser()
        {
            EmailConfirmed   = true;
            TwoFactorEnabled = false;
            ActiveEntries    = false;
            Closed           = null;
            Created          = Formatting.AsMilDateTime(DateTime.UtcNow);
            LastActive       = Formatting.AsMilDateTime(DateTime.UtcNow);
            Salt             = PasswordProtocol.PasswordSalt;
            // ConcurrencyStamp (nvarchar(max), null)

            /* page loads with stamp,
             * page saves (updates db) if db stamp matches loaded stamp,
             * if save succeeds then the stamp updates
             * if save fails then another user already modified the page
             */
        }
Exemplo n.º 2
0
        /***   MISC ACCOUNT   ***/

        public SignInResult Login(LoginViewModel login)
        {
            try
            {
                var email  = login.Email;
                var pass   = login.Password;
                var salt   = GetUserByEmail(email).Salt;
                var hash   = PasswordProtocol.CalculateHash(pass, salt);
                var result = _signInManager.PasswordSignInAsync(email?.ToUpper(), hash, false, true).Result;
                if (result == SignInResult.Success)
                {
                    GetUserByEmail(email).LastActive = Formatting.AsMilDateTime(DateTime.UtcNow);
                }
                return(result);
            }
            catch (Exception e)
            {
                Log.Error("Login: Failed!", e);
                throw;
            }
        }
Exemplo n.º 3
0
 public RequestViewModel()
 {
     Requested = Formatting.AsMilDateTime(DateTime.UtcNow);
 }