public void ValidateConfig_False()
        {
            var obj = new LoginPageViewModel();

            Assert.IsNotNull(obj);
            Assert.IsNotNull(obj.DisplayName);
            Assert.IsNotNull(obj.HostName);
            Assert.IsNotNull(obj.Login);
            Assert.IsNotNull(obj.Password);
            Assert.IsNotNull(obj.Port);

            Assert.IsNotNull(obj.ValidateUserNameCommand);
            Assert.IsNotNull(obj.TestMe);
            Assert.IsNotNull(obj.ValidateHostNameCommand);
            Assert.IsNotNull(obj.ValidatePasswordCommand);


            Assert.IsTrue(obj.TestMe.CanExecute(null));
            obj.TestMe.Execute(null);


            Assert.IsFalse(obj.DisplayName.IsValid);
            Assert.IsFalse(obj.HostName.IsValid);
            Assert.IsFalse(obj.Login.IsValid);
            Assert.IsFalse(obj.Password.IsValid);
            Assert.IsTrue(obj.Port.IsValid);
        }
Exemple #2
0
 public LoginPage()
 {
     InitializeComponent();
     loginViewModel = App.Locator.Login;
     BindingContext = loginViewModel;
     Title          = "Login";
 }
        public void SetHost()
        {
            var obj = new LoginPageViewModel();

            Assert.IsNotNull(obj);
            var host = new Host();


            host.HostName     = "doods.tu";
            host.Url          = "doods.url";
            host.Port         = 80;
            host.UserName     = "******";
            host.Password     = "******";
            host.Id           = default;
            host.IsOmvServer  = true;
            host.IsRpi        = true;
            host.IsSsh        = true;
            host.IsSynoServer = false;
            obj.SetHost(host);

            Assert.AreEqual(obj.DisplayName.Value, host.HostName);
            Assert.AreEqual(obj.HostName.Value, host.Url);
            Assert.AreEqual(obj.Port.Value, host.Port.ToString());
            Assert.AreEqual(obj.Login.Value, host.UserName);
            Assert.AreEqual(obj.Password.Value, host.Password);

            Assert.AreEqual(obj.IsOmvServer, host.IsOmvServer);
            Assert.AreEqual(obj.IsRpi, host.IsRpi);
            Assert.AreEqual(obj.IsSsh, host.IsSsh);
            Assert.AreEqual(obj.IsSynoServer, host.IsSynoServer);
        }
        public void Create()
        {
            var obj = new LoginPageViewModel();

            Assert.IsNotNull(obj);
            Assert.IsNotNull(obj.DisplayName);
            Assert.IsNotNull(obj.HostName);
            Assert.IsNotNull(obj.Login);
            Assert.IsNotNull(obj.Password);
            Assert.IsNotNull(obj.Port);

            Assert.IsNotNull(obj.ValidateUserNameCommand);
            Assert.IsNotNull(obj.TestMe);
            Assert.IsNotNull(obj.ValidateHostNameCommand);
            Assert.IsNotNull(obj.ValidatePasswordCommand);

            Assert.IsNotNull(obj.CmdState);


            Assert.AreEqual((SupportedServicies)0
                            , obj.TypeService);

            Assert.IsFalse(obj.IsOmvServer);
            Assert.IsFalse(obj.IsRpi);
            Assert.IsFalse(obj.IsSsh);
            Assert.IsFalse(obj.IsSynoServer);
            Assert.IsFalse(obj.IsWebminServer);
        }
