Ignore:
Timestamp:
02/27/14 11:11:58 (7 months ago)
Author:
Ken Moore <ken@…>
Branches:
master, releng/10.0.1, releng/10.0.2, releng/10.0.3
Children:
47a52f4
Parents:
7c53dd2
Message:

Couple new features for PCDM
1) Add option to require that the user type in the username instead of just selecting one from a list (does not recognize "root" or "toor", I made sure of that)
2) Move the backend system user detection to using "getent" after conversation with john @ ixsystems. That should properly pick up LDAP/ActiveDirectory users as well, whereas "pw" might not.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src-qt4/PCDM/src/loginWidget.cpp

    rbac293d rae41693  
    1818  pwVisible = FALSE; //Have the password box hide the input behind dots 
    1919  allowPWVisible = TRUE; //Allow the password button to show the password text 
    20    
     20  showUsers = true; //Display the available users on the system 
     21         
    2122  //Create the Grid layout 
    2223  QHBoxLayout* hlayout1 = new QHBoxLayout(); 
    2324  QHBoxLayout* hlayout2 = new QHBoxLayout(); 
     25  QHBoxLayout* hlayout3 = new QHBoxLayout(); 
    2426  QVBoxLayout* vlayout = new QVBoxLayout(); 
    2527  QFormLayout* flayout = new QFormLayout(); 
     
    3638  linePassword = new QLineEdit; 
    3739        linePassword->setFocusPolicy(Qt::StrongFocus); 
     40  lineUsername = new QLineEdit; 
     41        lineUsername->setFocusPolicy(Qt::StrongFocus); 
    3842  pushLogin = new QToolButton; 
    3943        QAction* tmp1 = new QAction(this); 
     
    5761    vlayout->addWidget(listUserBig); 
    5862    //User selected widgets 
    59       flayout->addRow(pushUserIcon, listUsers); 
     63        hlayout3->addWidget(listUsers); 
     64        hlayout3->addWidget(lineUsername); 
     65      flayout->addRow(pushUserIcon, hlayout3); 
    6066      flayout->addRow(pushViewPassword, linePassword); 
    6167      flayout->addRow(deIcon,listDE); 
     
    8894void LoginWidget::updateWidget(){ 
    8995  //Setup the visibility/sizes 
    90   if(userSelected){ 
     96  if(userSelected && showUsers){ 
    9197    userIcon->setVisible(FALSE); 
    9298    listUserBig->setVisible(FALSE); 
    9399    pushUserIcon->setVisible(TRUE); 
    94100    listUsers->setVisible(TRUE); 
     101    lineUsername->setVisible(false); 
    95102    linePassword->setVisible(TRUE); 
    96103    pushLogin->setVisible(TRUE); 
     
    98105    if( listDE->count() < 1 ){ listDE->setVisible(FALSE); deIcon->setVisible(FALSE); } 
    99106    else{ listDE->setVisible(TRUE); deIcon->setVisible(TRUE); } 
    100   }else{ 
     107  }else if(!showUsers){ 
     108    //Do not show either of the user selection widgets 
     109    userIcon->setVisible(FALSE); 
     110    listUserBig->setVisible(FALSE); 
     111    pushUserIcon->setVisible(TRUE); 
     112    listUsers->setVisible(false); 
     113    lineUsername->setVisible(true); 
     114    linePassword->setVisible(TRUE); 
     115    pushLogin->setVisible(TRUE); 
     116    pushViewPassword->setVisible(TRUE); 
     117    if( listDE->count() < 1 ){ listDE->setVisible(FALSE); deIcon->setVisible(FALSE); } 
     118    else{ listDE->setVisible(TRUE); deIcon->setVisible(TRUE); } 
     119  }else{ 
     120    //ShowUsers and none selected 
    101121    userIcon->setVisible(TRUE); 
    102122    listUserBig->setVisible(TRUE); 
     
    154174 
    155175void LoginWidget::slotTryLogin(){ 
    156   QString user = listUsers->currentText(); 
     176  QString user; 
     177  if(showUsers){ 
     178    user = listUsers->currentText(); 
     179  }else{ 
     180    user = lineUsername->text(); 
     181  } 
    157182  QString pw = linePassword->text(); 
    158183  emit loginRequested(user,pw); 
     
    364389  } 
    365390} 
     391 
     392void LoginWidget::allowUserSelection(bool allow){ 
     393  showUsers = allow; 
     394  updateWidget(); 
     395} 
Note: See TracChangeset for help on using the changeset viewer.