-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: implement put-users/me/email #30
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mail_verifications
とput_mail_verifications
を使い分けてくれると助かります
let jwt = state | ||
.save_email_varifications(&body.email) | ||
.await | ||
.map_err(|_| StatusCode::INTERNAL_SERVER_ERROR)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
put email のdatabaseがあるからそっち側に保存する関数を作った方が良い
src/handler/users.rs
Outdated
) -> anyhow::Result<StatusCode, StatusCode> { | ||
if !crate::utils::mail::is_valid_email(&body.email) { | ||
return Err(StatusCode::BAD_REQUEST); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
validかどうか確かめる関数作ったのなら
#[derive(Deserialize, Validate)]
pub struct EmailUpdate {
#[validate(custom(function = "is_valid_email"))]
email: String,
}
にして
body.validate().map_err(|_| StatusCode::BAD_REQUEST)?;
としてもいいかも
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
よく考えるとsend_emailでエラーがなければ問題ないため、削除しました
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BADREQUESTを返すところだけ
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
良さげ
close #12
post-/signup/requestとほぼ同じ機能