Exemple #5
0
        public LoginPage()
        {
            InitializeComponent();
            BindingContext           = viewModel = new LoginPageViewModel();
            OtpPopup.BackgroundColor = Color.FromRgba(0, 0, 0, 0.5);

            MessagingCenter.Subscribe <LoginPageViewModel, bool>(this, "OtpPopup", (sender, arg) =>
            {
                OtpPopup.IsVisible = arg;
                entryOTP1.Focus();
                progressBar.Progress = 1;
                spReset.TextColor    = Color.Gray;
                Device.StartTimer(TimeSpan.FromMilliseconds(updateRate), () =>
                {
                    if (progressBar.Progress > 0)
                    {
                        Device.BeginInvokeOnMainThread(() => progressBar.Progress -= step);
                        return(true);
                    }
                    lblResetOtp.IsEnabled = true;
                    spReset.TextColor     = Color.FromHex(UnselectedColor);
                    return(false);
                });
            });
        }
        public void ValidateConfig_CmdState_True()
        {
            var obj = new LoginPageViewModel();

            Assert.IsNotNull(obj);
            Assert.IsNotNull(obj.DisplayName);
            Assert.IsNotNull(obj.HostName);
            Assert.IsNotNull(obj.Login);
            Assert.IsNotNull(obj.Password);
            Assert.IsNotNull(obj.Port);

            Assert.IsNotNull(obj.ValidateUserNameCommand);
            Assert.IsNotNull(obj.CmdState);
            Assert.IsNotNull(obj.ValidateHostNameCommand);
            Assert.IsNotNull(obj.ValidatePasswordCommand);


            obj.HostName.Value    = "doods.tu";
            obj.DisplayName.Value = "My test";
            obj.Login.Value       = "doods";
            obj.Password.Value    = "password";
            obj.Port.Value        = "80";

            Assert.IsTrue(obj.CmdState.CanExecute(null));
            obj.CmdState.Execute(null);


            Assert.IsTrue(obj.DisplayName.IsValid);
            Assert.IsTrue(obj.HostName.IsValid);
            Assert.IsTrue(obj.Login.IsValid);
            Assert.IsTrue(obj.Password.IsValid);
            Assert.IsTrue(obj.Port.IsValid);
        }
Exemple #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="LoginPage" /> class.
        /// </summary>
        public LoginPage()
        {
            var authorizationService = App.Kernel.Get <IAuthorizationService>();

            InitializeComponent();
            BindingContext = new LoginPageViewModel(this, authorizationService);
        }
Exemple #8
0
 public LoginPage(string filePath, string dbPath)
 {
     InitializeComponent();
     BindingContext = new LoginPageViewModel(filePath);
     mDbPath        = dbPath;
     mFilePath      = filePath;
 }
Exemple #9
0
 public LoginPage()
 {
     InitializeComponent();
     BackgroundImage      = "Fondo.jpeg";
     BindingContext       = viewModel = new LoginPageViewModel();
     viewModel.Navigation = this.Navigation;
 }
        public LoginPage()
        {
            LoginPageViewModel lpvm = new LoginPageViewModel();

            BindingContext = lpvm;
            InitializeComponent();
        }
        public LoginPage()

        {
            InitializeComponent();

            var vms = new LoginPageViewModel();

            this.BindingContext = vms;

            vms.DisplayInvalidLoginPrompt += () => DisplayAlert("Error", "Invalid Login, try again", "OK");



            emailentry.Completed += (object sender, EventArgs e) =>

            {
                passwordentry.Focus();
            };



            passwordentry.Completed += (object sender, EventArgs e) =>

            {
                vms.SubmitCommand.Execute(null);

                if (vms.loginvalid)

                {
                    CheckLogin();
                }
            };
        }
 public LoginPage()
 {
     try
     {
         InitializeComponent();
     }
     catch (System.Exception ex)
     {
     }
     if (Application.Current.Properties.ContainsKey("AppLocale") && !string.IsNullOrEmpty(Application.Current.Properties["AppLocale"].ToString()))
     {
         var languageculture = Application.Current.Properties["AppLocale"].ToString();
         if (languageculture == "ar-AE")
         {
             this.FlowDirection = FlowDirection.RightToLeft;
         }
         else
         {
             this.FlowDirection = FlowDirection.LeftToRight;
         }
     }
     else
     {
         this.FlowDirection = FlowDirection.LeftToRight;
     }
     loginPageViewModel           = this.BindingContext as LoginPageViewModel;
     LoginPageViewModel.LoginPswd = loginPswd;
 }
        public async Task Constructor_Authentication_ShouldFail()
        {
            // arrange
            //currentlySelectedFactory.Setup(x => x.LastError).Returns(new Models.ErrorItem() { issue = "Some Error"});
            currentlySelectedFactory.Setup(x => x.SelectedUser).Returns(new Models.User()
            {
                Error = new Models.ErrorItem()
                {
                    issue = "Some Error"
                }
            });
            loginService.Setup(x => x.Login()).Returns(Task.FromResult(false));
            sut = new LoginPageViewModel(currentlySelectedFactory.Object, loginService.Object);

            // act
            sut.LoadedCommand.Execute(null);
            while (String.IsNullOrEmpty(_LoginPageMessageKey))
            {
                await Task.Delay(0);
            }

            // assert

            Assert.IsNull(currentlySelectedFactory.Object.SelectedUser.fullName);
            CollectionAssert.AreEqual(_LoginPageMessageKey.ToCharArray(), "Authentication Failed".ToCharArray());
            CollectionAssert.AreEqual(_LoginPageMessageValue.ToCharArray(), currentlySelectedFactory.Object.SelectedUser.Error.issue.ToCharArray());
            Assert.IsFalse(currentlySelectedFactory.Object.SelectedUser.Error.isHTML);
        }
