Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added Login to PlayersController

  • Loading branch information...
commit 7e93d6e4a7f0b1667c23defd62813295d3a81a86 1 parent fb82507
@ronnykarlsson ronnykarlsson authored
View
19 src/SamuraiServer/SamuraiServer/Areas/Api/Controllers/PlayersController.cs
@@ -33,5 +33,24 @@ public ActionResult CreatePlayer(string name)
return View(new { ok = true, player = result.Data });
}
+
+ [Api]
+ [HttpPost]
+ [OutputCache(NoStore = true, Duration = 0, VaryByParam = "*")]
+ public ActionResult Login(string name, string token)
+ {
+ var result = _prov.Login(name, token);
+
+ if (result.IsValid == false)
+ {
+ // Login didn't go through
+ return View(new { ok = false, message = result.Message });
+ }
+ else
+ {
+ // Login ok, send the player-object back
+ return View(new { ok = true, message = result.Message });
+ }
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.