mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-08-19 13:25:36 -04:00
Move access key creation into a helper function.
This commit is contained in:
@@ -27,15 +27,7 @@ class Rest_Controller extends Controller {
|
||||
throw new Rest_Exception("Forbidden", 403);
|
||||
}
|
||||
|
||||
$key = ORM::factory("user_access_token")
|
||||
->where("user_id", "=", $user->id)
|
||||
->find();
|
||||
if (!$key->loaded()) {
|
||||
$key->user_id = $user->id;
|
||||
$key->access_key = md5($user->name . rand());
|
||||
$key->save();
|
||||
}
|
||||
|
||||
$key = rest::get_access_token($user->id);
|
||||
rest::reply($key->access_key);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user