Advertisement
Guest User

Untitled

a guest
Feb 17th, 2020
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.26 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10. using Authed;
  11. using Jose.jwe;
  12. using Newtonsoft.Json;
  13.  
  14. namespace ModernDesignLoginForm
  15. {
  16. public partial class Form1 : Form
  17. {
  18. Auth auth = new Auth();
  19. AuthedChecker checker = new AuthedChecker();
  20.  
  21. public Form1()
  22. {
  23. InitializeComponent();
  24. bool response = auth.Authenticate("Auth here");
  25. if (response != true)
  26. {
  27. MessageBox.Show("Pas connecté");
  28. Environment.Exit(0);
  29.  
  30. }
  31. }
  32.  
  33. private void exitApp_Click(object sender, EventArgs e)
  34. {
  35. this.Close();
  36. }
  37.  
  38. private void minimalizeApp_Click(object sender, EventArgs e)
  39. {
  40. WindowState = FormWindowState.Minimized;
  41. }
  42.  
  43. private void bunifuTextbox2_OnTextChange(object sender, EventArgs e)
  44. {
  45. }
  46.  
  47. private void bunifuThinButton21_Click(object sender, EventArgs e)
  48. {
  49. string username = bunifuTextbox2.Text;
  50. string password = bunifuTextbox1.Text;
  51. bool login = auth.Login(username, password);
  52. if (login == true)
  53. {
  54.  
  55. MessageBox.Show("Connecté");
  56. Form3 openForm = new Form3();
  57. openForm.Show();
  58.  
  59. }
  60. else
  61. {
  62. MessageBox.Show("Echouer");
  63. }
  64. Properties.Settings.Default.Username = bunifuTextbox2.Text;
  65. Properties.Settings.Default.Password = bunifuTextbox1.Text;
  66. Properties.Settings.Default.Save();
  67. }
  68.  
  69. private void label2_Click(object sender, EventArgs e)
  70. {
  71. this.Hide();
  72. Form3 f3 = new Form3();
  73. f3.ShowDialog();
  74. this.Close();
  75. }
  76.  
  77. private void Form1_Load(object sender, EventArgs e)
  78. {
  79. bunifuTextbox2.Text = Properties.Settings.Default.Username;
  80. bunifuTextbox1.Text = Properties.Settings.Default.Password;
  81. }
  82.  
  83.  
  84. }
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement