mirror of
https://gitlab.com/comunic/comunicapiv3
synced 2024-11-26 07:19:22 +00:00
Update login method
This commit is contained in:
parent
becd54e8c6
commit
e5f6b9e93e
@ -66,8 +66,13 @@ pub fn create(r: &mut HttpRequestHandler) -> RequestResult {
|
|||||||
|
|
||||||
/// Sign in user
|
/// Sign in user
|
||||||
pub fn login_user(request: &mut HttpRequestHandler) -> RequestResult {
|
pub fn login_user(request: &mut HttpRequestHandler) -> RequestResult {
|
||||||
let email = request.post_email("userMail")?;
|
// TODO : remove fallbacks
|
||||||
let password = request.post_string_opt("userPassword", 3, true)?;
|
let email = request.post_string_with_fallback("mail", "userMail")?;
|
||||||
|
let password = request.post_string_with_fallback("password", "userPassword")?;
|
||||||
|
|
||||||
|
if !mailchecker::is_valid(&email) {
|
||||||
|
request.bad_request("Invalid email!".to_string())?;
|
||||||
|
}
|
||||||
|
|
||||||
// Authenticate user
|
// Authenticate user
|
||||||
let token = account_helper::login_user(
|
let token = account_helper::login_user(
|
||||||
|
Loading…
Reference in New Issue
Block a user