You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Al Sutton <al...@al-and-andrea.org.uk> on 2007/06/05 14:10:03 UTC

[OT] Mentors, Was: How To Lock User Account If he Failed to give Correct Password in three attempts

Thanks for the clarification :).

I've been a Mentor a number of times in the past and I've always seen it as
someone who guides as well as corrects. In companies I worked in a mentor
has always been seen as the first port of call when a new coder has problems
or is unsure of something, that way not only do the get an answer quickly
they can also discuss the solution, and they can see any specifics a company
may have about the way of doing something.

I've always called the person who comes out of the woodwork only when I get
something wrong a Manager :).

-----Original Message-----
From: Raghupathy, Gurumoorthy [mailto:Gurumoorthy.Raghupathy@nielsen.com] 
Sent: 05 June 2007 13:05
To: Struts Users Mailing List
Subject: RE: How To Lock User Account If he Failed to give Correct Password
in three attempts

No way I said that you are being racist.... 
I think you are great... 
Look at the smiley icon I had at the last.... 


RTFM is the only way to get the concepts right.... 
Mentors are when we get something wrong ... not for teaching concepts ...



Happy coding and enjoy RTFM :)

Regards
Guru

-----Original Message-----
From: Al Sutton [mailto:al@al-and-andrea.org.uk]
Sent: 05 June 2007 12:56
To: 'Struts Users Mailing List'
Subject: RE: How To Lock User Account If he Failed to give Correct Password
in three attempts

I'm a firm beleiver in your RTFM answer.

You seem to think I was being in some way racist against Indians, this isn't
the case. If he had come from a company that said it was "The UKs leading IT
and technology company" I would have made the same remark quoting the title
of their website. My point was that if it's a leading IT and technology
company of any country why doesn't he have a mentor or collegue to turn to
who can answer this as opposed to using this list to go over some basics
which should be part of the basic skills of anyone working on a webapp.

Al.

-----Original Message-----
From: Raghupathy, Gurumoorthy
[mailto:Gurumoorthy.Raghupathy@nielsen.com]
Sent: 05 June 2007 12:48
To: Struts Users Mailing List
Subject: RE: How To Lock User Account If he Failed to give Correct Password
in three attempts


May be he is just a trainee learning java / struts / MVC .. 
If he knew this concepts then why would he come here .... :) 

My suggestion is RTFM

Remember I am an Indian as well (though I work in the UK) .. nothing
wrong
in being Indian or working for leading technology company as long as
this
type of questions is for training purpose and not into a "production
system"
for some company who are off-shoring their projects to them .... 


By the way why are we here? To help. :)

Regards
Guru


-----Original Message-----
From: Al Sutton [mailto:al@al-and-andrea.org.uk]
Sent: 05 June 2007 12:24
To: 'Struts Users Mailing List'
Subject: RE: How To Lock User Account If he Failed to give Correct
Password
in three attempts

You know theres something about requests like this coming from hcl.in
who
describe themselves as "Indias leading IT & Technology Company" that
deeply
concerns me..... 

-----Original Message-----
From: Srinivasula Reddy A , Bangalore [mailto:srinivasulaa@hcl.in]
Sent: 05 June 2007 12:08
To: Struts Users Mailing List
Subject: RE: How To Lock User Account If he Failed to give Correct
Password
in three attempts

Thanks guru I will come back to you after trying this snippet

-----Original Message-----
From: Raghupathy, Gurumoorthy
[mailto:Gurumoorthy.Raghupathy@nielsen.com]
Sent: Tuesday, June 05, 2007 4:29 PM
To: Struts Users Mailing List
Subject: RE: How To Lock User Account If he Failed to give Correct
Password
in three attempts

HttpSession session = request.getSession();

If ( session.getAttribute("LoginCount") == null ) {
	Session.setAttribute("LoginCount", new Integer(1)); } else {
	Integer loginCount = session.getAttribute("LoginCount");
	try { 
		Writecode to login;
	} catch (Loginexception e) {
		If (loginCount.intValue() >2 ) {
			Write code to block the user .... 
			return mapping.findForware("AccountLocked");
		} else {
			loginCount = new Integer(loginCount.intValue()
+1 );
			return mapping.findForware("Login");
		}
	}
}

Regards
Guru
-----Original Message-----
From: Srinivasula Reddy A , Bangalore [mailto:srinivasulaa@hcl.in]
Sent: 05 June 2007 11:45
To: Struts Users Mailing List
Subject: RE: How To Lock User Account If he Failed to give Correct
Password
in three attempts

Yaa I know but I need some sample exact steps

