Пример #1
0
        /// <summary>
        /// Gets if the user is in the cookie and is in the db
        /// </summary>
        /// <returns></returns>
        private async Task <string> GetUserEmail()
        {
            // check if the cookie exists and whats the email in the cookie
            string result = CookieUtility.GetEmail(this.HttpContext);

            if (!String.IsNullOrEmpty(result))
            {
                UserModel user = await UserAPI.GetUserByEmail(this._settings.Value.API.UserAPI, result);

                // if the user dosnt exists we set the result as empy as the cookie user is not a valid user
                if (user == null)
                {
                    result = String.Empty;
                }
            }

            return(result);
        }