Share My Creation [Project Template] User Login Client [B4X]

Version: 1.01
Description: Remake of MySQL API Server (Key + Token) and [B4X] User Login Apps

B4J
B4A


Many bugs in previous project have been addressed.
It is now showing how long a user last login.
The main page for showing a list of user online is just a simple example.
This template can be use for general purpose or any functionality.
You can use it for displaying any contents which requires authenticated or authorised login users such as quiz and shopping cart.
The functions for user registration, login, change password and reset password are fully implemented.

To be use together with [B4J] User Login Server
 

Attachments

  • User Login Client (1.01).b4xtemplate
    377.1 KB · Views: 149
Last edited:

aeric

Expert
Licensed User
Longtime User
Updated to v1.01

It is fully functional now. Try B4A, B4J and B4i projects.
 
Last edited:

aeric

Expert
Licensed User
Longtime User
A very small fix.

B4XPageUserProfile:
Sub BtnEdit_Click
    If BtnEdit.Text = "E D I T" Then
        BtnEdit.Text = "U P D A T E"
        BtnCancel.Visible = True
        txtUserName.Text = lblUserName.Text
        txtUserLocation.Text = lblUserLocation.Text
        lblUserName.Visible = False
        lblUserLocation.Visible = False
        txtUserName.mBase.Visible = True
        txtUserLocation.mBase.Visible = True
    Else
        'BtnEdit.Text = "E D I T"
        If txtUserName.Text.Trim = "" Then
            xui.MsgboxAsync("Please enter your Name", "E R R O R")
            Return
        End If
        If txtUserLocation.Text.Trim = "" Then
            xui.MsgboxAsync("Please enter your Location", "E R R O R")
            Return
        End If
        UpdateProfile
    End If
End Sub
 

aeric

Expert
Licensed User
Longtime User
B4XPageUserProfile
Update to the following code:

B4X:
Sub UpdateProfile
    Try
        Log("[B4XPageUserProfile] UpdateProfile")
        Dim data As Map
        data.Initialize
        data.Put("key", Main.User.ApiKey)
        data.Put("token", Main.User.Token)
        data.Put("user_name", txtUserName.Text.Trim)
        data.Put("user_location", txtUserLocation.Text.Trim)
        Dim job As HttpJob
        job.Initialize("", Me)
        job.PutString(Main.strURL & "users/update-profile", data.As(JSON).ToString)
        job.GetRequest.SetHeader("Authorization", "Bearer " & Main.User.Token)
        Wait For (job) JobDone(job As HttpJob)
 
Top