PDA

View Full Version : Login Screen GUI



augusbas
16th July 2009, 05:33
Hi all,

I need to develop a GUI in qt with user & password Edit.

When user enters the user name & password, i need to verify it through "getty Process" and then give access to the main screen or the login screen remains same.

Any idea on QT how to do it ?

nish
16th July 2009, 05:53
what is the problem? what did you already tried? Its very simple form.

augusbas
16th July 2009, 06:22
what is the problem? what did you already tried? Its very simple form.

Hi ,

i can able to create a form with User & password Edit in QT-Designer. No problem.

Now when the user enters the user name i need to verify the username with the "getty process of linux" and check whether the user name is right . Same case for password too.

Now how do i connect & check the user name entered in GUI to the getty command prompt process of linux ? This is the problem.

Another way : I need the same as Linux Login screen and process but using QT .

yogeshgokul
16th July 2009, 06:24
To check the user credentials, you can send unix commands from your login page.
For that you can use :
QDesktopServices
QProcess

nish
16th July 2009, 06:30
connect the clicked() signal of the OK(or login) button on the form to some slot and then take the lineedit values in a string...


void on_ok_clicked()
{
QString user=this->lineEditUser->text();
QString pass=this->lineEditPass->text();

QProcess:;execute("whatever command for username","arguments");
//dont use execute.. but read the std out of the command ... i dont know the linux cmd.
// check ur user and pass.

}

hope i have not misunderstood ur problem.. coz its just too simple..

augusbas
16th July 2009, 07:44
connect the clicked() signal of the OK(or login) button on the form to some slot and then take the lineedit values in a string...


void on_ok_clicked()
{
QString user=this->lineEditUser->text();
QString pass=this->lineEditPass->text();

QProcess:;execute("whatever command for username","arguments");
//dont use execute.. but read the std out of the command ... i dont know the linux cmd.
// check ur user and pass.

}

hope i have not misunderstood ur problem.. coz its just too simple..


Hi ,

Thanks to Yogesh and Death,

Let me try "Login" process to do the job.

I will get back to you soon

augusbas
16th July 2009, 10:20
connect the clicked() signal of the OK(or login) button on the form to some slot and then take the lineedit values in a string...


void on_ok_clicked()
{
QString user=this->lineEditUser->text();
QString pass=this->lineEditPass->text();

QProcess:;execute("whatever command for username","arguments");
//dont use execute.. but read the std out of the command ... i dont know the linux cmd.
// check ur user and pass.

}

hope i have not misunderstood ur problem.. coz its just too simple..


Hi,

I have a utility called "Login" and i can call this as a process. For example i can call as

./login root //passing username as argument.

The command immediately asks "password: " Now how do i pass my password text to this argument. Through stdin? . I have read that for password it doesnt take input through stdin . It directly reads from the terminal device. How do i send data to password. Please help

yogeshgokul
16th July 2009, 10:44
hope i have not misunderstood ur problem.. coz its just too simple..

If you are wanna login on shell using your GUI, then its not easy, I believe. Because the getty processes, takes only username as argument. After they check the username and asks for password using their own screen for higher security reasons.




I have a utility called "Login".
Please refer the docs/manuals of the utility. How to pass username, password as args.

augusbas
16th July 2009, 13:16
If you are wanna login on shell using your GUI, then its not easy, I believe. Because the getty processes, takes only username as argument. After they check the username and asks for password using their own screen for higher security reasons.



Please refer the docs/manuals of the utility. How to pass username, password as args.


Hi,

i got a error :

In my program i am trying to call

QProcess *myProcess = new QProcess(this);
myProcess->execute("/EXEC/login",arguments);

QByteArray data = myProcess->readStdout();

error: ‘class QProcess’ has no member named ‘readStdout’

How to solve this error

spirit
16th July 2009, 13:35
there are only such method in docs QProcess::readAllStandardOutput & QProcess::readAllStandardError.
btw, it would be better if you use QProcess::readyReadStandardOutput signal and then call QProcess::readAllStandardOutput in your slot.

NoRulez
16th July 2009, 13:40
A better way is to connect to the "void finished ( int exitCode, QProcess::ExitStatus exitStatus )" signal and start the process with "startDetached()".
Because if you wait for the return your application may be freeze.

Best Regards

wysota
16th July 2009, 23:49
If you're on Linux then the proper way would be to use pam (http://www.kernel.org/pub/linux/libs/pam/) instead of trying to interface with login.

augusbas
17th July 2009, 07:01
Hi,

i have created a test program to check whether i can read the standard output data from the command line utility. So i have called "man" utility as a process. The utilty when executes it prints "What manual page do you want?" I am trying to read this data through readyRead Signal. But i couldnt able to get the output through GUI .Instead its printing the output in the terminal where i am executing the program. How do i solve this problem?

Below is my program.


connect(pushButton_2, SIGNAL(clicked()), this, SLOT(login_call()) );
connect(myProcess , SIGNAL(readyReadStandardOutput()),this, SLOT(readFromStdout()) );

void GoToCellDialog::login_call()
{
myProcess->execute("/usr/bin/man");
textEdit->setText(myProcess->readAll());
}

void GoToCellDialog::readFromStdout()
{
printf("Inside Signal StdOut");
textEdit->append(myProcess->readAllStandardOutput());
}

wysota
17th July 2009, 07:55
Try the standard error output.

augusbas
17th July 2009, 08:06
Try the standard error output.

Hi,

I will try this Standard Output..

Sorry for not using code tags...I will follow the forum rules hereafter

augusbas
17th July 2009, 10:31
Try the standard error output.


Hi ,

I tried using Standard Error Output.

readyReadStandardError () Signal and readAllStandardError() .

But still the output is printing on the terminal where i am executing the program.

nish
17th July 2009, 10:35
take a look at the source code of cuteBuilder (www.cutebuilder.net/)... what it does is run the configure.exe (which askes questions) and make a gui frontend to it..
just take a look at its source code to apply the functionality in your program

Rajeshsan
18th December 2009, 06:20
Hi Mr Death, i saw your all postings. I need to get clarified with my one of problem. Which i have created new Thread in the name of Shell command by Qt 4.5.2. plz go thru it and assist me its urgent for me...