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

improve: https/http login #647

Merged
merged 22 commits into from
Mar 7, 2024
Merged

improve: https/http login #647

merged 22 commits into from
Mar 7, 2024

Conversation

Costallat
Copy link
Collaborator

Description

Improve HTTPS/HTTP login with JSON.

Behavior

Actual

Not working very well, using functions that should be used to send POST/FORM to send JSON, manually mounting the request, etc

Expected

Use the right things and use a library to handle with the requests.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

  • Login successfully
  • Login failed
  • Slow login
  • Try to login several times (not wait for answer, cancel and login again)
  • Mark unsafe login and see that it tries to login with HTTP
  • Not mark unsafe login and see that it doesn't try to login with HTTP

Test Configuration:

  • Server Version: 10.31
  • Client: 13.21
  • Operating System: Linux

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

@Costallat Costallat changed the title Improve HTTPS/HTTP login [DRAFT] Improve HTTPS/HTTP login Nov 27, 2023
@Piksel91

This comment was marked as outdated.

@majestyotbr majestyotbr changed the title [DRAFT] Improve HTTPS/HTTP login improve: https/http login Nov 27, 2023
@majestyotbr majestyotbr marked this pull request as draft November 27, 2023 20:16
@Piksel91
Copy link

I've got problem with compiling pr. Error MSB3073 The command ""D:\vcpkg\vcpkg.exe" install --x-wait-for-lock --triplet "x64-windows-static" --vcpkg-root "D:\vcpkg\\" "--x-manifest-root=

@Costallat
Copy link
Collaborator Author

