Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.78 KB | None | 0 0
  1. package login_example;
  2.  
  3. import java.io.BufferedReader;
  4. import java.io.IOException;
  5. import java.io.InputStreamReader;
  6.  
  7. import login_example.auth.Session;
  8. import login_example.service.DatabaseSingleton;
  9.  
  10. public class Main {
  11.  
  12. public static void main(String[] args) {
  13. System.out.println("Username/password:");
  14. BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
  15. try {
  16. String username = br.readLine();
  17. String password = br.readLine();
  18. br.close();
  19. Session session = Session.getInstance();
  20. session.login(username, password);
  21. System.out.println(session.isLoggedIn() ? "Successfully login!" : "Wrong username/password!");
  22. } catch (IOException e) {
  23. DatabaseSingleton.getInstance().disconnect();
  24. e.printStackTrace();
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement