pub fn login(login: LoginDTO, conn: &PgConnection) -> Option<LoginInfoDTO> {
        let unverified_user = users
            .filter(username.eq(&login.username_or_email))
            .or_filter(email.eq(&login.username_or_email))
            .get_result::<User>(conn)
            .unwrap();

        if !unverified_user.password_hash.is_empty()
            && verify(&login.password, &unverified_user.password_hash).unwrap() {
            Some(LoginInfoDTO {
                id: unverified_user.id,
                username: unverified_user.username,
            })
        } else {
            None
        }
    }
/// Attempts to login the user with the specified login information.
/// If successful, returns a LoginInfoDTO containing the information that will be encoded
/// into their login token.
/// If unsuccessful, returns None.
Attempts to login the user with the specified login information.
If successful, returns a LoginInfoDTO containing the information that will be encoded
into their login token.
If unsuccessful, returns None.
Attempts to login the user with the specified login information . If successful returns a LoginInfoDTO containing the information that will be encoded into their login token . If unsuccessful returns None .
pub fn login(login: LoginDTO, conn: &PgConnection) -> Option<LoginInfoDTO> {
        let unverified_user = users
            .filter(username.eq(&login.username_or_email))
            .or_filter(email.eq(&login.username_or_email))
            .get_result::<User>(conn)
            .unwrap();
        if !unverified_user.password_hash.is_empty()
            && verify(&login.password, &unverified_user.password_hash).unwrap() {
            Some(LoginInfoDTO {
                id: unverified_user.id,
                username: unverified_user.username,
            })
        } else {
            None
        }
    }
pub fn login ( login : LoginDTO , conn : & PgConnection ) -> Option < LoginInfoDTO > { let unverified_user = users . filter ( username . eq ( & login . username_or_email ) ) . or_filter ( email . eq ( & login . username_or_email ) ) . get_result :: < User > ( conn ) . unwrap ( ) ; if ! unverified_user . password_hash . is_empty ( ) && verify ( & login . password , & unverified_user . password_hash ) . unwrap ( ) { Some ( LoginInfoDTO { id : unverified_user . id , username : unverified_user . username , } ) } else { None } }
Attempts to login the user with the specified login information.
Attempts to login the user with the specified login information .
login
LoginDTO
conn
&PgConnection
login
LoginDTO
conn
&PgConnection