Skip to content

Instantly share code, notes, and snippets.

View reyjexter's full-sized avatar

Rey Bumalay reyjexter

View GitHub Profile
/**
* Count records
*/
def count(query: BSONDocument) = {
val db = collection.db
val futureCount = db.command(Count(collection.name, Some(query)))
futureCount.map { totalCount =>
totalCount
}
futureUser.flatMap { user =>
Logger.debug("Login success")
User.updateLastLogin(user.get)
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role))
}
futureUser.flatMap { user =>
Logger.debug("Login success")
User.updateLastLogin(user.get)
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role))
}
futureUser.flatMap[SimpleResult] { user =>
Logger.debug("Login success")
User.updateLastLogin(user.get)
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role))
}
futureUser.flatMap[SimpleResult] { user =>
Logger.debug("Login success")
User.updateLastLogin(user.get)
Future(Redirect(admin.routes.Dashboard.index).withSession(Security.username -> user.get.username, "role" -> user.get.role))
}
def submitLogin = Action.async { implicit request =>
val futureForm = scala.concurrent.Future { loginForm.bindFromRequest }
futureForm.map(form => {
form.fold(
formWithErrors => BadRequest(html.auth.login(formWithErrors)),
resultForm => {
resultForm match {
case (username, password) => {
val futureUser = User.findByUsername(username)
def submitLogin = Action.async { implicit request =>
val futureForm = scala.concurrent.Future { loginForm.bindFromRequest }
futureForm.map(form => {
form.fold(
formWithErrors => BadRequest(html.auth.login(formWithErrors)),
resultForm => {
resultForm match {
case (username, password) => {
def submitLogin = Action { implicit request =>
val futureForm = scala.concurrent.Future { loginForm.bindFromRequest }
Async {
futureForm.map(form => {
form.fold(
formWithErrors => BadRequest(html.auth.login(formWithErrors)),
resultForm => {
resultForm match {
case (username, password) => {
/**
* Wait for new notification socket
*/
def waitForNotification = WebSocket.using[JsValue] { request =>
val iteratee = Promise[Iteratee[JsValue, Unit]]()
val enumerator = Concurrent.unicast[JsValue](onStart = { clientChannel =>
iteratee.success(Iteratee.foreach[JsValue] {
json => {
Logger.debug("== Enumerator called ==")
var tabGroup = Titanium.UI.createTabGroup({id:'tabGroup1'});
var win1 = Titanium.UI.createWindow({backgroundColor: '#ffffff'});
win1.addEventListener('android:back', function() {
alert("android:back event firing from win1");
});
var tab1 = Titanium.UI.createTab({
id:'tab1',
title: "Tab 1",
window:win1