Exemplo n.º 1
0
        private void ShowCredentials(object sender, RoutedEventArgs e)
        {
            var vm     = new CredentialsViewModel(_environment);
            var view   = new CredentialsView();
            var window = new DialogWindow(view)
            {
                DataContext = vm
            };

            window.ShowDialog();
        }
        public async Task <IActionResult> Post([FromBody] CredentialsView credentials)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var identity = await GetClaimsIdentity(credentials.UserName, credentials.Password);

            if (identity == null)
            {
                return(BadRequest(Errors.AddErrorToModelState("login_failure", "Invalid username or password.", ModelState)));
            }

            var jwt = await Tokens.GenerateJwt(identity, _jwtFactory, credentials.UserName, _jwtOptions, new JsonSerializerSettings { Formatting = Formatting.Indented });

            return(new OkObjectResult(jwt));
        }
        private void ShowCredentials(object sender, RoutedEventArgs e)
        {
            var vm = new CredentialsViewModel(_environment)
            {
                ShowBrowserLogin = this.FindControl <CheckBox>("useBrowser").IsChecked ?? false,
                ShowTokenLogin   = this.FindControl <CheckBox>("usePat").IsChecked ?? false,
                ShowBasicLogin   = this.FindControl <CheckBox>("useBasic").IsChecked ?? false,
                EnterpriseUrl    = this.FindControl <TextBox>("enterpriseUrl").Text,
                UserName         = this.FindControl <TextBox>("username").Text
            };
            var view   = new CredentialsView();
            var window = new DialogWindow(view)
            {
                DataContext = vm
            };

            window.ShowDialog(this);
        }
Exemplo n.º 4
0
        private void ShowCredentials(object sender, RoutedEventArgs e)
        {
            var vm = new CredentialsViewModel(_environment)
            {
                ShowBrowserLogin = useBrowser.IsChecked ?? false,
                ShowTokenLogin   = usePat.IsChecked ?? false,
                ShowBasicLogin   = useBasic.IsChecked ?? false,
                Url      = instanceUrl.Text,
                UserName = username.Text
            };
            var view   = new CredentialsView();
            var window = new DialogWindow(view)
            {
                DataContext = vm
            };

            window.ShowDialog();
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CredentialsViewModel"/> class
        /// </summary>
        public CredentialsViewModel()
        {
            // init commands
            this.SaveCommand   = new RelayCommand(x => this.OnSaveCommand());
            this.CancelCommand = new RelayCommand(x => this.OnCancelCommand());

            // init view
            this.view = new CredentialsView(this);

            // try loading keys
            byte[] appKey = UserSettingsUtility.LoadAppKey();
            byte[] appSid = UserSettingsUtility.LoadAppSid();

            // decrypt loaded keys if any
            if (appKey != null && appSid != null)
            {
                this.AppSidText = Encoding.UTF8.GetString(SecurityUtility.Decrpyt(appSid));
                this.AppKeyText = Encoding.UTF8.GetString(SecurityUtility.Decrpyt(appKey));
            }

            // display view
            this.view.ShowDialog();
        }
Exemplo n.º 6
0
        private async void OnRegistrationCancelled(object sender, EventArgs e)
        {
            await RegistrationView.FadeTo(0, 100, Easing.CubicIn);

            CredentialsView.TranslateTo(0, 0, 150, Easing.CubicInOut);
        }
Exemplo n.º 7
0
        private async void OnRegisterTapped(object sender, EventArgs e)
        {
            await CredentialsView.TranslateTo(Width, 0, 150, Easing.CubicInOut);

            RegistrationView.FadeTo(1, 200, Easing.CubicIn);
        }