on 06-28-2005 1:48 PM
hai
in my application i'm navigating from Login page to Home Page . in login page i have to check for particular user name and password let us say abc and abc. if the user enters wrong username and password it should redirect to login page. is there any snippet of code
Hi Friends,
I installed SAP NW2004s and i assign the username as "SAPUSER" as by default and password as "india123" but when i try to login then it gives me error as invalid name or password.
Please any 1 can suggest me how can i check which is right username and password for login or suggest me by default administration login.
Thanks,
Lalit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sravan
I suppose the two pages you have mentioned are two views in your WebDynpro component.
If so,the snippet of code that serves your purpose is given below. It is assumed that you have bound your input fields for username and password to corresponding value attributes in the view context(say userid and pswd). The code should be written in the onActionEvent of your Submit button.
String username=wdContext.currentContextElement.getUserid();
String password=wdContext.currentContextElement.getPswd();
if(username.equals("abc")&&password.equals("abc"))
{
wdThis.wdFirePlugToHome();
}
else
{
wdComponentAPI.getMessageManager().reportSuccess("Invalid Login");
}
Regards
Leena
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sravan,
Import this package in your login view
com.sap.tc.webdynpro.progmodel.controller.MessageManager;
And if your context attributes are Name and Password.And if you are navigating from LoginView to HomeView. Write the code given below inside your action event.
String login=wdContext.currentContextElement().getName();
String password=wdContext.currentContextElement().getPassword();
if(login!=null && login.equalsIgnoreCase("XXX") && password!=null && password.equalsIgnoreCase("YYY"))
{
wdThis.wdFirePlugToHomeView();
}
else
{
MessageManager msgMgr= (MessageManager) wdThis.wdGetAPI().getComponent().getMessageManager();
msgMgr.reportException("Login failure.Pls check login details",true);
}
Hope this will help you
Regards,
Rajeev
Hi
It would be advisable to check for Username and password using the way how Jens had suggested. You can configure the UME to create the Users. Here is a link that explains about User Management Engine.
http://help.sap.com/saphelp_nw04/helpdata/en/e5/618a3eacd49076e10000000a114084/frameset.htm
Using a UME would be more standard and easy in this case.
Hope that was helpful.
regards
ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sravan,
Just use WebAS default mechanism to protect your application.
Go to Web Dynpro -> Applications -> <your Application> -> edit
open tab "Application properties" and set "sap.authentication" to "true"
If you want to change this login page it is a little bit more complicated but possible.
regards
Jens
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.