mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-16 11:54:44 -04:00
Add a button to the user profile page to let you reset your REST API
key. This is useful if you think it's been compromised in some way. Fixes ticket #1226.
This commit is contained in:
@@ -37,6 +37,22 @@ class Rest_Controller extends Controller {
|
||||
rest::reply(rest::access_key());
|
||||
}
|
||||
|
||||
public function reset_api_key_confirm() {
|
||||
$form = new Forge("rest/reset_api_key", "", "post", array("id" => "g-reset-api-key"));
|
||||
$group = $form->group("confirm_reset")->label(t("Confirm resetting your REST API key"));
|
||||
$group->submit("")->value(t("Reset"));
|
||||
$v = new View("reset_api_key_confirm.html");
|
||||
$v->form = $form;
|
||||
print $v;
|
||||
}
|
||||
|
||||
public function reset_api_key() {
|
||||
access::verify_csrf();
|
||||
rest::reset_access_key();
|
||||
message::success(t("Your REST API key has been reset."));
|
||||
json::reply(array("result" => "success"));
|
||||
}
|
||||
|
||||
public function __call($function, $args) {
|
||||
try {
|
||||
$input = Input::instance();
|
||||
|
||||
Reference in New Issue
Block a user