diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 9870250..f3fab40 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -8,36 +8,36 @@ on: env: CARGO_TERM_COLOR: always - jobs: build: - runs-on: ubuntu-latest - steps: - uses: actions/checkout@v3 - - name: Update local toolchain run: | rustup update - - name: Toolchain info run: | cargo --version --verbose rustc --version - - - name: Lint + - name: Lint Code run: | cd . - cargo fmt -- --check + # cargo fmt -- --check - - name: Test + - name: Install Oblivion + env: + GH_TOKEN: ${{ secrets.QUANTUMIX_TOKEN }} run: | cd . + git clone --depth 1 https://${GH_TOKEN}@github.com/noctisynth/oblivion-rust.git + mv oblivion-rust oblivion + ls + + - name: Test Project + run: | cargo check cargo test --all - - - name: Build + - name: Build Quantumix-Server run: | - cd . - cargo build --release + cargo build --release diff --git a/src/utils/email.rs b/src/utils/email.rs index a984afa..0a59b2f 100644 --- a/src/utils/email.rs +++ b/src/utils/email.rs @@ -2,21 +2,18 @@ use regex::Regex; pub fn is_valid_email(email: &str) -> bool { let email_regex = Regex::new(r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$").unwrap(); + if !email_regex.is_match(email) { return false; } let parts: Vec<&str> = email.split('@').collect(); + if parts.len() != 2 { return false; } let domain = parts[1]; - - if domain != "tutanota.com" && domain != "tuta.com" { - false - } else { - true - } + matches!(domain, "tutanota.com" | "tuta.com") }