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

[CS:DE] Adding Password Confirmation


gdog12356
 Share

Recommended Posts

Ok well I don't think anyone released this yet so I figured I would release it.

So here we will start with the server:

In the server you will want to navigate to Private Sub HandleNewAccount.

under

```
Dim Password As String
```
add

```
Dim Password2 As String
```
next find

```
Password = Buffer.ReadString
```
and under it add

```
Password2 = Buffer.ReadString
```
Now find your way to

```
            ' Prevent hacking
            For i = 1 To Len(Name)
                n = AscW(Mid$(Name, i, 1))

                If Not isNameLegal(n) Then
                    Call AlertMsg(index, "Invalid name, only letters, numbers, spaces, and _ allowed in names.")
                    Exit Sub
                End If

            Next
```
under that whole thing, add

```
            If IsPassTheSame(Password, Password2) = False Then
                Call AlertMsg(index, "Passwords Do Not Match.")
                Exit Sub
            End If

```
This is checking if the two passwords match, and it will read form the data sent to the server from the client. Now we want to actually add the function so…

In ModServerTCP add this function to the bottom
```
Function IsPassTheSame(ByVal Password As String, ByVal Password2 As String) As Boolean

        If UCase$(Trim$(Password)) = UCase$(Trim$(Password2)) Then
          IsPassTheSame = True
        Else
        IsPassTheSame = False
        End If

End Function
```
Now, open up your client and navigate to Public Sub MenuState

change```
                Call SendNewAccount(sUser, sPass)

```to

```
                Call SendNewAccount(sUser, sPass, sPass2)

```
Now replace Public Sub SendNewAccount with this:
```
' *****************************
' ** Outgoing Client Packets **
' *****************************
Public Sub SendNewAccount(ByVal name As String, ByVal Password As String, ByVal Password2 As String)
Dim Buffer As clsBuffer

    ' If debug mode, handle error then exit out
    If Options.Debug = 1 Then On Error GoTo errorhandler

    Set Buffer = New clsBuffer
    Buffer.WriteLong CNewAccount
    Buffer.WriteString name
    Buffer.WriteString Password
    Buffer.WriteString Password2
    Buffer.WriteLong CLIENT_MAJOR
    Buffer.WriteLong CLIENT_MINOR
    Buffer.WriteLong CLIENT_REVISION
    SendData Buffer.ToArray()
    Set Buffer = Nothing

    ' Error handler
    Exit Sub
errorhandler:
    HandleError "SendNewAccount", "modClientTCP", Err.Number, Err.Description, Err.Source, Err.HelpContext
    Err.Clear
    Exit Sub
End Sub

```
What this does is send the data in the confirmation field to the server to be checked.

And walla! Your all done! No need to give credit's if you use this as it was easy as fuck but it would much appreciated. :).
Link to comment
Share on other sites

@ςเςเ:

> Thanks I really need to fix the glitchy register.
>
> >.>
> Nice job
>
> :star: :star: :star: :star: :star:

It never really glitched, it just did not have the function to check if both passwords matched.
Link to comment
Share on other sites

@John:

> It never really glitched, it just did not have the function to check if both passwords matched.

I wasn't talking about that, John..Talking about a glitch I accidentally made, but never came to fixing it.
Link to comment
Share on other sites

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...