Пример #1
0
        private async Task <bool> ValidarControles()
        {
            bool   b_error = false;
            string s_msg   = "";

            if (string.IsNullOrEmpty(EmailEntry.Text))
            {
                s_msg   = "Debe Ingresar un usuario";
                b_error = true;
                EmailEntry.Focus();
            }

            if (string.IsNullOrEmpty(PasswordEntry.Text) && !b_error)
            {
                s_msg   = "Debe Ingresar una clave";
                b_error = true;
                PasswordEntry.Focus();
            }

            if (b_error)
            {
                await DisplayAlert("Error", s_msg, "Aceptar");
            }
            return(b_error);
        }
Пример #2
0
        public LoginPage()
        {
            var vm = new LoginViewModel();

            this.BindingContext           = vm;
            vm.DisplayInvalidLoginPrompt += () => DisplayAlert("Sorry", "The credentials you supplied are incorrect.", "Ok");
            InitializeComponent();

            EmailEntry.Completed += (object sender, EventArgs e) => {
                PasswordEntry.Focus();
            };

            PasswordEntry.Completed += (object sender, EventArgs e) => {
                vm.SubmitCommand.Execute(null);
            };

            LoginButton.Clicked += async(sender, e) => {
                var buttonIndex = await PromptSheet.ShowAlert(this.PageContainer, "Oops", "Sorry, the supplied credentials are incorrect. Do you want to try again?", "Yes", new string[] { "No", "Maybe" });

                Debug.WriteLine($"Button with index {buttonIndex} tapped");

                if (buttonIndex == 1)
                {
                    var inputResult = await PromptSheet.ShowInputPopup(this.PageContainer, "We can help!", "May we can send you an email to reset your password.", new InputOptions()
                    {
                        Placeholder = "Your Email"
                    }, new string[] { "Yes, Sent it!", "No, thanks" });

                    Debug.WriteLine($"Button with index {inputResult.ButtonIndex} tapped");
                    Debug.WriteLine($"Input with content {inputResult.InputText}");
                }
            };
        }
Пример #3
0
        private async void LoginButton_Clicked(object sender, EventArgs e)
        {
            // UserDialogs.Instance.ShowLoading("Loading", MaskType.Black); //IsLoading = true;

            if (string.IsNullOrEmpty(PasswordEntry.Text))
            {
                //IsLoading = false;
                UserDialogs.Instance.HideLoading();
                //DependencyService.Get<IMessage>().LongAlert("Password is blank!");
                UserDialogs.Instance.ShowError("Password is blank!", 3000);
                return;
            }

            if (PasswordEntry.Text == App.gAdminPsw)
            {
                Navigation.PushAsync(new MainPage(7));
            }
            else
            {
                UserDialogs.Instance.ShowError("Wrong Password!", 3000);
                PasswordEntry.Focus();
            }


            // UserDialogs.Instance.HideLoading();
        }
Пример #4
0
        private void PasswordEntry_Completed(object sender, EventArgs e)
        {
            var input = PasswordEntry.Text;

            if (input == null)
            {
                DisplayAlert("Error", "Password should contain at least six characters", "OK");
                PasswordEntry.Focus();
            }
            else
            {
                input = input.ToLower();
                if (input.Length > 15)
                {
                    DisplayAlert("Error", "Password can contain at max fifteen characters", "OK");
                    PasswordEntry.Focus();
                    return;
                }
                if (input.Length < 6)
                {
                    DisplayAlert("Error", "Password should contain at least six characters", "OK");
                    PasswordEntry.Focus();
                    return;
                }
                if (input.Contains(' '))
                {
                    DisplayAlert("Error", "Password Can't Have Whitespaces", "OK");
                    PasswordEntry.Focus();
                    return;
                }
                LogInButton_Clicked(null, null);
            }
        }
Пример #5
0
        private void PasswordEntry_Completed(object sender, EventArgs e)
        {
            var input = PasswordEntry.Text;

            if (input == null)
            {
                DisplayAlert("Error", "Password is too short (minimum is 6 characters)", "OK");
                PasswordEntry.Focus();
            }
            else
            {
                input = input.ToLower();
                if (input.Length > 20)
                {
                    DisplayAlert("Error", "Password is too long (maximum is 20 characters)", "OK");
                    PasswordEntry.Focus();
                    return;
                }
                if (input.Length < 6)
                {
                    DisplayAlert("Error", "Password is too short (minimum is 6 characters)", "OK");
                    PasswordEntry.Focus();
                    return;
                }
                if (input.Contains(' '))
                {
                    DisplayAlert("Error", "Password Can't Have Whitespaces", "OK");
                    PasswordEntry.Focus();
                    return;
                }
                LogInButton_Clicked(null, null);
            }
        }
