public async Task <bool> ChangePassword(Auth auth) { try { string new_password = Get_Hash(auth.password).Substring(0, 5); Change_Password change = new Change_Password { dttm = DateTime.Now, password = new_password, user_id = auth.id }; await db_base.change_Passwords.AddAsync(change); await db_base.SaveChangesAsync(); string message = "Вы сменили пароль на - " + new_password; EmailServices emailsend = new EmailServices(); var result = emailsend.SendEmailAsync(auth.email, "Подтверждение аккаунта", message); return(true); } catch (Exception ex) { return(false); } }
public async Task <bool> SendLogin(string email, string password) { string message = String.Format("Вы подтвердили приглашение, на сайте http://ocpio.com/ используйте логин и пароль для входа " + " логин: {0}, пароль: {1} ", email, password); EmailServices emailsend = new EmailServices(); var result = emailsend.SendEmailAsync(email, "Данные для входа", message); return(true); }
public async Task <bool> ConfirmStaff(string link, string email) { string message = "Вас пригласили на проект ocpio.com. Для подтверждения перейдите по ссылке -" + " http://185.220.35.179/api/staff/confirm?link=" + link; EmailServices emailsend = new EmailServices(); var result = emailsend.SendEmailAsync(email, "Подтверждение приглашения", message); return(true); }
//Email send message Password Change public async Task <IActionResult> Check(string checkemail) { var callbackUrl = Url.ActionLink( "ChangePassword", "Account", new { email = checkemail }, protocol: HttpContext.Request.Scheme); EmailServices emailServices = new EmailServices(); await emailServices.SendEmailAsync(checkemail, "Password Deyismek ucun linke click edin", $"Password Change:<a href='{callbackUrl}'>Link</a>" ); return(RedirectToAction("Login", "Account")); }
public async Task <ActionResult> SendEmail(SendEmail model) { var message = await EmailTemplate("TempEmail"); message = message.Replace("Naslov neki", CultureInfo.CurrentCulture.TextInfo.ToTitleCase(model.Email)); var pacijent = ctx.Pacijents.Where(x => x.Id == model.pacijentId).Include(x => x.Korisnik).FirstOrDefault(); model.Email = pacijent.Korisnik.Email; var aktiv = ctx.Pacijents.Include(c => c.Korisnik).Where(c => c.Id == model.pacijentId).First(); aktiv.Korisnik.Aktivan = true; ctx.SaveChanges(); await EmailServices.SendEmailAsync(pacijent.Korisnik.Email, "Dobro došli", message); return(View("EmailSent")); }
public async Task <string> Confirm(int user, string email) { Confirm pas = new Confirm { user_id = user, code = Get_Hash(user.ToString() + "secret") }; db_base.Confirms.Add(pas); await db_base.SaveChangesAsync(); string message = "Для подтверждения перейдите по ссылке -" + " http://185.220.35.179/api/auths/activate?link=" + pas.code; EmailServices emailsend = new EmailServices(); var result = emailsend.SendEmailAsync(email, "Подтверждение аккаунта", message); return(pas.code); }
public async Task <IActionResult> SignUp(RegisterVm register) { if (!ModelState.IsValid) { return(NotFound()); } User newuser = new User { FullName = register.FullName, UserName = register.Username, Email = register.Email, UserThoughts = register.UserThoughts }; IdentityResult identityresult = await _userManager.CreateAsync(newuser, register.Password); if (!identityresult.Succeeded) { foreach (var error in identityresult.Errors) { ModelState.AddModelError("", error.Description); } return(View(register)); } else { var code = await _userManager.GenerateEmailConfirmationTokenAsync(newuser); var callbackUrl = Url.Action( "ConfirmEmail", "Account", new { userId = newuser.Id, codes = code }, protocol: HttpContext.Request.Scheme); EmailServices emailService = new EmailServices(); await emailService.SendEmailAsync(register.Email, " Zehmet olmasa linke click ederek qeydiyyatdan kecin )))", $"Your link: <a href='{callbackUrl}'>Link</a>"); return(Content("Zehmet olmasa Email unvaniniza baxin")); } }