1
0
Fork 0
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:
Jason Volk 2025-04-26 23:50:03 +00:00 committed by Jade Ellis
parent 21bbee8e3c
commit 667afedd24
No known key found for this signature in database
GPG key ID: 8705A2A3EBF77BD2
9 changed files with 78 additions and 125 deletions

View file

@ -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)?;