Пример #6
0
        public LoginView()
        {
            NavigationPage.SetHasNavigationBar(this, false);

            InitializeComponent();

            UsernameEntry.Completed += (sender, e) => PasswordEntry.Focus();
        }
Пример #7
0
 public LoginPage()
 {
     InitializeComponent();
     UserEntry.Completed += (object sender, EventArgs e) =>
     {
         PasswordEntry.Focus();
     };
 }
Пример #8
0
        public LoginPage()
        {
            InitializeComponent();
            BindingContext = ViewModel;

            UsernameEntry.Completed += (sender, args) => { PasswordEntry.Focus(); };
            PasswordEntry.Completed += (sender, args) => { ViewModel.AuthenticateCommand.Execute(null); };
        }
Пример #9
0
 public LoginPage()
 {
     InitializeComponent();
     EmailEntry.Completed    += (sender, args) => { PasswordEntry.Focus(); };
     PasswordEntry.Completed += (sender, args) => { LoginButton.Focus(); };
     //this.AnimationView.IsVisible = false;
     //this.LoginButton.Clicked += LoginButton_Clicked;
 }
        public LoginPage()
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);

            EmailEntry.Completed    += (sender, e) => PasswordEntry.Focus();
            PasswordEntry.Completed += (sender, e) => (BindingContext as LoginViewModel).ConnectionCommand.Execute(null);
        }
Пример #11
0
        public LogIn()
        {
            InitializeComponent();

            UsernameEntry.Completed += (e, s) => PasswordEntry.Focus();
            PasswordEntry.Completed += (e, s) => OnLoginButtonClicked(e, s);

            verify();
        }
Пример #12
0
        public LoginView()
        {
            InitializeComponent();
            NavigationPage.SetHasNavigationBar(this, false);

            //var vm = BindingContext as LoginViewModel;

            UsernameEntry.Completed += (s, e) => PasswordEntry.Focus();
            //PasswordEntry.Completed += (s, e) => vm.LoginClick.ExecKCute(null);
        }
        private void PasswordEntryTip_GotFocus(object sender, RoutedEventArgs e)
        {
            var box = sender as PasswordBox;

            if (box != null)
            {
                box.Visibility = Visibility.Hidden;
                PasswordEntry.Focus();
            }
        }
Пример #14
0
        public RegisterPage()
        {
            InitializeComponent();
            BindingContext = new RegisterViewModel(Navigation, Alert);

            DisplayNameEntry.ReturnCommand = new Command(() => EmailEntry.Focus());
            EmailEntry.ReturnCommand       = new Command(() => PasswordEntry.Focus());

            PasswordEntry.ReturnCommand        = new Command(() => ConfirmpasswordEntry.Focus());
            ConfirmpasswordEntry.ReturnCommand = new Command(() => Register.Focus());
        }
Пример #15
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            // if we have a username, set the focus to the password entry
            var loginPageViewModel = BindingContext as LoginPageViewModel;

            if (!String.IsNullOrEmpty(loginPageViewModel.Username))
            {
                PasswordEntry.Focus();
            }
        }
Пример #16
0
 private void PasswordEntry_Completed(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(PasswordEntry.Text))
     {
         LoginButton.Focus();
     }
     else
     {
         //DependencyService.Get<IMessage>().LongAlert("Password is blank!");
         UserDialogs.Instance.ShowError("Password is blank!", 3000);
         PasswordEntry.Focus();
     }
 }
Пример #17
0
        public LoginView()
        {
            InitializeComponent();

            _ViewModel     = new LoginViewModel(Navigation);
            BindingContext = _ViewModel;

            UsernameEntry.Completed += (sender, args) => { PasswordEntry.Focus(); };
            PasswordEntry.Completed += (sender, args) =>
            {
                _ViewModel.AuthenticateCommand.Execute(null);
            };
        }
Пример #18
0
 private void UserEntry_Completed(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(UserEntry.Text))
     {
         Helpers.Settings.UserEmail = UserEntry.Text;
         PasswordEntry.Focus();
     }
     else
     {
         //DependencyService.Get<IMessage>().LongAlert("User Email is blank!");
         UserDialogs.Instance.ShowError("User Email is blank!", 3000);
         UserEntry.Focus();
     }
 }
 private void EntryOnCompleted(object sender, EventArgs e)
 {
     if (sender == UserNameEntry)
     {
         PasswordEntry.Focus();
     }
     if (sender == PasswordEntry)
     {
         if (ConfirmPasswordEntry.IsVisible)
         {
             ConfirmPasswordEntry.Focus();
         }
     }
 }