Exemple #14
0
        public void CheckLoginCommandKoWhenLoginEmpty()
        {
            var loginPageViewModel = new LoginPageViewModel(new MockView(), new MockView());

            Assert.IsTrue(string.IsNullOrEmpty(loginPageViewModel.Login));
            Assert.IsFalse(loginPageViewModel.LogUserInCommand.CanExecute(null));
        }
        public LoginPage()
        {
            loginPageViewModel = new LoginPageViewModel();

            InitializeComponent();
            BindingContext = loginPageViewModel;
        }
Exemple #16
0
        public LoginPage()
        {
            InitializeComponent();
            BindingContext = new LoginPageViewModel();

            this.Title = "Home";
        }
        public async Task Constructor_TryingToGrabUser_ShouldReturnHTMLErrorPage()
        {
            // arrange
            currentlySelectedFactory.Setup(x => x.SelectedUser).Returns(new Models.User()
            {
                Error = new Models.ErrorItem()
                {
                    issue = "<!DOCTYPE html>", isHTML = true
                }
            });
            //currentlySelectedFactory.Setup(x => x.LastError).Returns(new Models.ErrorItem() { issue = "<!DOCTYPE html>", isHTML = true});
            loginService.Setup(x => x.Login()).Returns(Task.FromResult(false));
            sut = new LoginPageViewModel(currentlySelectedFactory.Object, loginService.Object);

            // act
            sut.LoadedCommand.Execute(null);
            while (String.IsNullOrEmpty(_AppMessage))
            {
                await Task.Delay(0);
            }

            // assert
            Assert.IsNull(currentlySelectedFactory.Object.SelectedUser.fullName);
            CollectionAssert.AreEqual(_AppMessage.ToCharArray(), "HTML Error".ToCharArray());
            Assert.IsTrue(currentlySelectedFactory.Object.SelectedUser.Error.isHTML);
            CollectionAssert.AreEqual(currentlySelectedFactory.Object.SelectedUser.Error.issue.ToCharArray(), "<!DOCTYPE html>".ToCharArray());
        }
        public LoginPage()
        {
            InitializeComponent();
            vm = new LoginPageViewModel();

            BindingContext = vm;
        }
