api key revoking

This commit is contained in:
Michael 2017-05-17 20:26:45 -04:00
parent 0cccc1e7a0
commit 5967323465

View file

@ -168,6 +168,18 @@ public ActionResult Index(ApplicationUser model)
return View(model); return View(model);
} }
public ActionResult RevokeAPIKey(string id)
{
var db = new ApplicationDbContext();
var usr = db.Users.FirstOrDefault(x => x.UserName == User.Identity.Name);
var key = db.OAuthTokens.FirstOrDefault(x => x.Id == id);
if (usr == null || key == null)
return new HttpStatusCodeResult(404);
db.OAuthTokens.Remove(key);
db.SaveChanges();
return RedirectToAction("Index");
}
// //
// POST: /Manage/RemoveLogin // POST: /Manage/RemoveLogin
[HttpPost] [HttpPost]