Пример #20
0
 private void OnEntryCompleted(object sender, EventArgs e)
 {
     if (sender == UserNameEntry)
     {
         PasswordEntry.Focus();
     }
     else
     {
         if (ViewModel.SignInCommand.CanExecute(null))
         {
             ViewModel.SignInCommand.Execute(null);
         }
     }
 }
Пример #21
0
        public async void SignInPressed(object sender, EventArgs e)
        {
            var service = new AccountsService();

            if (string.IsNullOrEmpty(UsernameEntry.Text))
            {
                await DisplayAlert("Alerta", "Ingrese nombre de usuario", "Aceptar");

                UsernameEntry.Focus();
                return;
            }

            if (string.IsNullOrEmpty(PasswordEntry.Text))
            {
                await DisplayAlert("Alerta", "Ingrese contraseña", "Aceptar");

                PasswordEntry.Focus();
                return;
            }

            if (service.Authentication(UsernameEntry.Text, PasswordEntry.Text))
            {
                waitActivityIndicator.IsRunning = true;
                await Task.Delay(1500);

                if (service.GetUserNameType(UsernameEntry.Text) == "Paciente")
                {
                    Patient patient = service.GetPatientByUserId(1);
                    App.Current.MainPage = new NavigationPage(new PatientMainPage(patient));
                }
                else if (service.GetUserNameType(UsernameEntry.Text) == "Doctor")
                {
                    Doctor doctor = service.GetDoctorByUserId(1);
                    App.Current.MainPage = new NavigationPage(new DoctorMainPage(doctor));
                }

                waitActivityIndicator.IsRunning = false;
                UsernameEntry.Text = string.Empty;
                PasswordEntry.Text = string.Empty;
            }
            else
            {
                await DisplayAlert("Alerta", "Usuario o contraseña incorrectos", "Aceptar");

                PasswordEntry.Text = string.Empty;
                return;
            }
        }
Пример #22
0
        private void UsernameEntry_Completed(object sender, EventArgs e)
        {
            var input = UsernameEntry.Text;

            if (input == null)
            {
                DisplayAlert("Error", "Username is too short (minimum is 6 characters)", "OK");
                UsernameEntry.Focus();
            }
            else
            {
                input = input.ToLower();
                if (input.Length > 20)
                {
                    DisplayAlert("Error", "Username is too long (maximum is 20 characters)", "OK");
                    UsernameEntry.Focus();
                    return;
                }
                if (input.Length < 6)
                {
                    DisplayAlert("Error", "Username is too short (minimum is 6 characters)", "OK");
                    UsernameEntry.Focus();
                    return;
                }
                if (input.Contains(' '))
                {
                    DisplayAlert("Error", "Username Can't Have Whitespaces", "OK");
                    UsernameEntry.Focus();
                    return;
                }
                bool temp = true;
                foreach (var item in input)
                {
                    if (!char.IsLetterOrDigit(item))
                    {
                        temp = false;
                        break;
                    }
                }
                if (!temp)
                {
                    DisplayAlert("Error", "Username Can Only Contain Alphabets or Digits", "OK");
                    UsernameEntry.Focus();
                    return;
                }
                PasswordEntry.Focus();
            }
        }
        public LoginPage()
        {
            var vm = new LoginViewModel();

            this.BindingContext           = vm;
            vm.DisplayInvalidLoginPrompt += () => DisplayAlert("Sorry", "The credentials you supplied are incorrect.", "Ok");
            InitializeComponent();

            EmailEntry.Completed += (object sender, EventArgs e) => {
                PasswordEntry.Focus();
            };

            PasswordEntry.Completed += (object sender, EventArgs e) => {
                vm.SubmitCommand.Execute(null);
            };
        }
