Beispiel #1
0
        public IActionResult RegisterUser(AuthorDto model, string Password)
        {
            if (string.IsNullOrEmpty(model.MailAddress) || string.IsNullOrEmpty(Password))
            {
                return(Json(new { isNull = true, message = "Mail ve şifre alanları boş bırakılamaz." }));
            }

            string hashed = string.Empty;

            using (var sha = SHA1.Create())
            {
                var hashedBytes = sha.ComputeHash(Encoding.UTF8.GetBytes(string.Concat(model.MailAddress.Substring(0, 4), Password)));
                hashed = BitConverter.ToString(hashedBytes).Replace("-", "").ToLower();
            }

            return(Ok(_authorService.AddUser(model, hashed)));
        }