Exemple #19
0
 public async void GoToLoginPage(LoginPageViewModel viewModel, bool canGoBack)
 {
     await GoToPage(new LoginPage()
     {
         BindingContext = viewModel ?? _container.Resolve <LoginPageViewModel>()
     }, canGoBack);
 }
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            // smooth merchant thumbnail image resizing
            new BitmapTransform().InterpolationMode = BitmapInterpolationMode.Cubic;

            Frame rootFrame = Window.Current.Content as Frame;

            if (rootFrame == null)
            {
                rootFrame = new Frame();
                rootFrame.NavigationFailed += OnNavigationFailed;
                Window.Current.Content      = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                var navigationService    = new NavigationService(rootFrame);
                var loginPageViewModel   = new LoginPageViewModel();
                var accountPageViewModel = new AccountPageViewModel();
                var schedulerService     = new SchedulerService();

                var mondoAuthorizationClient = new MondoAuthorizationClient("YOUR_CLIENT_ID_HERE", "YOUR_CLIENT_SECRET_HERE", "https://production-api.gmon.io");

                var appController = new AppController(navigationService, mondoAuthorizationClient, loginPageViewModel, accountPageViewModel, schedulerService);

                appController.Start();
                rootFrame.Navigate(typeof(LoginPage), e.Arguments);
                rootFrame.DataContext = loginPageViewModel;
            }

            Window.Current.Activate();
        }
        public LoginPage()
        {
            InitializeComponent();
            BindingContext = new LoginPageViewModel();
            NavigationPage.SetHasBackButton(this, false);
            Debug.WriteLine(UserLoggedIn.Token);
            Debug.WriteLine(UserLoggedIn.User);

            SettingsIos = new ToolbarItem();
            if (Device.OS == TargetPlatform.Android)
            {
                ToolbarItems.Add(new ToolbarItem("hamburger", "Resources/drawable/settings.png", async() =>
                {
                    await Navigation.PushAsync(new HamburgerMenu());
                }));
            }
            else if (Device.OS == TargetPlatform.iOS)
            {
                SettingsIos.Text    = "+";
                SettingsIos.Command = new Command(() => { NavigateToSettings(); });
                ToolbarItems.Add(SettingsIos);
            }
            else
            {
                Debug.WriteLine("There is no device found");
            }
        }
 public LoginPage()
 {
     InitializeComponent();
     NavigationPage.SetHasNavigationBar(this, false);
     loginVM        = new LoginPageViewModel(Navigation);
     BindingContext = loginVM;
 }
Exemple #23
0
        public RegistrationPage(ServerWorker serverWorker, LoginPageViewModel loginPageViewModel)
        {
            InitializeComponent();
            BindingContext = new RegistrationPageViewModel(Navigation, serverWorker, loginPageViewModel);

            NavigationPage.SetHasNavigationBar(this, false);
        }
Exemple #24
0
 public LoginPagePin(LoginPageViewModel loginPageViewModel)
 {
     InitializeComponent();
     pin = string.Empty;
     PinOne.Focus();
     BindingContext = _loginPageViewModel = loginPageViewModel;
 }
Exemple #25
0
        public MainViewModel(LoginPageViewModel loginPageViewModel,
                             PlaylistsPageViewModel playlistsPageViewModel,
                             SearchPageViewModel searchPageViewModel)
        {
            _playlistsPageViewModel = playlistsPageViewModel;
            _searchPageViewModel    = searchPageViewModel;

            CurrentPage = loginPageViewModel;

            MessengerInstance.Register <object>(this, MessageType.LoginSuccessful, LoginSuccessful);

            MenuItems = new ObservableCollection <MenuItemViewModel>
            {
                new MenuItemViewModel("File")
                {
                    MenuItems = new ObservableCollection <MenuItemViewModel>
                    {
                        new MenuItemViewModel("Exit", new RelayCommand(Exit))
                    }
                },
                new MenuItemViewModel("View", new RelayCommand <MenuItemViewModel>(SwitchViewFromMenuItem))
                {
                    MenuItems = new ObservableCollection <MenuItemViewModel>
                    {
                        new MenuItemViewModel("Search",
                                              new RelayCommand <MenuItemViewModel>(SwitchViewFromMenuItem))
                        {
                            IsChecked = true
                        },
                        new MenuItemViewModel("Playlists",
                                              new RelayCommand <MenuItemViewModel>(SwitchViewFromMenuItem)),
                    }
                }
            };
        }
Exemple #26
0
        public ActionResult Index()
        {
            var code = Request.QueryString["code"];

            if (!string.IsNullOrEmpty(code))
            {
                // Get auth token from auth code
                TokenCache TC = new TokenCache();

                //Values are hard-coded for sample purposes
                string authority         = ConfigurationManager.AppSettings["authUri"];
                AuthenticationContext AC = new AuthenticationContext(authority, TC);
                ClientCredential      cc = new ClientCredential(ConfigurationManager.AppSettings["clientId"], ConfigurationManager.AppSettings["clientSecret"]);
                var AR = AC.AcquireTokenByAuthorizationCodeAsync(code, new Uri(ConfigurationManager.AppSettings["redirectUri"]), cc);

                Session["AccessToken"] = AR.Result.AccessToken;
            }
            else if (Session["Accesstoken"] == null)
            {
                var viewModel = new LoginPageViewModel();

                return(View(viewModel));
            }

            return(RedirectToAction("Index", "Dashboards"));
        }
        public LoginPage()
        {
            InitializeComponent();

            _viewModel            = BindingContext as LoginPageViewModel;
            _viewModel.navigation = Navigation;
        }
