Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiFi automatic url detection #14

Open
ylogx opened this issue Oct 23, 2014 · 8 comments
Open

WiFi automatic url detection #14

ylogx opened this issue Oct 23, 2014 · 8 comments

Comments

@ylogx
Copy link
Member

ylogx commented Oct 23, 2014

This is one of the high priority task still pending. Due to this the app can't be useful outside PU@Campus and hence is blocking release anywhere outside.
The chief goal is to get the url dynamically instead of hard-coded string (http:172....).

There are two type of cases where this happens . . .

CASE 1: Redirections 302
  • I created this code to test redirections in PU@Campus http://fpaste.org/144654/
  • PU@Campus is weird, it sometimes redirects and sometimes serves a local page instead that redirects.
  • It isn't completly successful but works in some situations.
CASE 2: Local server serves page instead of google.com which redirects (UIET, PU@Campus sometimes does this)
  • We need to figure out a way to distinguish normal google homepage from the one served to us.
  • Then we need to parse that page data to get the url, which is easy (RegEx).
  • Then we need to find out what the username and password field's id are in response. This is tough part I guess. Let's reach till the above point and then we'll figure out a solution for this phase too.
@Ashish-Bansal
Copy link
Member

I think we should use some html parser (may be jsoup). In most of the forms, there would be two fields, one for email and other for password and then one input field type submit. So we can extract those input fields and get the name of the fields using parser and can also check form submit type method used (get or post). May be something like this : http://pastebin.com/4zEYcFsy . Although I have not tested it and it is not complete.

@ylogx
Copy link
Member Author

ylogx commented Oct 25, 2014

Looks like a good start. I think you have the push access now.
Let's start doing this in a separate branch and see where we reach.

@Ashish-Bansal
Copy link
Member

I don't think we can make it global. Although login is possible but still we can't find out the logout URL by any means. Instead rating of app would decrease and users will give negative comments too that it does not works fine and blah blah.....!!

@ylogx
Copy link
Member Author

ylogx commented Nov 2, 2014

Login is what we need to worry about right now. Login is possible. Definitely possible. If google can find and show Sign in notif, then it is definitely possible.
AFA logout is concerned we can always disable that using seperate layouts (based on hasLogoutCapability function or something) etc.
PS: Rating is not the driving force. The main motive is to build the product that we started with in the first place. We don't have commercial goals from this application, so ratings don't matter. Anyway if the final product is useful, positive response will follow eventually

@ylogx
Copy link
Member Author

ylogx commented Nov 5, 2014

Hey @Ashish-Bansal I just pushed 862ab22.
I can't make this tree work man. I tried and login and logout gives no response. Can you please look into it and debug it further.

@Ashish-Bansal
Copy link
Member

Well I tried it today morning but didn't got the much time to test it. I was able to log in using it. But I tried log out but it didn't worked. I thought there must be some other issue with it as I didn't changed anything regarding that. But now it struck my mind.
If you are already logged in and you press up log in, this changes the BASE_URL to http://www.google.co.in/........ and after that logout would not work as BASE_URL+ "?cmd=logout" is not logout url. That's why logout is not working.
While testing it on home network, I just figured out that If user presses login multiple times, it is not gonna send requests multiple times. Only one thread will run and all other would be in queue and if first one does not finishes up(possible!!) or lets consider other one in which first one request finishes successfully(user login is successful) but next request is not gonna finish up because regex match would fail and stuck up there, then nothing is gonna work until user restarts it. We need something else to kill that thread or some better way.

@ylogx
Copy link
Member Author

ylogx commented Nov 12, 2014

Here is a recent logcat at this tree 5569357
http://fpaste.org/150209/

@Ashish-Bansal
Copy link
Member

Okay So, I found two issues in it.

  1. I know this one -> java.lang.IllegalStateException: Cannot execute task: the task is already running.
    It is in line : https://github.com/DevelopFreedom/logmein-android/blob/ashish-merge/app/src/main/java/org/developfreedom/logmein/LoginService.java#L73

Although I have used m_ping.cancel(true); but I don't know where I am making mistake.

  1. It didn't worked on local server page.[Logcat line no. 351] Actually I didn't knew that in local server page, Address is like this -> https://securelogin.arubanetworks.com...... .I had made regex for ip address http://123.123.123.123/anything?anything....
    Although we can use another regex but then another problem will arise.
    If I changed the regex here (https://github.com/DevelopFreedom/logmein-android/blob/ashish-merge/app/src/main/java/org/developfreedom/logmein/NetworkEngine.java#L366) , then m.find() would be true in most of the cases and url would/may be wrong.
    Any suggestions??

@ylogx ylogx added the ready label May 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants