Skip to content

Commit

Permalink
Add auto detect email method
Browse files Browse the repository at this point in the history
  • Loading branch information
hearsilent committed Feb 26, 2017
1 parent 338e50c commit 348bf1d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 4 deletions.
27 changes: 25 additions & 2 deletions Windows/KUAS WiFi/LoginFrm.vb
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,31 @@ Public Class LoginFrm

Private Sub login(_host As String)
Dim parameters As IDictionary(Of String, String) = New Dictionary(Of String, String)()
parameters.Add("username", System.Uri.EscapeDataString(User.Text))
parameters.Add("userpwd", System.Uri.EscapeDataString(Pwd.Text))
Dim username As String = User.Text
Dim password As String = Pwd.Text

If (username.EndsWith("@kuas.edu.tw")) Then
username = username
ElseIf (username.EndsWith("@gm.kuas.edu.tw")) Then
username = username
ElseIf (username.Length() = 10 And Not username.Substring(0, 2).Equals("09")) Then
If (Convert.ToInt32(username.Substring(1, 3) <= 102)) Then
username += "@kuas.edu.tw"
Else
username += "@gm.kuas.edu.tw"
End If
ElseIf (username.Length() = 5) Then
username += "@kuas.edu.tw"
ElseIf (username.Contains("@") And Not username.Contains("@guest")) Then
username = username
Else
username += IIf(username.Contains("@guest"), "", "@guest")
End If

Debug.Print(username)

parameters.Add("username", System.Uri.EscapeDataString(username))
parameters.Add("userpwd", System.Uri.EscapeDataString(password))
parameters.Add("login", "")
parameters.Add("orig_referer", "")

Expand Down
4 changes: 2 additions & 2 deletions Windows/KUAS WiFi/My Project/AssemblyInfo.vb
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' 指定為預設值:
' <Assembly: AssemblyVersion("1.0.*")>

<Assembly: AssemblyVersion("2.2.4.27")>
<Assembly: AssemblyFileVersion("2.2.4.27")>
<Assembly: AssemblyVersion("2.3.2.27")>
<Assembly: AssemblyFileVersion("2.3.2.27")>

0 comments on commit 348bf1d

Please sign in to comment.