use of models.User in project play-cookbook by spinscale.
the class CsvTest method saveEntityWithLinkToAnother.
@Test
public void saveEntityWithLinkToAnother() throws Exception {
User u = new User();
u.name = "alex";
u.currentCar = c;
u.save();
String data = FileUtils.readFileToString(new File("/tmp/User.csv"));
String expected = "\"1\"\t\"alex\"\t\"#Car#1\"\n";
assertEquals(expected, data);
}
use of models.User in project play-cookbook by spinscale.
the class DigestRequest method isAuthorized.
public boolean isAuthorized() {
User user = User.find("byName", params.get("username")).first();
if (user == null) {
throw new UnauthorizedDigest(params.get("realm"));
}
String digest = createDigest(user.apiPassword);
return digest.equals(params.get("response"));
}
use of models.User in project play-cookbook by spinscale.
the class AddUserOnStartJob method doJob.
public void doJob() {
if (User.count("byName", "alex") == 0) {
User user = new User();
user.name = "alex";
user.password = Crypto.passwordHash("foo");
user.apiPassword = "test";
user.save();
}
}
use of models.User in project play-cookbook by spinscale.
the class Application method quote.
public static void quote() {
String username = Cache.get("ticket:" + request.headers.get("x-authorization").value(), String.class);
User user = User.find("byName", username).first();
String quote = user.quote;
render(quote);
}
use of models.User in project play-cookbook by spinscale.
the class Application method login.
public static void login(String login, String password) {
User user = User.find("byLoginAndPassword", login, password).first();
notFoundIfNull(user);
session.put("login", user.login);
showTweets(user.login);
}
Aggregations