-
Notifications
You must be signed in to change notification settings - Fork 5
/
Login.bas
95 lines (83 loc) · 2.2 KB
/
Login.bas
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
B4A=true
Group=Default Group
ModulesStructureVersion=1
Type=Activity
Version=7.3
@EndOfDesignText@
#Region Activity Attributes
#FullScreen: False
#IncludeTitle: False
#End Region
Sub Process_Globals
Dim strUserID As String
Dim strUserName As String
End Sub
Sub Globals
Dim txtUserID As EditText
Dim txtPassword As EditText
Dim lblMessage As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("frmLogin")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnLogin_Click
'Dim strUserID As String = txtUserID.Text.Trim
lblMessage.Text = ""
strUserID = txtUserID.Text.Trim
If strUserID = "" Then
Msgbox("Please enter User ID", "Error")
Return
End If
Dim strPassword As String = txtPassword.Text.Trim
If strPassword = "" Then
Msgbox("Please enter Password", "Error")
Return
End If
Dim Job2 As HttpJob
Job2.Initialize("Login", Me)
Job2.Download2(Main.strURL & "signin.php", _
Array As String("user_id", strUserID, "password", strPassword))
ProgressDialogShow("Connecting to server...")
End Sub
Sub JobDone (Job As HttpJob)
ProgressDialogHide
If Job.Success = True Then
Dim ret As String
Dim act As String
ret = Job.GetString
Dim parser As JSONParser
parser.Initialize(ret)
act = parser.NextValue
If act = "Not Found" Then
ToastMessageShow("Login failed", True)
lblMessage.Text = "Wrong User ID or Password!"
lblMessage.TextColor = Colors.Red
Else If act = "Not Activated" Then
ToastMessageShow("Login failed", True)
lblMessage.Text = "Account is not activated!"
lblMessage.TextColor = Colors.Blue
Else If act = "Error" Then
ToastMessageShow("Login failed", True)
lblMessage.Text = "An error has occured!"
lblMessage.TextColor = Colors.Red
Else
strUserName = act
StartActivity("Member")
Activity.Finish
End If
Else
'Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
'Sub btnForgotMyPassword_Click
' StartActivity("Forgot")
'End Sub
Sub btnResetMyPassword_Click
StartActivity("Reset")
End Sub