mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-10-06 19:00:48 +00:00
Macroize various remaining Error constructions.
Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
parent
21bbee8e3c
commit
667afedd24
9 changed files with 78 additions and 125 deletions
|
@ -1,11 +1,8 @@
|
|||
use std::time::Duration;
|
||||
|
||||
use axum::extract::State;
|
||||
use conduwuit::{Error, Result, utils};
|
||||
use ruma::{
|
||||
api::client::{account, error::ErrorKind},
|
||||
authentication::TokenType,
|
||||
};
|
||||
use conduwuit::{Err, Result, utils};
|
||||
use ruma::{api::client::account, authentication::TokenType};
|
||||
|
||||
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)?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue