Add sign up

This commit is contained in:
eraden 2024-01-27 21:23:42 +01:00
parent 9805a96510
commit df64f13952
3 changed files with 4 additions and 5 deletions

View File

@ -89,7 +89,7 @@ async fn try_sign_in(
.await .await
{ {
Ok(None) => {} Ok(None) => {}
Ok(Some(user)) => return Err(JsonError::new("User with this email already exists")), Ok(Some(_user)) => return Err(JsonError::new("User with this email already exists")),
Err(e) => { Err(e) => {
tracing::error!("Failed to load user for sign-in: {e}"); tracing::error!("Failed to load user for sign-in: {e}");
return Ok(Error::DatabaseError.error_response()); return Ok(Error::DatabaseError.error_response());

View File

@ -78,7 +78,7 @@ async fn try_sign_in(
return Err(JsonError::new("Please provide a valid email address.")); return Err(JsonError::new("Please provide a valid email address."));
} }
let (user, was_created) = match Users::find() let (user, _was_created) = match Users::find()
.filter(entities::users::Column::Email.eq(&email)) .filter(entities::users::Column::Email.eq(&email))
.one(&mut *db) .one(&mut *db)
.await .await

View File

@ -1,7 +1,7 @@
use std::env::var as env_var; use std::env::var as env_var;
use super::{auth_http_response, AuthError, AuthResponseBody}; use super::{auth_http_response, AuthError};
use actix_jwt_session::{JwtTtl, RefreshTtl, JWT_HEADER_NAME, REFRESH_HEADER_NAME};
use actix_web::{ use actix_web::{
get, get,
web::{self, Data, ServiceConfig}, web::{self, Data, ServiceConfig},
@ -37,7 +37,6 @@ use tracing::{debug, error, warn};
use crate::{ use crate::{
http::OAuthError, http::OAuthError,
models::{Error, JsonError}, models::{Error, JsonError},
session::AppClaims,
}; };
macro_rules! oauth_envs { macro_rules! oauth_envs {