Verify API auth token
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use crate::app_config::AppConfig;
|
||||
use crate::constants::{STATE_KEY, USER_SESSION_KEY};
|
||||
use crate::server::{HttpFailure, HttpResult};
|
||||
use crate::user::{APIClient, User, UserConfig, UserID};
|
||||
use crate::user::{APIClient, APIClientID, User, UserConfig, UserID};
|
||||
use crate::utils;
|
||||
use actix_session::Session;
|
||||
use actix_web::{web, HttpResponse};
|
||||
@@ -33,6 +33,7 @@ pub async fn static_file(path: web::Path<String>) -> HttpResult {
|
||||
#[template(path = "index.html")]
|
||||
struct HomeTemplate {
|
||||
name: String,
|
||||
user_id: UserID,
|
||||
matrix_token: String,
|
||||
clients: Vec<APIClient>,
|
||||
success_message: Option<String>,
|
||||
@@ -55,7 +56,7 @@ pub struct FormRequest {
|
||||
readonly_client: Option<String>,
|
||||
|
||||
/// Delete a specified client id
|
||||
delete_client_id: Option<uuid::Uuid>,
|
||||
delete_client_id: Option<APIClientID>,
|
||||
}
|
||||
|
||||
/// Main route
|
||||
@@ -82,7 +83,7 @@ pub async fn home(session: Session, form_req: Option<web::Form<FormRequest>>) ->
|
||||
let mut error_message = None;
|
||||
|
||||
// Retrieve user configuration
|
||||
let mut config = UserConfig::load(&user.id)
|
||||
let mut config = UserConfig::load(&user.id, true)
|
||||
.await
|
||||
.map_err(HttpFailure::FetchUserConfig)?;
|
||||
|
||||
@@ -137,6 +138,7 @@ pub async fn home(session: Session, form_req: Option<web::Form<FormRequest>>) ->
|
||||
.body(
|
||||
HomeTemplate {
|
||||
name: user.name,
|
||||
user_id: user.id,
|
||||
matrix_token: config.obfuscated_matrix_token(),
|
||||
clients: config.clients,
|
||||
success_message,
|
||||
|
Reference in New Issue
Block a user