mirror of
https://github.com/mCaptcha/mCaptcha.git
synced 2026-02-13 02:55:39 +00:00
panel: overview
This commit is contained in:
@@ -37,7 +37,17 @@ impl IndexPage {
|
||||
}
|
||||
}
|
||||
|
||||
/// render a list of all sitekeys that a user has
|
||||
pub async fn list_sitekeys(data: web::Data<Data>, id: Identity) -> PageResult<impl Responder> {
|
||||
let res = get_list_sitekeys(&data, &id).await?;
|
||||
let body = IndexPage::new(res).render_once().unwrap();
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(body))
|
||||
}
|
||||
|
||||
/// utility function to get a list of all sitekeys that a user owns
|
||||
pub async fn get_list_sitekeys(data: &Data, id: &Identity) -> PageResult<SiteKeys> {
|
||||
let username = id.identity().unwrap();
|
||||
let res = sqlx::query_as!(
|
||||
MCaptchaDetails,
|
||||
@@ -47,14 +57,10 @@ pub async fn list_sitekeys(data: web::Data<Data>, id: Identity) -> PageResult<im
|
||||
)
|
||||
.fetch_all(&data.db)
|
||||
.await?;
|
||||
|
||||
let body = IndexPage::new(res).render_once().unwrap();
|
||||
Ok(HttpResponse::Ok()
|
||||
.content_type("text/html; charset=utf-8")
|
||||
.body(body))
|
||||
Ok(res)
|
||||
}
|
||||
|
||||
type SiteKeys = Vec<MCaptchaDetails>;
|
||||
pub type SiteKeys = Vec<MCaptchaDetails>;
|
||||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
|
||||
mod add;
|
||||
mod list;
|
||||
pub mod list;
|
||||
mod view;
|
||||
|
||||
pub mod routes {
|
||||
|
||||
Reference in New Issue
Block a user