mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-22 13:29:21 +00:00
Can sign out user
This commit is contained in:
parent
cf5ed7ddde
commit
c545838f3c
@ -39,6 +39,13 @@ pub fn auth_with_reset_token(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
r.set_response(AdminAuthSuccess::new(token))
|
||||
}
|
||||
|
||||
/// Sign out current admin
|
||||
pub fn sign_out(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
admin_access_token_helper::destroy(r.admin_id()?)?;
|
||||
|
||||
r.ok()
|
||||
}
|
||||
|
||||
/// Get current admin ID
|
||||
pub fn get_admin_id(r: &mut HttpRequestHandler) -> RequestResult {
|
||||
r.set_response(AdminIDAPI::new(r.admin_id()?))
|
||||
|
@ -349,6 +349,7 @@ pub fn get_routes() -> Vec<Route> {
|
||||
// Admin accounts controller
|
||||
Route::limited_admin_post_without_login("/admin/accounts/auth_options", Box::new(admin_account_controller::get_auth_options), LimitPolicy::FAILURE(5)),
|
||||
Route::limited_admin_post_without_login("/admin/accounts/auth_with_reset_token", Box::new(admin_account_controller::auth_with_reset_token), LimitPolicy::FAILURE(5)),
|
||||
Route::admin_post("/admin/accounts/sign_out", Box::new(admin_account_controller::get_admin_id)),
|
||||
Route::admin_post("/admin/accounts/id", Box::new(admin_account_controller::get_admin_id)),
|
||||
Route::admin_post("/admin/accounts/info", Box::new(admin_account_controller::get_admin_info)),
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user