Diffstat (limited to 'core/opie-login/loginwindowimpl.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/opie-login/loginwindowimpl.cpp | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/core/opie-login/loginwindowimpl.cpp b/core/opie-login/loginwindowimpl.cpp index 547a9b3..b9a286d 100644 --- a/core/opie-login/loginwindowimpl.cpp +++ b/core/opie-login/loginwindowimpl.cpp | |||
@@ -224,17 +224,31 @@ private: | |||
224 | }; | 224 | }; |
225 | 225 | ||
226 | void LoginWindowImpl::login ( ) | 226 | void LoginWindowImpl::login ( ) |
227 | { | 227 | { |
228 | const char *user = ::strdup ( m_user-> currentText ( ). local8Bit ( )); | 228 | char *const user = ::strdup ( m_user-> currentText ( ). local8Bit ( )); |
229 | const char *pass = ::strdup ( m_password-> text ( ). local8Bit ( )); | 229 | char *pass = ::strdup ( m_password-> text ( ). local8Bit ( )); |
230 | 230 | ||
231 | if ( !user || !user [0] ) | 231 | if ( !user ) { |
232 | if ( pass ) | ||
233 | free( pass ); | ||
232 | return; | 234 | return; |
233 | if ( !pass ) | 235 | } |
236 | if ( !user [0] ) { | ||
237 | free( user ); | ||
238 | if ( pass ) | ||
239 | free( pass ); | ||
240 | return; | ||
241 | } | ||
242 | bool passwordIsEmpty = false; | ||
243 | if ( !pass ) { | ||
244 | passwordIsEmpty = true; | ||
234 | pass = ""; | 245 | pass = ""; |
246 | } | ||
235 | 247 | ||
236 | if ( lApp-> checkPassword ( user, pass )) { | 248 | if ( lApp-> checkPassword ( user, pass )) { |
249 | if ( !passwordIsEmpty ) | ||
250 | free(pass); | ||
237 | Config cfg ( "opie-login" ); | 251 | Config cfg ( "opie-login" ); |
238 | cfg. setGroup ( "General" ); | 252 | cfg. setGroup ( "General" ); |
239 | cfg. writeEntry ( "LastLogin", user ); | 253 | cfg. writeEntry ( "LastLogin", user ); |
240 | cfg. write ( ); | 254 | cfg. write ( ); |
@@ -248,8 +262,11 @@ void LoginWindowImpl::login ( ) | |||
248 | } | 262 | } |
249 | else { | 263 | else { |
250 | QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." )); | 264 | QMessageBox::warning ( this, tr( "Wrong password" ), tr( "The given password is incorrect." )); |
251 | m_password-> clear ( ); | 265 | m_password-> clear ( ); |
266 | free( user ); | ||
267 | if ( !passwordIsEmpty ) | ||
268 | free( pass ); | ||
252 | } | 269 | } |
253 | } | 270 | } |
254 | 271 | ||
255 | void LoginWindowImpl::showPasswordDialog() { | 272 | void LoginWindowImpl::showPasswordDialog() { |