public async Task SendPasswordResetEmail(string email) { try { await authProvider.SendPasswordResetEmailAsync(email); } catch (Exception ex) { throw ex; } }
private async void SendPasswordResetEmailAsync(string email) { try { var auth = new FirebaseAuthProvider(new FirebaseConfig(FirebaseAppKey)); await auth.SendPasswordResetEmailAsync(email); } catch (Exception e) { MessageBox.Show("Invalid Email"); } }
public async void ResetPasswordEmail() { string WebAPIkey = "AIzaSyDvh8bOMOG0-bRlSI2cmbbpjHW21Bmzgwg"; try { var authProvider = new FirebaseAuthProvider(new FirebaseConfig(WebAPIkey)); await authProvider.SendPasswordResetEmailAsync(email); } catch (Exception ex) { } }
public ActionResult Reset_Password(string email) { var auth = new FirebaseAuthProvider(new FirebaseConfig(ApiKey)); auth.SendPasswordResetEmailAsync(email); try { @ViewBag.Message = "La solicitud para restablecer su contraseña ha sido enviada al correo " + email + "! "; } catch (Exception ex) { ModelState.AddModelError(string.Empty, "Ha ocurrido un error. Intente de nuevo"); } return(View()); }
/// <summary> /// Sends user an email with a link to reset his password /// </summary> /// <param name="email"></param> /// <returns></returns> public async Task SendPasswordResetEmail(string email) { var authProvider = new FirebaseAuthProvider(new FirebaseConfig(Credentials.FirebaseApiKey)); try { await authProvider.SendPasswordResetEmailAsync(email); await new MessageDialog("If such email address exists in our database, then " + "the password reset link has been sent to your mail inbox").ShowAsync(); } catch (Exception e) { await new MessageDialog(e.Message).ShowAsync(); } }
public async Task <IActionResult> ForgotPassword(ForgotPasswordViewModel forgot) { try { var auth = new FirebaseAuthProvider(new FirebaseConfig(cls_keys.ApiKey)); await auth.SendPasswordResetEmailAsync(forgot.Email); ModelState.AddModelError(string.Empty, "The password link has been sent to your e-mail address."); ModelState.Clear(); } catch (Exception ex) { ModelState.AddModelError(string.Empty, ex.Message); ModelState.Clear(); } return(View()); }
private async void reset() { try { FirebaseConfig config = new FirebaseConfig(GLOBAL.apiKey); FirebaseAuthProvider authProvider = new FirebaseAuthProvider(config); await authProvider.SendPasswordResetEmailAsync(txtCorreo.Text.Trim()); MessageBox.Show("verifique su correo electronico", "Recuperar contraseña", MessageBoxButtons.OK, MessageBoxIcon.Information); this.Close(); } catch (FirebaseAuthException e) { MessageBox.Show("Ocurrio un error: " + e.InnerException.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
async void ForgotPwd_btn_Clicked(System.Object sender, System.EventArgs e) { var Email = Forgot_email.Text; FirebaseAuthProvider authProvider = new FirebaseAuthProvider(new FirebaseConfig(AuthFirebase.Instance.GetKey())); try { await authProvider.SendPasswordResetEmailAsync(Email); await App.Current.MainPage.DisplayAlert("Success.", "Verification email sent.", "Ok"); await Navigation.PushAsync(new LoginPage()); } catch (Exception) { await App.Current.MainPage.DisplayAlert("Attention.", "Invalid Email or password.", "Ok"); } }
async Task navigate() { try { IsBusy = true; Error = false; var authProvider = new FirebaseAuthProvider(new FirebaseConfig("AIzaSyCrepjXrkXJ4tWxVLZrH-UaoYFs271eG-8")); await authProvider.SendPasswordResetEmailAsync(Email); ErrorMsg = "Your request has been submitted! please check your email"; //IFolder folder = FileSystem.Current.LocalStorage; //IFolder log = await folder.CreateFolderAsync("log", CreationCollisionOption.OpenIfExists); //IFile ALFile = await log.CreateFileAsync("AuthLink", CreationCollisionOption.OpenIfExists); //var ALFieResult = await ALFile.ReadAllTextAsync(); //if (ALFieResult != "") //{ // app.AuthLink = JsonConvert.DeserializeObject<FirebaseAuthLink>(ALFieResult); // IFile UPFile = await log.CreateFileAsync("UserProfile", CreationCollisionOption.OpenIfExists); // var UPFileResult = await ALFile.ReadAllTextAsync(); // app.UserProfile = JsonConvert.DeserializeObject<UserProfile>(UPFileResult); // app.MainPage = new NavigationPage(new Home()); //} //else //{ // app.MainPage = new NavigationPage(new LoginPage()); //} } catch (Exception e) { ErrorMsg = "Error occured while processing your request!"; } finally { Error = true; IsBusy = false; } }
public void RestPasswordByEmail(string email) { try { if (String.IsNullOrEmpty(email) == false) { var IsValid = (Regex.IsMatch(email, emailRegex, RegexOptions.IgnoreCase, TimeSpan.FromMilliseconds(250))); if (IsValid == true) { var se = authProvider.SendPasswordResetEmailAsync(email); } } else { App.Current.MainPage.DisplayAlert("خطأ", "نسيت ادخال الايميل", "موافق"); } } catch (System.Exception e) { throw e; } }
public async Task <bool> forgetPassword(string email) { var ap = new FirebaseAuthProvider(new Firebase.Auth.FirebaseConfig("AIzaSyBjdJIn1k3ksbbZAgY-kQIwUXbD0Zo_q8w")); FirebaseAuthLink res; try { await ap.SendPasswordResetEmailAsync(email); //Attemps to create user with given email & password } catch { return(false); } await firebaseClient .Child("authroles") .OnceAsync <Elderly>(); await PostLog("An email have been successfully send!"); return(true); }
public async Task ForgottenPasswordAsync(ForgottenPasswordCommand command) { try { if ((await GetByEmailAsync(command.Email)).Value == null) { throw new KeyNotFoundException($"{nameof(command.Email)} {command.Email} doesn't exists !"); } await FirebaseAuthProvider.SendPasswordResetEmailAsync(command.Email); } catch (Firebase.Auth.FirebaseAuthException ex) { if (ex.InnerException?.InnerException?.GetType() == typeof(SocketException)) { throw new HttpRequestException("Cannot join the server. Please check your internet connexion."); } throw ex; } catch (Exception ex) { throw ex; } }
public async Task <ActionResult> SignUp(SignUpModel model) { try { string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; char[] caracteres = chars.ToCharArray(); Random rnd = new Random(); StringBuilder sb = new StringBuilder(); for (int i = 0; i < 8; i++) { int randomIndex = rnd.Next(chars.Length); sb.Append(caracteres.GetValue(randomIndex)); } var auth = new FirebaseAuthProvider(new FirebaseConfig(ApiKey)); var a = await auth.CreateUserWithEmailAndPasswordAsync(model.Email, sb.ToString(), model.Usuario, true); password = model.Password; UserGlobal = model.Email; TbUsuarios usuario = new TbUsuarios(); usuario.nombre = model.nombre; usuario.apellidos = model.apellidos; usuario.correo = model.Email; usuario.telefono = model.telefono; usuario.IDRol = 2; usuario.contrasenna = sb.ToString(); usuario.foto = "https://firebasestorage.googleapis.com/v0/b/bd-tmc.appspot.com/o/fotosDePerfil%2FClipartKey_809592.png?alt=media&token=9ba3f041-e374-4a18-b465-b870ef5effa2"; TbHistorial registro = new TbHistorial(); registro.detalle = "se registro un nuevo usuario: " + UserGlobal; registro.fecha = DateTime.Now.ToString(); cUsuarios.Insertar(usuario); cUsuarios.InsertarHistorial(registro); await auth.SendPasswordResetEmailAsync(model.Email); ViewBag.Message = "Bienvenido " + model.nombre + "! "; ViewBag.Message = ViewBag.Message + "Para establecer su contraseña ingrese a su correo electrónico. " + "Por el momento, su contraseña es: " + sb.ToString(); //Seding Password to email string nombre = usuario.nombre; System.Net.Mail.MailMessage mmsg = new System.Net.Mail.MailMessage(); mmsg.To.Add(usuario.correo); mmsg.Subject = "Establecer tu contraseña de Sistema TMC"; mmsg.SubjectEncoding = System.Text.Encoding.UTF8; mmsg.BodyEncoding = System.Text.Encoding.UTF8; mmsg.IsBodyHtml = true; mmsg.AlternateViews.Add(NewPasswordEmail(nombre, sb.ToString())); mmsg.From = new System.Net.Mail.MailAddress("*****@*****.**"); System.Net.Mail.SmtpClient cliente = new System.Net.Mail.SmtpClient(); cliente.EnableSsl = true; //cliente.UseDefaultCredentials = false; cliente.Credentials = new System.Net.NetworkCredential("*****@*****.**", "Tumaestro2020"); cliente.Host = "smtp.gmail.com"; cliente.Port = 25; cliente.Send(mmsg); } catch (Exception ex) { ModelState.AddModelError(string.Empty, "Ha ocurrido un error. Intente de nuevo"); } return(View()); }
public void SendForgotPasswordEmail(string email) { _authProvider.SendPasswordResetEmailAsync(email); }
public Task ForgotPassword(string email) { return(authProvider.SendPasswordResetEmailAsync(email)); }
public async Task ResetPassword(string email) { await _authProvider.SendPasswordResetEmailAsync(email); }