Monday, September 9, 2013

How to hard code username and password in Secure module Play 1.2.5

How to hard code username and password in Secure module Play 1.2.5

Below is the code found on
http://www.playframework.com/documentation/1.2.5/secure.
package controllers;
public class Security extends Secure.Security {
static boolean authenticate(String username, String password) {
User user = User.find("byEmail", username).first();
return user != null && user.password.equals(password);
}
}
I want to hardcode the username and password into the controller itself.
So that it accepts only those login credentials.
I'm not sure how to do it, but it must be something like this:
package controllers;
public class Security extends Secure.Security {
static boolean authenticate(String username, String password) {
if (username=="abc@abc.com" && password=="abc123")
return....
.......
}
}

No comments:

Post a Comment