Guest User

Untitled

a guest
Nov 9th, 2017
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. <form action="login.php" method="post" id="clientLogin" onsubmit="return C1heckFields()">
  2. <!--?php csrf_token(); ?-->
  3. <strong></strong>
  4. <br>
  5.  
  6. <div>
  7. <label for="email">Логин:</label>
  8. <input id="myl" type="text" name="login" size="16" value="">
  9. </div>
  10.  
  11. <div>
  12. <label for="ticketno">Пароль:</label>
  13. <input id="ticketno" type="password" name="password" size="16" value="">
  14. </div>
  15. <p>
  16. <input class="btn" type="submit" value="Войти">
  17. </p>
  18. </form>
  19.  
  20. class ApplicationsAuth extends AsyncTask<Void, Void, Void> {
  21. protected Map<String, String> applicationsAuthCookies = null;
  22. protected String userLogin;
  23. protected String userPassword;
  24. protected String userName;
  25.  
  26. public ApplicationsAuth(String login, String password)
  27. {
  28. this.userLogin = login;
  29. this.userPassword = password;
  30. }
  31.  
  32. @Override
  33. protected Void doInBackground(Void... params) {
  34.  
  35. Document testPage = null;
  36.  
  37. Connection.Response authStartResponse = null;
  38. Connection.Response authFinalResponse = null;
  39.  
  40.  
  41. try {
  42. authStartResponse = Jsoup.connect("http://support.tltsu.ru/")
  43. .method(Connection.Method.GET)
  44. .timeout(3500)
  45. .execute();
  46.  
  47. try {
  48. authFinalResponse = Jsoup.connect("http://support.tltsu.ru/login.php")
  49. .timeout(3500)
  50. .data("login", userLogin)
  51. .data("password", userPassword)
  52. .method(Connection.Method.POST)
  53. .cookies(authStartResponse.cookies())
  54. .execute();
  55. applicationsAuthCookies = authStartResponse.cookies();
  56. testPage = authFinalResponse.parse();
  57. } catch (IOException e) {
  58. e.printStackTrace();
  59. }
  60.  
  61. try {
  62. if (applicationsAuthCookies != null) {
  63. testPage = Jsoup.connect("http://support.tltsu.ru/")
  64. .cookies(applicationsAuthCookies)
  65. .timeout(3000)
  66. .get();
  67. userName = testPage.select("div#container > div#header > p").text();
  68. }
  69. } catch (IOException e) {
  70. e.printStackTrace();
  71. }
  72. } catch (IOException e) {
  73. e.printStackTrace();
  74. }
  75.  
  76. return null;
  77. }
  78.  
  79. @Override
  80. protected void onPostExecute(Void result) {
  81. super.onPostExecute(result);
  82.  
  83. }
  84. }
Add Comment
Please, Sign In to add comment