Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[EE 2.7] How to fix auto-login


Akselj
 Share

Recommended Posts

Hey,

This is my first VB tut so please be nice :cheesy:

I guess many of you have seen that the auto-login is broken…. Well, here's the fix.

First, go to frmLogin and find picLogin. Double-click it and you will find this code:

```
Private Sub picLogin_Click()
    If LenB(frmLogin.txtPassword.Text) <> 0 Then
        frmLogin.Check1.Value = Checked
    Else
        frmLogin.Check1.Value = Unchecked
    End If

    Me.Visible = False
    frmLogin.Visible = True
End Sub

```
Change it to look like this:

```
Private Sub picLogin_Click()
If ReadINI("CONFIG", "Auto", App.Path & "\config.ini") = 0 Then
    If LenB(frmLogin.txtPassword.Text) <> 0 Then
        frmLogin.Check1.Value = Checked
    Else
        frmLogin.Check1.Value = Unchecked
    End If
    frmLogin.Visible = True
    Me.Visible = False
Else
        If AllDataReceived Then
        If LenB(frmLogin.txtName.Text) < 6 Then
            Call MsgBox("Your username must be at least three characters in length.")
            Exit Sub
        End If

        If LenB(frmLogin.txtPassword.Text) < 6 Then
            Call MsgBox("Your password must be at least three characters in length.")
            Exit Sub
        End If

        Call WriteINI("CONFIG", "Account", frmLogin.txtName.Text, (App.Path & "\config.ini"))
        Call MenuState(MENU_STATE_LOGIN)
        Me.Visible = False
    End If
End If
End Sub

```
That's it. Now you have working auto-login for your game!

Hop this is usefull,
AkselJ
Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...
  • 2 months later...
Uhhm, you forgot to add the cancel button:
```
Private Sub Label1_Click()

    AutoLogin = ReadINI("CONFIG", "Auto", (App.Path & "\config.ini"))
    If AutoLogin = 1 Then
        Call WriteINI("CONFIG", "Auto", 0, (App.Path & "\config.ini"))

        Me.Visible = False
        frmMainMenu.Visible = True
    End If

End Sub

```Also, make Label1 visible.
Link to comment
Share on other sites

AkselJ ,

It does work you just need to fix the bug in modGameEditor. They have the true and false swaped for the frmChars.Label1.Visible

```
Public Sub MainMenuInit()
    frmLogin.txtName.Text = Trim$(ReadINI("CONFIG", "Account", App.Path & "\config.ini"))
    frmLogin.txtPassword.Text = Trim$(ReadINI("CONFIG", "Password", App.Path & "\config.ini"))

    If frmLogin.Check1.Value = 0 Then
        frmLogin.Check2.Value = 0
    End If

    If ConnectToServer = True And AutoLogin = 1 Then
        frmMainMenu.picAutoLogin.Visible = True
        frmChars.Label1.Visible = False
    Else
        frmMainMenu.picAutoLogin.Visible = False
        frmChars.Label1.Visible = True
    End If
End Sub

```
I also added a line to the Sub Label1_Click to uncheck the auto-login box on the frmLogin.

```
Private Sub Label1_Click()

    AutoLogin = ReadINI("CONFIG", "Auto", (App.Path & "\config.ini"))
    If AutoLogin = 1 Then
        Call WriteINI("CONFIG", "Auto", 0, (App.Path & "\config.ini"))
        Call TcpDestroy
        frmLogin.Check2 = 0
        Me.Visible = False
        frmMainMenu.Visible = True
    End If

End Sub

```
Completely works now but not sure that you should be sent back to the MainMenu.

Enjoy,
Kranky65

P.S. Thanks for all of your great fixes.

Edit1: Added Call Tcp  Destroy to Sub Label Click1 because it would hang when you tried to login again.
Link to comment
Share on other sites

  • 2 weeks later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...