Ejemplo n.º 1
0
        async void PulsaLogIn()
        {
            if (Validate())
            {
                var result = await _logInService.LogIn(UserName, Password);

                if (result != null)
                {
                    //https://github.com/xamarin/Xamarin.Auth/wiki/Migrating-from-AccountStore-to-Xamarin.Essentials-SecureStorage
                    var json = JsonConvert.SerializeObject(result);

                    // Securely save the accounts for the given service
                    await SecureStorage.SetAsync("Usuario", json);

                    var accion = await Application.Current.MainPage.DisplayAlert("😉 Acceso exitoso", "Usted ha iniciado sesión, satisfactoriamente.", null, "✔ Aceptar");

                    if (!accion)
                    {
                        Application.Current.MainPage = new AppShell();
                    }
                }
                else
                {
                    //DisplayInvalidLoginPrompt();
                    await Application.Current.MainPage.DisplayAlert("😌 Error inicio de sesión", "Usuario o contraseña son incorrectos. Verifique por favor.", "✔ Aceptar");
                }
            }
        }
Ejemplo n.º 2
0
 public IActionResult Get(string emailAddress, string passWord)
 {
     if (loginSvc.LogIn(emailAddress, passWord))
     {
         return(Ok("You have successfully logged in."));
     }
     else
     {
         return(BadRequest("You have entered an incorrect username or password."));
     }
 }
Ejemplo n.º 3
0
        private void loginButton_Click(object sender, EventArgs e)
        {
            if (usernameLoginText.Text.Trim() == "" || passwordLoginText.Text.Trim() == "")
            {
                errorMessageLogin.ForeColor = Color.Red;
                errorMessageLogin.Text      = "Please fill in a valid username or password.";
                return;
            }

            if (login.LogIn(usernameLoginText.Text, passwordLoginText.Text))
            {
                Shop shop = new Shop(usernameLoginText.Text);
                this.Hide();
                this.Owner = shop;
                shop.ShowDialog();
            }
            else
            {
                errorMessageLogin.ForeColor = Color.Red;
                errorMessageLogin.Text      = "Wrong username or password.";
            }
        }
Ejemplo n.º 4
0
        public async Task <ActionResult <GenericResponse <UserLoginResponse> > > Login([FromBody] LoginRequest lr)
        {
            var response = await _logInService.LogIn(lr.Email, lr.Password);

            return(response);
        }