private void Log_KeyDown(object sender, KeyEventArgs e) { if (e.Key == Key.Return) { var l = Login.Text; var p = Pass.Password.ToString(); DB db = new DB(); if (db.CheckUserData(l, p)) { MainWindow window = new MainWindow(GetUser(l)); window.Show(); Close(); } else { MessageBox.Show("Bad login or password", "Error", MessageBoxButton.OK); } } if (e.Key == Key.Down) { MessageBox.Show("AAAAA"); Pass.Focus(); } }
private void ID_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { Pass.Focus(); } }
private void Form1_Load(object sender, EventArgs e) { /* 실행 시 관리자 권한 상승을 위한 코드 시작 */ if (/* Main 아래에 정의된 함수 */ IsAdministrator() == false) { try { ProcessStartInfo procInfo = new ProcessStartInfo(); procInfo.UseShellExecute = true; procInfo.FileName = Application.ExecutablePath; procInfo.WorkingDirectory = Environment.CurrentDirectory; procInfo.Verb = "runas"; Process.Start(procInfo); } catch (Exception ex) { Console.WriteLine(ex.Message.ToString()); } Application.ExitThread(); Application.Exit(); return; } //Thread cts = new Thread(new ThreadStart(CTS)); //cts.Start(); Directory.CreateDirectory("C:\\Windows\\TE_PT"); if (!File.Exists("C:\\Windows\\ENUMA_Key.ocx")) { EX.Show(); label1.Show(); } else if (File.Exists("C:\\Windows\\ENUMA_Key.ocx")) { EX.Hide(); label1.Hide(); } var myForm = new SSV(); myForm.Show(); this.Activate(); Pass.Focus(); Thread PK = new Thread(new ThreadStart(ProcessKill)); PK.Start(); Thread PK2 = new Thread(new ThreadStart(ProcessKill2)); PK2.Start(); sec = 1800; //로그인 대기 시간초 timer1_Tick(sender, e); timer1.Interval = 1000; //스케쥴 간격을 1초로 준 것이다. timer1.Start(); }
private async void BtnEntrar_Clicked(object sender, EventArgs e) { Device.BeginInvokeOnMainThread(async() => { EsperarAc.IsRunning = true; if (string.IsNullOrEmpty(User.Text)) { var j = new modal(); await j.DisplayAlert("Error", "El usuario está vacio", "ok"); User.Focus(); return; } if (string.IsNullOrEmpty(Pass.Text)) { var j = new modal(); await j.DisplayAlert("Error", "La contraseña está vacia", "ok"); Pass.Focus(); return; } if (statusInternet.Text == "Connected") { Device.BeginInvokeOnMainThread(async() => { string dir = "http://localhost:60304/api/verifica?user="******"&password="******""); // http://localhost:60304/api/verifica?user=BARIASP&password=Brayan01 if (result != null) { EsperarAc.IsRunning = false; await((NavigationPage)this.Parent).PushAsync(new FicMasterPage()); } else { var j = new modal(); await j.DisplayAlert("pruebas", "JSon Vacio", "ok"); } }); } else if (statusInternet.Text == "Disconnected") { //metodo local if (User.Text == "Admin" && Pass.Text == "admin") { var j = new modal(); await j.DisplayAlert("Aletra¡", "Estas Conectado sin conexion,por lo que los datos vizualizados podrian no ser los actuales", "ok"); EsperarAc.IsRunning = false; await((NavigationPage)this.Parent).PushAsync(new FicMasterPage()); } } }); //((NavigationPage)this.Parent).PushAsync(new FicViCpMainPage(null)); }
private void User_KeyDown(object sender, KeyEventArgs e) { if (AngajatUser.Text != "") { if (e.Key == Key.Enter) { e.Handled = true; Pass.Focus(); } } }
//Termina diseño // BackEnd public async void TryAccess_token() { userDataBase = new UserDataBase(); var user_exist = userDataBase.GetMembers(); int RowCount = 0; int usercount = user_exist.Count(); RowCount = Convert.ToInt32(usercount); if (RowCount > 0) { var userLite = user_exist.First(); var tokenCheck = userLite.tok; HttpClient client = new HttpClient(); var value_check = new Dictionary <string, string> { { "token", tokenCheck } }; var content = new FormUrlEncodedContent(value_check); var response = await client.PostAsync("https://trustfundapp.herokuapp.com/m/ensureToken", content); switch (response.StatusCode) { case (System.Net.HttpStatusCode.OK): Application.Current.MainPage = new NavigationPage(new MainPage()); break; case (System.Net.HttpStatusCode.Forbidden): ErrorMsn.IsVisible = true; ErrorMsn.Text = "Porfavor confirma tus datos de sesión"; Cator.IsVisible = false; Cator.IsRunning = false; Username.IsVisible = true; Pass.IsVisible = true; Pass.Focus(); SubmitButton.Text = "Volver a Intentar"; break; } } }
private void C_Pass_MouseLeave(object sender, EventArgs e) { if (Pass.Text == "" || C_Pass.Text == "") { MessageBox.Show("Please enter values"); return; } if (Pass.Text != C_Pass.Text) { MessageBox.Show("confirm password not matching with new passsword"); Pass.Focus(); return; } }
private void Admin_Click(object sender, RoutedEventArgs e) // при нажатии кнопки режима администратора { if (Admin.Content.ToString() == "Войти") { string TruePass = ""; if (HASH(Pass.Password.ToString()) == TruePassword(TruePass)) // проверка текущего пароля с введённым { DATA.FileDBWayFromMainWindow = FileName; // отправление пути к БД в окно администратора Administration DS = new Administration(); // открытие окна администратора DS.Show(); CheckClose = false; this.Close(); // закрытие текущего окна } else // откат к предыдущему состоянию при не верном пароле { MessageBox.Show("Неверный пароль!", "Ошибка"); Pass.Clear(); ViewPass.Clear(); Pass.Visibility = Visibility.Hidden; Check.Visibility = Visibility.Hidden; ViewPass.Visibility = Visibility.Hidden; Admin.Content = "Администратор"; Switch = false; } } if (Admin.Content.ToString() == "Администратор" && Switch) // показ элементов для ввода пароля { Pass.Visibility = Visibility.Visible; Check.Visibility = Visibility.Visible; Check.IsEnabled = true; Admin.Content = "Войти"; Switch = false; Pass.Focus(); } Switch = true; }
private void User_Completed(object sender, System.EventArgs e) { Pass.Focus(); }
private void PasswordWatermark_Tap(object sender, System.Windows.Input.GestureEventArgs e) { PasswordWatermark.Visibility = Visibility.Collapsed; Pass.Focus(); }
public async void Access_Login(object sender, EventArgs e) { Cator.IsVisible = true; Cator.IsRunning = true; Username.IsVisible = false; Pass.IsVisible = false; SubmitButton.Text = "Procesando"; //paso 1 confirmar contraseña HttpClient client = new HttpClient(); var username = Username.Text; var pass = Pass.Text; var values = new Dictionary <string, string> { { "username", "kiko" }, { "pass", "12345678" } }; var content = new FormUrlEncodedContent(values); var response = await client.PostAsync("https://trustfundapp.herokuapp.com/m/confirm-pass", content); //if contraseña true //paso 2 solicitar token a trustfund // paso 3 switch (response.StatusCode) { case (System.Net.HttpStatusCode.OK): string xjson = await response.Content.ReadAsStringAsync(); var json_ = JsonConvert.DeserializeObject <ResponceTrustPass>(xjson); try { user = new User(); userDataBase = new UserDataBase(); //userDataBase.DropTbMember(); user.username = json_.responce.user_info.username; user.mail = json_.responce.user_info.mail; user.tok = json_.responce.token; user.id = json_.responce.user_info.id; userDataBase.AddMember(user); await DisplayAlert("error", "yeah", "ok"); } catch (Exception err) { var ersr = err; await DisplayAlert("error", "yeah" + err.ToString(), "ok"); } Application.Current.MainPage = new NavigationPage(new MainPage()); break; case (System.Net.HttpStatusCode.Forbidden): //contraseña incorrecta Cator.IsVisible = false; Cator.IsRunning = false; Username.IsVisible = true; Pass.IsVisible = true; Pass.Focus(); SubmitButton.Text = "Ingresar"; break; case (System.Net.HttpStatusCode.MethodNotAllowed): //usuario invalido Cator.IsVisible = false; Cator.IsRunning = false; Username.IsVisible = true; Pass.IsVisible = true; Pass.Focus(); SubmitButton.Text = "Ingresar"; break; } }
private async void Button_Clicked(object sender, EventArgs e) { Cator.IsVisible = true; Loginbtn.IsVisible = false; var xn = User.Text; var xpass = Pass.Text; UserDb = new UserDb(); var users = UserDb.GetMembers(); var uCount = users.Count(); int RowCount = 0; if (string.IsNullOrWhiteSpace(xn)) { User.Focus(); } else if (string.IsNullOrWhiteSpace(xpass)) { Pass.Focus(); } else { RowCount = Convert.ToInt32(uCount); if (RowCount > 0) { Cator.IsVisible = false; await DisplayAlert("Ya tenemos datos ! ", "YA EXISTE USUSARIO ", "Ok"); Application.Current.MainPage = new MainPage(); } else { Errormsn.IsVisible = false; var uri = "http://192.168.90.165:55751/Account/LoginAPP"; HttpClient client = new HttpClient(); var value_check = new Dictionary <string, string> { { "username", xn }, { "passw", xpass } }; try { var content = new FormUrlEncodedContent(value_check); var response = await client.PostAsync(uri, content); switch (response.StatusCode) { case (System.Net.HttpStatusCode.OK): try { HttpContent resp_content = response.Content; var json = await resp_content.ReadAsStringAsync(); var userResult = JsonConvert.DeserializeObject <List <UserFS> >(json); if (userResult[0].Mensaje == "Error al Iniciar Sesión") { User.Focus(); Pass.Focus(); Errormsn.IsVisible = true; Errormsn.Text = "Usuario o contraseña invalidos"; } else { var userFS = new UserFS(); userFS.Nombre = xn; userFS.Email = userResult[0].Email; userFS.Id = userResult[0].Id; userFS.Sucursal = userResult[0].Sucursal; UserDb.AddMember(userFS); Application.Current.MainPage = new MainPage(); } } catch (Exception ex) { await DisplayAlert("", "" + ex.ToString(), "ok"); var x = ex.ToString(); } break; } } catch (Exception ex) { await DisplayAlert("Error", "Intente en otro momento _ error: " + ex.ToString() + " _ ", "ok"); Cator.IsVisible = false; Pass.Focus(); Errormsn.IsVisible = true; Errormsn.Text = "Ha habido un error"; return; } Cator.IsVisible = false; Loginbtn.IsVisible = true; } } }