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

Attachments

  • User Login Client (2.00).b4xtemplate
    221.3 KB · Views: 70
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)
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…