@@ -97,7 +97,10 @@ internal async void Install()
9797
9898 internal async void LogIn ( )
9999 {
100- if ( string . IsNullOrEmpty ( UserName ) || string . IsNullOrEmpty ( UserPass ) || string . IsNullOrWhiteSpace ( UserName ) || string . IsNullOrWhiteSpace ( UserPass ) )
100+ UserName = UserName ? . Trim ( ) ;
101+ UserPass = UserPass ? . Trim ( ) ;
102+
103+ if ( string . IsNullOrEmpty ( UserName ) || string . IsNullOrEmpty ( UserPass ) )
101104 {
102105 await MessageBox . Show ( MainWindow . instance ! , "Username and password are required fields." , "Login error" , MessageBox . MessageBoxButtons . OK ) ;
103106 return ;
@@ -134,8 +137,11 @@ internal void SwitchToLogin()
134137
135138 internal async void Register ( )
136139 {
137- if ( string . IsNullOrEmpty ( UserName ) || string . IsNullOrEmpty ( UserPass ) || string . IsNullOrEmpty ( UserEmail ) ||
138- string . IsNullOrWhiteSpace ( UserName ) || string . IsNullOrWhiteSpace ( UserPass ) || string . IsNullOrWhiteSpace ( UserEmail ) )
140+ UserName = UserName ? . Trim ( ) ;
141+ UserPass = UserPass ? . Trim ( ) ;
142+ UserEmail = UserEmail . Trim ( ) ;
143+
144+ if ( string . IsNullOrEmpty ( UserName ) || string . IsNullOrEmpty ( UserPass ) || string . IsNullOrEmpty ( UserEmail ) )
139145 {
140146 await MessageBox . Show ( MainWindow . instance ! , "Username, password and email are all required fields." , "Register error" , MessageBox . MessageBoxButtons . OK ) ;
141147 return ;
@@ -165,7 +171,9 @@ internal async void Register()
165171
166172 internal async void Reset ( )
167173 {
168- if ( string . IsNullOrEmpty ( UserName ) || string . IsNullOrWhiteSpace ( UserName ) )
174+ UserName = UserName ? . Trim ( ) ;
175+
176+ if ( string . IsNullOrEmpty ( UserName ) )
169177 {
170178 await MessageBox . Show ( MainWindow . instance ! , "Username is a required field." , "Reset password" , MessageBox . MessageBoxButtons . OK ) ;
171179 return ;
0 commit comments