Macroize various remaining Error constructions.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
@@ -1,11 +1,8 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use axum::extract::State;
|
||||
use ruma::{
|
||||
api::client::{account, error::ErrorKind},
|
||||
authentication::TokenType,
|
||||
};
|
||||
use tuwunel_core::{Error, Result, utils};
|
||||
use ruma::{api::client::account, authentication::TokenType};
|
||||
use tuwunel_core::{Err, Result, utils};
|
||||
|
||||
use super::TOKEN_LENGTH;
|
||||
use crate::Ruma;
|
||||
@@ -22,14 +19,12 @@ pub(crate) async fn create_openid_token_route(
|
||||
let sender_user = body.sender_user();
|
||||
|
||||
if sender_user != body.user_id {
|
||||
return Err(Error::BadRequest(
|
||||
ErrorKind::InvalidParam,
|
||||
return Err!(Request(InvalidParam(
|
||||
"Not allowed to request OpenID tokens on behalf of other users",
|
||||
));
|
||||
)));
|
||||
}
|
||||
|
||||
let access_token = utils::random_string(TOKEN_LENGTH);
|
||||
|
||||
let expires_in = services
|
||||
.users
|
||||
.create_openid_token(&body.user_id, &access_token)?;
|
||||
|
||||
Reference in New Issue
Block a user