@@ -452,14 +452,19 @@ private void ImportAuthenticator(string maFilePath) {
452452 // But here we're dealing with WinAuth authenticator
453453 Logging . LogGenericInfo ( "ASF requires a few more steps to complete authenticator import..." , BotName ) ;
454454
455- InitializeLoginAndPassword ( ) ;
455+ if ( ! InitializeLoginAndPassword ( ) ) {
456+ return ;
457+ }
456458
457459 UserLogin userLogin = new UserLogin ( BotConfig . SteamLogin , BotConfig . SteamPassword ) ;
458460 LoginResult loginResult ;
459461 while ( ( loginResult = userLogin . DoLogin ( ) ) != LoginResult . LoginOkay ) {
460462 switch ( loginResult ) {
461463 case LoginResult . Need2FA :
462464 userLogin . TwoFactorCode = Program . GetUserInput ( Program . EUserInputType . TwoFactorAuthentication , BotName ) ;
465+ if ( string . IsNullOrEmpty ( userLogin . TwoFactorCode ) ) {
466+ return ;
467+ }
463468 break ;
464469 default :
465470 Logging . LogGenericError ( "Unhandled situation: " + loginResult , BotName ) ;
@@ -1143,14 +1148,19 @@ private void LinkMobileAuthenticator() {
11431148
11441149 Logging . LogGenericInfo ( "Linking new ASF MobileAuthenticator..." , BotName ) ;
11451150
1146- InitializeLoginAndPassword ( ) ;
1151+ if ( ! InitializeLoginAndPassword ( ) ) {
1152+ return ;
1153+ }
11471154
11481155 UserLogin userLogin = new UserLogin ( BotConfig . SteamLogin , BotConfig . SteamPassword ) ;
11491156 LoginResult loginResult ;
11501157 while ( ( loginResult = userLogin . DoLogin ( ) ) != LoginResult . LoginOkay ) {
11511158 switch ( loginResult ) {
11521159 case LoginResult . NeedEmail :
11531160 userLogin . EmailCode = Program . GetUserInput ( Program . EUserInputType . SteamGuard , BotName ) ;
1161+ if ( string . IsNullOrEmpty ( userLogin . EmailCode ) ) {
1162+ return ;
1163+ }
11541164 break ;
11551165 default :
11561166 Logging . LogGenericError ( "Unhandled situation: " + loginResult , BotName ) ;
@@ -1165,6 +1175,9 @@ private void LinkMobileAuthenticator() {
11651175 switch ( linkResult ) {
11661176 case AuthenticatorLinker . LinkResult . MustProvidePhoneNumber :
11671177 authenticatorLinker . PhoneNumber = Program . GetUserInput ( Program . EUserInputType . PhoneNumber , BotName ) ;
1178+ if ( string . IsNullOrEmpty ( authenticatorLinker . PhoneNumber ) ) {
1179+ return ;
1180+ }
11681181 break ;
11691182 default :
11701183 Logging . LogGenericError ( "Unhandled situation: " + linkResult , BotName ) ;
@@ -1174,7 +1187,12 @@ private void LinkMobileAuthenticator() {
11741187
11751188 BotDatabase . SteamGuardAccount = authenticatorLinker . LinkedAccount ;
11761189
1177- AuthenticatorLinker . FinalizeResult finalizeResult = authenticatorLinker . FinalizeAddAuthenticator ( Program . GetUserInput ( Program . EUserInputType . SMS , BotName ) ) ;
1190+ string sms = Program . GetUserInput ( Program . EUserInputType . SMS , BotName ) ;
1191+ if ( string . IsNullOrEmpty ( sms ) ) {
1192+ return ;
1193+ }
1194+
1195+ AuthenticatorLinker . FinalizeResult finalizeResult = authenticatorLinker . FinalizeAddAuthenticator ( sms ) ;
11781196 if ( finalizeResult != AuthenticatorLinker . FinalizeResult . Success ) {
11791197 Logging . LogGenericError ( "Unhandled situation: " + finalizeResult , BotName ) ;
11801198 DelinkMobileAuthenticator ( ) ;
@@ -1210,14 +1228,22 @@ private void JoinMasterChat() {
12101228 SteamFriends . JoinChat ( BotConfig . SteamMasterClanID ) ;
12111229 }
12121230
1213- private void InitializeLoginAndPassword ( ) {
1231+ private bool InitializeLoginAndPassword ( ) {
12141232 if ( string . IsNullOrEmpty ( BotConfig . SteamLogin ) ) {
12151233 BotConfig . SteamLogin = Program . GetUserInput ( Program . EUserInputType . Login , BotName ) ;
1234+ if ( string . IsNullOrEmpty ( BotConfig . SteamLogin ) ) {
1235+ return false ;
1236+ }
12161237 }
12171238
12181239 if ( string . IsNullOrEmpty ( BotConfig . SteamPassword ) && string . IsNullOrEmpty ( BotDatabase . LoginKey ) ) {
12191240 BotConfig . SteamPassword = Program . GetUserInput ( Program . EUserInputType . Password , BotName ) ;
1241+ if ( string . IsNullOrEmpty ( BotConfig . SteamPassword ) ) {
1242+ return false ;
1243+ }
12201244 }
1245+
1246+ return true ;
12211247 }
12221248
12231249 private void OnConnected ( SteamClient . ConnectedCallback callback ) {
@@ -1248,7 +1274,10 @@ private void OnConnected(SteamClient.ConnectedCallback callback) {
12481274 }
12491275 }
12501276
1251- InitializeLoginAndPassword ( ) ;
1277+ if ( ! InitializeLoginAndPassword ( ) ) {
1278+ Stop ( ) ;
1279+ return ;
1280+ }
12521281
12531282 Logging . LogGenericInfo ( "Logging in..." , BotName ) ;
12541283
@@ -1476,10 +1505,18 @@ private async void OnLoggedOn(SteamUser.LoggedOnCallback callback) {
14761505 switch ( callback . Result ) {
14771506 case EResult . AccountLogonDenied :
14781507 AuthCode = Program . GetUserInput ( Program . EUserInputType . SteamGuard , BotName ) ;
1508+ if ( string . IsNullOrEmpty ( AuthCode ) ) {
1509+ Stop ( ) ;
1510+ return ;
1511+ }
14791512 break ;
14801513 case EResult . AccountLoginDeniedNeedTwoFactor :
14811514 if ( BotDatabase . SteamGuardAccount == null ) {
14821515 TwoFactorAuth = Program . GetUserInput ( Program . EUserInputType . TwoFactorAuthentication , BotName ) ;
1516+ if ( string . IsNullOrEmpty ( TwoFactorAuth ) ) {
1517+ Stop ( ) ;
1518+ return ;
1519+ }
14831520 } else {
14841521 TwoFactorAuth = BotDatabase . SteamGuardAccount . GenerateSteamGuardCode ( ) ;
14851522 }
@@ -1512,6 +1549,10 @@ private async void OnLoggedOn(SteamUser.LoggedOnCallback callback) {
15121549
15131550 if ( string . IsNullOrEmpty ( BotConfig . SteamParentalPIN ) ) {
15141551 BotConfig . SteamParentalPIN = Program . GetUserInput ( Program . EUserInputType . SteamParentalPIN , BotName ) ;
1552+ if ( string . IsNullOrEmpty ( BotConfig . SteamParentalPIN ) ) {
1553+ Stop ( ) ;
1554+ return ;
1555+ }
15151556 }
15161557
15171558 if ( ! ArchiWebHandler . Init ( SteamClient , callback . WebAPIUserNonce , BotConfig . SteamParentalPIN ) ) {
0 commit comments