Guest User

Untitled

a guest
Oct 17th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. $(document).ready(function(){
  2. $('#signIn').submit(function(){
  3. var a = $('#email').val();
  4. $.post('/api/login', { //this used to post to verifyUser.php
  5. Username: $('#email').val(),
  6. Password: $('#password').val()
  7. }, function(data){
  8. if(data['credentials'] == true){
  9. console.log('credentials true');
  10. console.log(data['uri']);
  11. window.location.href=data['uri'];
  12. } else {
  13. $('#errMsg').html(data['errMsg']);
  14. $('.alert').show();
  15. }
  16. }, 'json');
  17. return false;
  18. });
  19.  
  20. public function authenticate(Request $request) //aka api/login endpoint
  21. {
  22. //...
  23. $legacyRes = $this->authenticateLegacy($request);
  24. //...
  25. }
  26.  
  27.  
  28. private function authenticateLegacy(Request $request)
  29. {
  30. $response = null;
  31. try {
  32. $response = $this->client->post('/admin/verifyUser.php', [
  33. 'form_params' => ['Username' => $request->get('Username'),
  34. 'Password' => $request->get('Password')]
  35. ]);
  36. }
  37. catch(Exception $exception){
  38. Log::error('Errrererererer', [$exception->getMessage()]);
  39. }
  40. $body = (string)$response->getBody();
  41. Log::info('BODY:', [$body]);
  42. return $body;
  43.  
  44. }
Add Comment
Please, Sign In to add comment