Ejemplo n.º 1
0
        public Admin Get(string email, string password)
        {
            var admins = GetDatastore().List();

            email    = StaticMethods.Base64Decode(email);
            password = StaticMethods.Base64Decode(password);
            foreach (Admin admin in admins)
            {
                if (email == admin.Email && BCrypt.CheckPassword(password + "$O*#La", admin.Password))
                {
                    admin.SessionToken    = StaticMethods.SecureRandomString();
                    admin.TokenExpiration = DateTime.Now.ToUniversalTime().AddMinutes(30);
                    GetDatastore().Update(admin);
                    admin.Password = null;
                    return(admin);
                }
            }
            return(null);
        }