Ejemplo n.º 1
0
        public ActionResult SignUpComplete(User user)
        {
            user.ValidationKey = RandomSfr.Generate(30);
            user.Password      = Security.sha512encrypt(user.Password).Substring(0, 40);
            user.Address       = user.Address;
            user.Phone         = user.Phone;
            user.isActive      = false;
            HttpClient client = new HttpClient();

            client.BaseAddress = new Uri("http://localhost:5006/");
            HttpResponseMessage result = client.PostAsJsonAsync("api/Login/SignUp", user).Result;

            if (result.StatusCode == HttpStatusCode.OK)
            {
                string resultString = result.Content.ReadAsStringAsync().Result;
                if (resultString != "{\"Code\":0}")
                {
                    SignUpRespone login = Newtonsoft.Json.JsonConvert.DeserializeObject <SignUpRespone>(resultString);
                    if (login.Code == 1)
                    {
                        TempData["Success"] = "Kayıt İşlemi Başarılı Mail Kutunuzu Kontrol Edin!";
                        return(RedirectToAction("Index", "Login"));
                    }
                }
            }
            TempData["Error"] = "Bazı  şeyler ters gitti tekrar deneyin!!";
            return(RedirectToAction("SignUp", "Login"));
        }
Ejemplo n.º 2
0
        public async Task <object> SignUp(User user)
        {
            SignUpRespone response = new SignUpRespone();

            response = userService.UserSignUp(user);
            if (response.Code == 1)
            {
                string link        = "<a href='http://localhost:6868/Login/Activate?email=" + user.Email + "&valKey=" + Security.sha512encrypt(user.ValidationKey) + "'>";
                string subjectName = "Ardan Ticaret Aktivasyon İşlemi";
                //todo image işi ayarlanacak.
                string image = "";
                string body  = "Kayıt işlemini tamamlamak için lütfen linke " + link + "tıklayınız.</a>" + image;
                await MailOperations.SendMailForSignUp(subjectName, body, user.Email);
            }
            return(response);
        }
Ejemplo n.º 3
0
        public SignUpRespone UserSignUp(User user)
        {
            SignUpRespone response = new SignUpRespone();

            try
            {
                using (MyDb db = new MyDb())
                {
                    db.Entry(user).State = System.Data.Entity.EntityState.Added;
                    db.SaveChanges();
                    response.SetError(SystemConstants.ERRORS.SUCCESSFUL);
                }
            }
            catch (Exception ex)
            {
                response.SetError(SystemConstants.ERRORS.SYSTEMERROR);
            }
            return(response);
        }