-----Original Message-----
From: Raghupathy, Gurumoorthy
[mailto:Gurumoorthy.Raghupathy@nielsen.com]
Sent: Tuesday, June 05, 2007 4:13 PM
To: Struts Users Mailing List
Subject: RE: How To Lock User Account If he Failed to give Correct
Password
in three attempts

Store the count in the session using appropriate name .... 
Once that is above the limit then write the code to lock it ... .


One suggestion though ..... 
All business logic code in single action....  That is not a good design
... 
Cant you make your business objects more layered ? 

Regards
Guru

-----Original Message-----
From: Srinivasula Reddy A , Bangalore [mailto:srinivasulaa@hcl.in]
Sent: 05 June 2007 10:17
To: Struts Users Mailing List
Subject: How To Lock User Account If he Failed to give Correct Password
in
three attempts


Hi Struts User Community,

 

                        Here I am sending my login action code (part
only) and My DAO Code. Now I have to lock the user if he failed to enter
correct user name and password in three attempts.

 

How can I implement this in struts?

 

Please help me with some sample code or rough idea?

 

 

 

String username = ((LoginForm) form).getUsername();

                                    String password = ((LoginForm)
form).getPassword();                                

                                                                        

                                    String newPassword =
com.dfs.common.helper.PasswordService.getInstance().encrypt(password);


                                                            

 

                                    AccessControlDAO accessDAO = new
AccessControlDAO();

                                    UserTo userDTO =
accessDAO.getUser(username, newPassword);

                                    

                                    if(userDTO==null){


                                                throw new
LoginFailedException("LoginFailedException");

                                    }

 

            

 

 

 

 

public UserTo getUser(String username, String password)throws
BaseAppException{

                        

                        DBConnection ora = DBConnection.getInstance();


                        Connection conn = ora.createConnection();


                        

                        PreparedStatement stmt = null;

                        ResultSet rs = null;

                        UserTo userDTO = null;

Query = "select * from SYSTEM_USER where SERVICE_NO=? and PASSWORD=?";


                        if (conn != null) {

                                    try{

                                                stmt =
conn.prepareStatement(Query);

                                                stmt.setString(1,
username);

                                                stmt.setString(2,
password);

                                                rs =
stmt.executeQuery();

                                                while(rs.next()){

                                                            userDTO =
new
UserTo();

 
userDTO.setServiceNo(rs.getString("SERVICE_NO"));

 
userDTO.setEmpName(rs.getString("EMP_NAME"));

                                                            }

 


                                    } catch (SQLException sqle) {

                                                throw new
BaseDBException("BaseDBException");

                                    } finally {


                                                try{

 
ora.closeConnection(conn);

 
stmt.close();

                                                            rs.close();

                                                }catch(SQLException e){

                                                            throw new
BaseDBException("BaseDBException");


                                                }

                                    }

                        }else{

                                    

                                    throw new
BaseDBException("BaseDBException");                                  

                        }

                        

                        return userDTO;

                        

            }

 

            

 

Regards,

Sreenivasula Reddy A.



DISCLAIMER:
------------------------------------------------------------------------
-----------------------------------------------

The contents of this e-mail and any attachment(s) are confidential and
intended for the named recipient(s) only.
It shall not attach any liability on the originator or HCL or its
affiliates. Any views or opinions presented in this email are solely
those
of the author and may not necessarily reflect the opinions of HCL or its
affiliates.
Any form of reproduction, dissemination, copying, disclosure,
modification,
distribution and / or publication of this message without the prior
written
consent of the author of this e-mail is strictly prohibited. If you have
received this email in error please delete it and notify the sender
immediately. Before opening any mail and attachments please check them
for
viruses and defect.

------------------------------------------------------------------------
-----------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Re: [OT] Mentors, Was: How To Lock User Account If he Failed to give Correct Password in three attempts

Posted by Ted Husted <hu...@apache.org>.
Personally, I've never thought that RTFM or PRTM by itself is a
sufficient response. Since all of our material is online, it's much
better to provide a link directly to a relevant page in the
documentation. IMHO, it's just as lazy to reply with "RTM" as it is to
post without reading the manual. :) Sometimes, I've found that, in
fact, the answer is not in the manual, or not easy to find. At which
point, I try to add the page and then link to it. (Remember, anyone
who files a CLA with the ASF is welcome to help with the
documentation.)

I would like to stress that we do not consider it acceptable to
criticize anyone who makes a good-faith post to this list. The ASF
motto is "Criticize the code, not the coder". I would consider it a
personal favor if we could avoid references to an individual or an
individual's employer. The Struts User List has always been welcome to
newcomers and to any question, no matter how basic or how naive, and I
would very much like to keep that tradition alive.

-Ted.

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org