Пример #24
0
        public LoginPage()
        {
            InitializeComponent();

#pragma warning disable CS0618 // Type or member is obsolete
            RegisterLabel.GestureRecognizers.Add(new TapGestureRecognizer(async(view) =>
            {
                if (!LoadingIndicator.IsRunning && !IsRegisterPageOpen)
                {
                    IsRegisterPageOpen = true;
                    await Navigation.PushModalAsync(new NavigationPage(new RegisterPage()));
                }
            }));
#pragma warning restore CS0618 // Type or member is obsolete

            UsernameEntry.Completed += (o, e) =>
            {
                PasswordEntry.Focus();
            };
            PasswordEntry.Completed += PasswordEntryCompleted;
            if (Application.Current.Properties.ContainsKey("PrivateKey"))
            {
                UsernameEntry.IsEnabled    = false;
                PasswordEntry.IsEnabled    = false;
                LoadingIndicator.IsRunning = true;
                StatusLabel.IsVisible      = false;
                LoginButton.IsVisible      = false;

                // Dependency injection per interfaces
                var auth = AuthenticationSystemManager.NewAuthenticator();
                auth.Result += LoginResponse;
                auth.Login((string)Application.Current.Properties["PrivateKey"]);
            }
            MessagingCenter.Subscribe <RegisterPage, Tuple <string, string> >(this, "Success", (obj, loginInfo) =>
            {
                UsernameEntry.Text = loginInfo.Item1;
                PasswordEntry.Text = loginInfo.Item2;
                PasswordEntryCompleted(null, null);
            });
            MessagingCenter.Subscribe <RegisterPage>(this, "Closing", (obj) =>
            {
                IsRegisterPageOpen = false;
            });
        }
Пример #25
0
        private void SetControlFocuses()
        {
            UsernameEntry.Completed += (s, e) =>
            {
                if (string.IsNullOrEmpty(PasswordEntry.Text))
                {
                    PasswordEntry.Focus();
                }
                else
                {
                    ExecuteLoginCommand();
                }
            };

            PasswordEntry.Completed += (s, e) =>
            {
                ExecuteLoginCommand();
            };
        }
Пример #26
0
        public LoginPage()
        {
            var vm = new LoginViewModel();

            BindingContext = vm;

            InitializeComponent();

            EmailEntry.Completed += (object sender, EventArgs e) => { PasswordEntry.Focus(); };


            PasswordEntry.Completed += (object sender, EventArgs e) =>
            {
                //vm.SubmitCommand.Execute(null);

                EmailEntry.Text    = "";
                PasswordEntry.Text = "";
            };
        }
 private void OnUseDerivedPswdToggled(object sender, ToggledEventArgs args)
 {
     if (args.Value)
     {
         Device.StartTimer(TimeSpan.FromSeconds(0.25), () =>
         {
             Page.ScrollToAsync(0, PasswordEntry.Height, true);
             return(false);
         });
         PasswordEntry.Focus();
     }
     else
     {
         Device.StartTimer(TimeSpan.FromSeconds(0.25), () =>
         {
             Page.ScrollToAsync(0, 0, true);
             return(false);
         });
     }
 }
Пример #28
0
        protected override void OnAppearing()
        {
            base.OnAppearing();

            if (string.IsNullOrEmpty(EmailEntry.Text))
            {
                EmailEntry.Focus();
            }
            else if (string.IsNullOrEmpty(PasswordEntry.Text))
            {
                PasswordEntry.Focus();
            }
            else
            {
                LoginButton.Focus();
            }

            ViewModel.MessageLabel       = string.Empty;
            ViewModel.CanExecuteCommands = true;
        }
Пример #29
0
        public async void SubmitButtonClicked(Object sender, EventArgs args)
        {
            if (String.IsNullOrEmpty(UsernameEntry.Text))
            {
                UsernameEntry.Focus();
            }
            else if (String.IsNullOrEmpty(PasswordEntry.Text))
            {
                PasswordEntry.Focus();
            }
            else if (!GlobalData.VerifyData(UsernameEntry.Text, PasswordEntry.Text))
            {
                await DisplayAlert("Warning", " Username or Password is Incorrect ", "Okay");
            }
            else
            {
                await Navigation.PushAsync(new MainPage());

                Navigation.RemovePage(Navigation.NavigationStack[0]);
            }
        }
Пример #30
0
        public LoginView()
        {
            InitializeComponent();
            loginModel = new LoginModel();

            //Displays notification alert confirming login
            MessagingCenter.Subscribe <LoginModel, string>(this, "LoginAlert", (sender, Username) =>
            {
                DisplayAlert("", Username, "Welcome");
            });
            this.BindingContext = loginModel;

            UsernameEntry.Completed += (object sender, EventArgs e) =>
            {
                PasswordEntry.Focus();
            };

            PasswordEntry.Completed += (object sender, EventArgs e) =>
            {
                loginModel.SubmitCommand.Execute(null);
            };
        }