mirror of
https://github.com/lempamo/Project-Unite.git
synced 2025-01-22 11:21:47 -05:00
api key revoking
This commit is contained in:
parent
0cccc1e7a0
commit
5967323465
1 changed files with 12 additions and 0 deletions
|
@ -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]
|
||||||
|
|
Loading…
Reference in a new issue