Skip to content

Commit

Permalink
Small improvement for #8.
Browse files Browse the repository at this point in the history
Changes password window label if password was wrong.
  • Loading branch information
julian-poidevin committed May 4, 2017
1 parent 1f45712 commit 81910c0
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ void MainWindow::on_patchButton_clicked()
QProcess process;
QString errorOutput;
QString command;
QInputDialog *passwordDialog;
passwordDialog = new QInputDialog;
QString passwordDialogLabel = "Password :";

//Search kext file
if(searchKernelExtensionFile(&kernelFile))
Expand All @@ -41,9 +44,9 @@ void MainWindow::on_patchButton_clicked()
{
do
{
password = QInputDialog::getText(this,tr("Password"),tr("Password:"),QLineEdit::Password,"",&ok);
password = passwordDialog->getText(this,tr("Password"),passwordDialogLabel,QLineEdit::Password,"",&ok);

command = "sudo -S cd";
command = "sudo -S pwd";
process.start(command);

process.write(password.toLocal8Bit());
Expand All @@ -53,6 +56,11 @@ void MainWindow::on_patchButton_clicked()
qDebug() << errorOutput;
process.closeWriteChannel();

if(errorOutput.contains("try again"))
{
passwordDialogLabel="Wrong password, try again.\nPassword :";
}

if(!ok)
{
process.close();
Expand Down

0 comments on commit 81910c0

Please sign in to comment.