@@ -14,7 +14,8 @@ public abstract class AuthHelper : NetHelperBase, IConnect
1414 private const string LogUriBase = "https://auth{0}.tsinghua.edu.cn/cgi-bin/srun_portal" ;
1515 private const string FluxUriBase = "https://auth{0}.tsinghua.edu.cn/rad_user_info.php" ;
1616 private const string ChallengeUriBase = "https://auth{0}.tsinghua.edu.cn/cgi-bin/get_challenge?username={{0}}&double_stack=1&ip&callback=callback" ;
17- private const string LogoutData = "action=logout&ac_id=1&ip=&double_stack=1" ;
17+ private const string LogoutData = "action=logout" ;
18+ private const string LogoutUserData = "action=logout&username={0}" ;
1819 private readonly string LogUri ;
1920 private readonly string FluxUri ;
2021 private readonly string ChallengeUri ;
@@ -67,6 +68,14 @@ internal AuthHelper(string username, string password, HttpClient client, int ver
6768 /// <returns>The response of the website.</returns>
6869 public Task < string > LogoutAsync ( ) => PostAsync ( LogUri , LogoutData ) ;
6970 /// <summary>
71+ /// Logout from the network with the specified username.
72+ /// When a user logged in through <see cref="AuthHelper"/> and logged out through <see cref="NetHelper"/>,
73+ /// he should call this method with his username explicitly, or he can't logout.
74+ /// </summary>
75+ /// <param name="username">The specified username.</param>
76+ /// <returns>The response of the website.</returns>
77+ public Task < string > LogoutAsync ( string username ) => PostAsync ( LogUri , string . Format ( LogoutUserData , username ) ) ;
78+ /// <summary>
7079 /// Get information of the user online.
7180 /// </summary>
7281 /// <returns>An instance of <see cref="FluxUser"/> class of the current user.</returns>
0 commit comments