Added missing register endpoint to identity

In the upcomming web-vault and other clients they changed the register
endpoint from `/api/accounts/register` to `/identity/register`.

This PR adds the new endpoint to already be compatible with the new
clients.

Fixes #2889
This commit is contained in:
BlackDex
2022-11-14 17:22:37 +01:00
parent 7a7673103f
commit 5bfc7cfde3
2 changed files with 13 additions and 4 deletions

View File

@@ -42,7 +42,7 @@ pub fn routes() -> Vec<rocket::Route> {
#[derive(Deserialize, Debug)]
#[allow(non_snake_case)]
struct RegisterData {
pub struct RegisterData {
Email: String,
Kdf: Option<i32>,
KdfIterations: Option<i32>,
@@ -82,7 +82,11 @@ fn enforce_password_hint_setting(password_hint: &Option<String>) -> EmptyResult
}
#[post("/accounts/register", data = "<data>")]
async fn register(data: JsonUpcase<RegisterData>, mut conn: DbConn) -> JsonResult {
async fn register(data: JsonUpcase<RegisterData>, conn: DbConn) -> JsonResult {
_register(data, conn).await
}
pub async fn _register(data: JsonUpcase<RegisterData>, mut conn: DbConn) -> JsonResult {
let data: RegisterData = data.into_inner().data;
let email = data.Email.to_lowercase();