Exemple #28
0
        public ActionResult SubmitLogin(LoginPageViewModel currentPage)
        {
            Response.Cache.SetCacheability(HttpCacheability.NoCache);

            if (ModelState.IsValid)
            {
                if (!string.IsNullOrWhiteSpace(currentPage.Username) && !string.IsNullOrWhiteSpace(currentPage.Password))
                {
                    //prevent brute force first
                    if (ReCaptchaHelper.Validate(Request.Form["g-Recaptcha-Response"]))
                    {
                        //yes this is depreciated, but there are no decent alternatives for this simple use-case.
                        //please make one.
                        if (FormsAuthentication.Authenticate(currentPage.Username, currentPage.Password))
                        {
                            FormsAuthentication.RedirectFromLoginPage(currentPage.Username, currentPage.RememberMe);
                        }
                    }
                    else
                    {
                        ModelState.AddModelError("Login", "Beep Boop - Robot test failed.");
                    }
                }
            }

            //forget the entered password on retry
            currentPage.Password = string.Empty;

            //model not valid
            return(View("Login", currentPage));
        }
Exemple #29
0
        public void LoginCommandTo_Navigates_To_AnotherPage_When_Login_Is_Successful_And_Saves_Credentials()
        {
            ClubUser testUser = new ClubUser
            {
                UserId          = "TestID",
                Email           = "testEmail",
                IsEmailVerified = true,
                Name            = "Test Name",
                Surname         = "Test Surname",
                Phone           = "Test Phone"
            };
            ICredentials secureCredentials = new DummyCredentials();

            _authService.LoginWithEmailAndPasswordAsync("testEmail", "testPassword", true, false).Returns(
                new AuthResult
            {
                Result = "Success",
                User   = testUser
            });
            _sut = new LoginPageViewModel(_navigationService, _pageDialogService, _authService, secureCredentials);
            _sut.OnNavigatedTo(_parameters);

            _sut.Email    = "testEmail";
            _sut.Password = "******";
            _sut.LoginCommand.Execute();

            Assert.That(secureCredentials.Password, Is.EqualTo("testPassword"));
            Assert.That(secureCredentials.User, Is.EqualTo(testUser));
            _navigationService.Received(1).NavigateAsync("AnotherPage");
        }
Exemple #30
0
        public async Task Should_NotLoginInWithInvalidCredentials_Pass()
        {
            //Arrange
            var keychainService      = container.Resolve <IKeychainService>();
            var navigationService    = container.Resolve <INavigationService>();
            var authenticationFacade = container.Resolve <IAuthenticationFacade>();
            var dialogService        = container.Resolve <IPageDialogService>();

            var viewModel = new LoginPageViewModel(navigationService, authenticationFacade, dialogService, keychainService)
            {
                Username = "******",
            };

            //Act
            viewModel.LoginCommand.Execute(null);

            await Task.Delay(1000);

            //Assert
            Assert.Equal(keychainService.AreCredentialsValid(), true);
            var credentials = keychainService.GetCredentials();

            Assert.Equal(viewModel.Username.ToLower(), credentials.Username.ToLower());

            var navigation = navigationService as NavigationServiceMock;

            Assert.NotNull(navigation);

            var navUrl         = navigation.LastNavigationUrl;
            var expectedNavUrl = "app:///MainMasterDetailPage/Navigation/HomePage/DashboardPage";

            Assert.Equal(expectedNavUrl, navUrl);
        }
 private async void Login()
 {
     var vm = new LoginPageViewModel();
     if (await vm.Show())
     {
         this.NavigationService.ClearHistory();
         this.NavigationService.Navigate("My", null);
     }
 }
 private void StartTransition()
 {
     this.PageTransitionIn.Begin();
     if (this.ViewModel == null)
     {
         this.ViewModel = new LoginPageViewModel();
     }
 }