@Piksel91 test now. I don`t use windows, so I just saw that the build was failing after opening the PR.

@Piksel91
Copy link

@Costallat still the same problem.

@Costallat
Copy link
Collaborator Author

Costallat commented Nov 29, 2023

@Costallat still the same problem.

How you are building on windows? Are you using the cmake to build?

Because all checks are working now and they build using cmake

@Piksel91
Copy link

Im using Visual Studio and trying build with Run as always.

@Costallat
Copy link
Collaborator Author

Im using Visual Studio and trying build with Run as always.

Humm, I don't know how VS works in that mode, try to see if there is same cmake options on the VS.

@Piksel91
Copy link

Piksel91 commented Nov 29, 2023

I don't know how to do that. WIthout this or everything works fine in visual studio. Probably you add something what VS need but I dont have.

Edit1: I fix Visual Studio problem. I had to reinstall vcpkg and re-run VIsual Studio then all necessary packages was downloaded.

Edit2: Visual Studio build problem x64.

image

@Costallat

@Costallat
Copy link
Collaborator Author

I don't know how to do that. WIthout this or everything works fine in visual studio. Probably you add something what VS need but I dont have.

Edit1: I fix Visual Studio problem. I had to reinstall vcpkg and re-run VIsual Studio then all necessary packages was downloaded.

Edit2: Visual Studio build problem x64.

image

@Costallat

I asked here to someone try to fix the build from Visual Studio as I don't have it here.

@Piksel91
Copy link

Piksel91 commented Nov 30, 2023

Visual Studio showing error on this part of code:


#ifndef __MINGW32__
  if (inet_pton(AF_INET6, host_.c_str(), &addr6)) {
    type = GEN_IPADD;
    addr_len = sizeof(struct in6_addr);
  } else if (inet_pton(AF_INET, host_.c_str(), &addr)) {
    type = GEN_IPADD;
    addr_len = sizeof(struct in_addr);
  }

@mehah
Copy link
Owner

mehah commented Dec 1, 2023

@Piksel91
test now

@Piksel91
Copy link

Piksel91 commented Dec 1, 2023

@mehah @Costallat

now build is ok.
My tests results attached below:

It was tested for gunzodus ots - 13.20 Tibia.

I used in my opinion correct service login: https://www.gunzodus.net/game/login/1320?nservice.php

On this configuration I receive information like below:

Configuration:

image

Information:

image

If I used check box "unsafe login" is still the same error. But when I add 80 port I receive somthing like below, but nothing happend more.

image

Of course my account name is e-mail.

@Costallat
Copy link
Collaborator Author

Costallat commented Dec 1, 2023

@Piksel91

If the URL is https you have to use port 443

The error is strange too, I will see if I can add more information, because Success(no error) doesn't help huauaa

@Piksel91
Copy link

Piksel91 commented Dec 2, 2023

It's not possiable to login on gunzo/ezo 13.20. I don't know correct link or posibilities to connect.

@Costallat
Copy link
Collaborator Author

Costallat commented Dec 5, 2023

@Piksel91

The login address is: https://www.gunzodus.net/game/login/1290?nservice.php

I got from their client, but I didn't tested

Also you can send them an email asking what we need to do to be able to login on their server using OTC.

@Piksel91
Copy link

Piksel91 commented Dec 7, 2023

@Costallat atm their client is 13.20 then login service is https://www.gunzodus.net/game/login/1320?nservice.php
As I mentioned before I think it's impossiable to login because gunzo have own servies to login and this is not supported.

@Costallat
Copy link
Collaborator Author

Costallat commented Dec 7, 2023

@Costallat atm their client is 13.20 then login service is https://www.gunzodus.net/game/login/1320?nservice.php As I mentioned before I think it's impossiable to login because gunzo have own servies to login and this is not supported.

@Piksel91

The client version is 1320, but the login link that it uses is the one that I sent, I got direct from their 13.20 client.

I don't think that they have something so special, because you can't change the official client in that way, it would be very hard to do that, we just need to understand what they expect to receive, so we can add here.

With that information I can work to see how to add that here, maybe they are expecting to be a POST in FORM format, but I tried to test a few times but I don't have too much time to keep testing all possibilities, so I think that if you send an email asking that or asking that someone from their team add those information here I can see what I can do.

Renato Foot added 4 commits December 8, 2023 00:33
investigating more details to improve the fix

Signed-off-by: Renato Foot <[email protected]>
Signed-off-by: Renato Foot <[email protected]>
Improve http login:

- Use SSL/HTTPS by default, and only try with HTTP when unsafe login is enabled

- Fix trying to login multiple times to display multiple result windows

- Split lua functions

- Add new lib to handle with the HTTP requests

Signed-off-by: Renato Foot <[email protected]>
Renato Foot and others added 16 commits December 8, 2023 00:33
Signed-off-by: Renato Foot <[email protected]>
Signed-off-by: Renato Foot <[email protected]>
Signed-off-by: Renato Foot <[email protected]>
Signed-off-by: Renato Foot <[email protected]>
Signed-off-by: Renato Foot <[email protected]>
Signed-off-by: Renato Foot <[email protected]>
Signed-off-by: Renato Foot <[email protected]>
This reverts commit f3d59c2.
Also renamed unsafe variable to http to make the code
more readable.

Signed-off-by: Renato Foot <[email protected]>
- Check if it's https or http to define the port if it is not set
- Save/Load http login check box
- Add more PT translations

Signed-off-by: Renato Foot <[email protected]>
Signed-off-by: Renato Foot <[email protected]>
@Piksel91
Copy link

@Costallat I asked but withoud answer...

Copy link

This PR is stale because it has been open 45 days with no activity.

@github-actions github-actions bot added the Stale label Jan 10, 2024
@github-actions github-actions bot removed the Stale label Mar 7, 2024
@mehah mehah marked this pull request as ready for review March 7, 2024 16:03
@mehah mehah merged commit 00cd5e6 into main Mar 7, 2024
7 of 10 checks passed
@mehah mehah deleted the imp-http-login branch March 7, 2024 16:04
@kokekanon
Copy link
Collaborator

kokekanon commented Mar 20, 2024

@Costallat

I don't use versions that require httplogin, but change in client_serverlist causes bug and crash, ERROR: lua function callback failed: LUA ERROR:

== application started at Mar 20 2024 16:47:41
== operating system: Windows
OTClient - Redemption 3.x rev 0.000 (desenv) built on Mar 13 2024 for arch x64
Startup done :]
ERROR: Lua exception: /client_entergame/entergame.lua:270: attempt to get length of local 'httpLogin' (a boolean value)
stack traceback:
	[C]: in function '__len'
	/client_entergame/entergame.lua:270: in function 'setHttpLogin'
	/client_serverlist/serverlist.lua:44: in function 'select'
	/client_serverlist/serverlist.lua:81: in function </client_serverlist/serverlist.lua:80>
ERROR: protected lua call failed: LUA ERROR:
/client_entergame/entergame.lua:270: attempt to get length of local 'httpLogin' (a boolean value)
stack traceback:
	[C]: in function '__len'
	/client_entergame/entergame.lua:270: in function 'setHttpLogin'
	/client_serverlist/serverlist.lua:44: in function 'select'
	/client_serverlist/serverlist.lua:81: in function </client_serverlist/serverlist.lua:80>
ERROR: Lua exception: 
ERROR: lua function callback failed: LUA ERROR:

ERROR: Lua exception: 
ERROR: lua function callback failed: LUA ERROR:

ERROR: Lua exception: 
ERROR: lua function callback failed: LUA ERROR:

ERROR: Lua exception: 
ERROR: lua function callback failed: LUA ERROR:

ERROR: Lua exception: 
ERROR: lua function callback failed: LUA ERROR:

ERROR: Lua exception: 
ERROR: lua function callback failed: LUA ERROR:

ERROR: Lua exception: 
ERROR: lua function callback failed: LUA ERROR:

ERROR: Lua exception: 
ERROR: lua function callback failed: LUA ERROR:

posible fix

function EnterGame.setHttpLogin(httpLogin)
    if type(httpLogin) == "boolean" then
        enterGame:getChildById('httpLoginBox'):setChecked(httpLogin)
    else
        enterGame:getChildById('httpLoginBox'):setChecked(#httpLogin > 0)
    end
end
2024-03-20.16-47-39.mp4

Nottinghster pushed a commit that referenced this pull request Apr 3, 2024
…#736)

* fix: crash game_entergame if httpLoginBox is boolean ( #647 )

* fix: game_entergame if host nil  windows is hidden

* temp fix: game_entergame windows is not centered

the original bug is in
I don't have how to test I don't use token
  EnterGame.toggleAuthenticatorToken
  EnterGame.toggleStayLoggedBox
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants