Store password reset requests in database #610

Merged
rfwatson merged 4 commits from feature/persist_password_reset into master 5 years ago

@ -0,0 +1,9 @@
CREATE TABLE password_reset_requests (
id SERIAL PRIMARY KEY,
email VARCHAR NOT NULL,
token VARCHAR NOT NULL,
expiration_date TIMESTAMP NOT NULL
);
CREATE INDEX password_reset_requests_token ON password_reset_requests (token);
CREATE UNIQUE INDEX password_reset_requests_email ON password_reset_requests (email);

@ -0,0 +1,9 @@
CREATE TABLE password_reset_requests (
id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT,
email VARCHAR NOT NULL,
token VARCHAR NOT NULL,
expiration_date DATETIME NOT NULL
);
CREATE INDEX password_reset_requests_token ON password_reset_requests (token);
CREATE UNIQUE INDEX password_reset_requests_email ON password_reset_requests (email);

@ -65,6 +65,7 @@ pub enum Error {
Unauthorized,
Url,
Webfinger,
Expired,
}
impl From<bcrypt::BcryptError> for Error {
@ -367,6 +368,7 @@ pub mod medias;
pub mod mentions;
pub mod migrations;
pub mod notifications;
pub mod password_reset_requests;
pub mod plume_rocket;
pub mod post_authors;
pub mod posts;

@ -0,0 +1,164 @@
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
use chrono::{offset::Utc, Duration, NaiveDateTime};
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
use diesel::{ExpressionMethods, QueryDsl, RunQueryDsl};
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
use schema::password_reset_requests;
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
use {Connection, Error, Result};
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
#[derive(Clone, Identifiable, Queryable)]
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub struct PasswordResetRequest {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub id: i32,
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub email: String,
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub token: String,
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub expiration_date: NaiveDateTime,
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
#[derive(Insertable)]
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
#[table_name = "password_reset_requests"]
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub struct NewPasswordResetRequest {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub email: String,
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub token: String,
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub expiration_date: NaiveDateTime,
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
const TOKEN_VALIDITY_HOURS: i64 = 2;
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
impl PasswordResetRequest {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub fn insert(conn: &Connection, email: &str) -> Result<String> {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
// first, delete other password reset tokens associated with this email:
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let existing_requests =
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
password_reset_requests::table.filter(password_reset_requests::email.eq(email));
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
diesel::delete(existing_requests).execute(conn)?;
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
// now, generate a random token, set the expiry date,
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
// and insert it into the DB:
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let token = plume_common::utils::random_hex();
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let expiration_date = Utc::now()
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.naive_utc()
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.checked_add_signed(Duration::hours(TOKEN_VALIDITY_HOURS))
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.expect("could not calculate expiration date");
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let new_request = NewPasswordResetRequest {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
email: email.to_owned(),
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
token: token.clone(),
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
expiration_date,
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
};
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
diesel::insert_into(password_reset_requests::table)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.values(new_request)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.execute(conn)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.map_err(Error::from)?;
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
Ok(token)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub fn find_by_token(conn: &Connection, token: &str) -> Result<Self> {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let token = password_reset_requests::table
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.filter(password_reset_requests::token.eq(token))
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.first::<Self>(conn)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.map_err(Error::from)?;
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
if token.expiration_date < Utc::now().naive_utc() {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
return Err(Error::Expired);
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
Ok(token)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
pub fn find_and_delete_by_token(conn: &Connection, token: &str) -> Result<Self> {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let request = Self::find_by_token(&conn, &token)?;
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let filter =
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
password_reset_requests::table.filter(password_reset_requests::id.eq(request.id));
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
diesel::delete(filter).execute(conn)?;
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
Ok(request)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
#[cfg(test)]
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
mod tests {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
use super::*;
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
use diesel::Connection;
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
use tests::db;
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
use users::tests as user_tests;
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
#[test]
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
fn test_insert_and_find_password_reset_request() {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let conn = db();
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
conn.test_transaction::<_, (), _>(|| {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
user_tests::fill_database(&conn);
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let admin_email = "admin@example.com";
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let token = PasswordResetRequest::insert(&conn, admin_email)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.expect("couldn't insert new request");
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let request = PasswordResetRequest::find_by_token(&conn, &token)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.expect("couldn't retrieve request");
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
assert!(&token.len() > &32);
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
assert_eq!(&request.email, &admin_email);
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
Ok(())
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
});
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
#[test]
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
fn test_insert_delete_previous_password_reset_request() {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let conn = db();
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
conn.test_transaction::<_, (), _>(|| {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
user_tests::fill_database(&conn);
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let admin_email = "admin@example.com";
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
PasswordResetRequest::insert(&conn, &admin_email).expect("couldn't insert new request");
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
PasswordResetRequest::insert(&conn, &admin_email)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.expect("couldn't insert second request");
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let count = password_reset_requests::table.count().get_result(&*conn);
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
assert_eq!(Ok(1), count);
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
Ok(())
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
});
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
#[test]
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
fn test_find_password_reset_request_by_token_time() {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let conn = db();
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
conn.test_transaction::<_, (), _>(|| {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
user_tests::fill_database(&conn);
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let admin_email = "admin@example.com";
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let token = "abcdef";
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let now = Utc::now().naive_utc();
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
diesel::insert_into(password_reset_requests::table)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.values((
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
password_reset_requests::email.eq(&admin_email),
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
password_reset_requests::token.eq(&token),
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
password_reset_requests::expiration_date.eq(now),
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
))
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.execute(&*conn)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.expect("could not insert request");
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
match PasswordResetRequest::find_by_token(&conn, &token) {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
Err(Error::Expired) => (),
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
_ => panic!("Received unexpected result finding expired token"),
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
Ok(())
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
});
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
#[test]
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
fn test_find_and_delete_password_reset_request() {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let conn = db();
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
conn.test_transaction::<_, (), _>(|| {
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
user_tests::fill_database(&conn);
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let admin_email = "admin@example.com";
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let token = PasswordResetRequest::insert(&conn, &admin_email)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.expect("couldn't insert new request");
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
PasswordResetRequest::find_and_delete_by_token(&conn, &token)
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
.expect("couldn't find and delete request");
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
let count = password_reset_requests::table.count().get_result(&*conn);
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
assert_eq!(Ok(0), count);
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
Ok(())
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
});
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.
}
rfwatson commented 5 years ago (Migrated from github.com)
Review

It would be good to test that old password reset requests are ignored.

The simplest way I can think of would be to insert a record, and then update its creation_date with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.

It would be good to test that old password reset requests are [ignored](https://github.com/Plume-org/Plume/pull/610/files#diff-a248869f1983a92462c39c8b2ea8a66eR44). The simplest way I can think of would be to insert a record, and then update its `creation_date` with some raw SQL in the test. It feels pretty dirty though. Better ideas appreciated.
elegaanz commented 5 years ago (Migrated from github.com)
Review

thread::sleep(2 * 60 * 60 * 1000)

More seriously, I think you can pass tuples to diesel::insert_into(...).values(), like:

diesel::insert_into(password_reset_requests::table)
    .values((
        password_reset_requests::email.eq("foo@bar.org"),
        password_reset_requests::token.eq("aaaaaaaaa"),
        password_reset_requests::creation_date.eq(now - 3.hours()),
    ))

You can probably use it instead of PasswordResetRequest::insert in this test.

~~`thread::sleep(2 * 60 * 60 * 1000)`~~ More seriously, I think you can pass tuples to `diesel::insert_into(...).values()`, like: ```rust diesel::insert_into(password_reset_requests::table) .values(( password_reset_requests::email.eq("foo@bar.org"), password_reset_requests::token.eq("aaaaaaaaa"), password_reset_requests::creation_date.eq(now - 3.hours()), )) ``` You can probably use it instead of `PasswordResetRequest::insert` in this test.

@ -141,6 +141,15 @@ table! {
}
}
table! {
password_reset_requests (id) {
id -> Int4,
email -> Varchar,
token -> Varchar,
expiration_date -> Timestamp,
}
}
table! {
post_authors (id) {
id -> Int4,
@ -247,6 +256,7 @@ allow_tables_to_appear_in_same_query!(
medias,
mentions,
notifications,
password_reset_requests,
post_authors,
posts,
reshares,

@ -16,10 +16,10 @@ use validator::{Validate, ValidationError, ValidationErrors};
use mail::{build_mail, Mailer};
use plume_models::{
password_reset_requests::*,
users::{User, AUTH_COOKIE},
Error, PlumeRocket, CONFIG,
};
use routes::errors::ErrorPage;
use template_utils::{IntoContext, Ructe};
#[get("/login?<m>")]
@ -164,29 +164,17 @@ pub struct ResetForm {
pub fn password_reset_request(
mail: State<Arc<Mutex<Mailer>>>,
form: Form<ResetForm>,
requests: State<Arc<Mutex<Vec<ResetRequest>>>>,
rockets: PlumeRocket,
) -> Ructe {
let mut requests = requests.lock().unwrap();
// Remove outdated requests (more than 1 day old) to avoid the list to grow too much
requests.retain(|r| r.creation_date.elapsed().as_secs() < 24 * 60 * 60);
if User::find_by_email(&*rockets.conn, &form.email).is_ok() {
let token = PasswordResetRequest::insert(&*rockets.conn, &form.email)
.expect("password_reset_request::insert: error");
if User::find_by_email(&*rockets.conn, &form.email).is_ok()
&& !requests.iter().any(|x| x.mail == form.email.clone())
{
let id = plume_common::utils::random_hex();
requests.push(ResetRequest {
mail: form.email.clone(),
id: id.clone(),
creation_date: Instant::now(),
});
let link = format!("https://{}/password-reset/{}", CONFIG.base_url, id);
let url = format!("https://{}/password-reset/{}", CONFIG.base_url, token);
if let Some(message) = build_mail(
form.email.clone(),
i18n!(rockets.intl.catalog, "Password reset"),
i18n!(rockets.intl.catalog, "Here is the link to reset your password: {0}"; link),
i18n!(rockets.intl.catalog, "Here is the link to reset your password: {0}"; url),
) {
if let Some(ref mut mail) = *mail.lock().unwrap() {
mail.send(message.into())
@ -199,17 +187,10 @@ pub fn password_reset_request(
}
#[get("/password-reset/<token>")]
pub fn password_reset_form(
token: String,
requests: State<Arc<Mutex<Vec<ResetRequest>>>>,
rockets: PlumeRocket,
) -> Result<Ructe, ErrorPage> {
requests
.lock()
.unwrap()
.iter()
.find(|x| x.id == token.clone())
.ok_or(Error::NotFound)?;
pub fn password_reset_form(token: String, rockets: PlumeRocket) -> Result<Ructe, Ructe> {
PasswordResetRequest::find_by_token(&*rockets.conn, &token)
.map_err(|err| password_reset_error_response(err, &rockets))?;
Ok(render!(session::password_reset(
&rockets.to_context(),
&NewPasswordForm::default(),
@ -239,56 +220,33 @@ fn passwords_match(form: &NewPasswordForm) -> Result<(), ValidationError> {
#[post("/password-reset/<token>", data = "<form>")]
pub fn password_reset(
token: String,
requests: State<Arc<Mutex<Vec<ResetRequest>>>>,
form: Form<NewPasswordForm>,
rockets: PlumeRocket,
) -> Result<Flash<Redirect>, Ructe> {
form.validate()
rfwatson commented 5 years ago (Migrated from github.com)
Review

The logic to detect an expired token is private to the model now. Not sure how important having a specific error is. We could maybe return a custom Diesel error?

The logic to detect an expired token is private to the model now. Not sure how important having a specific error is. We could maybe return a custom Diesel error?
elegaanz commented 5 years ago (Migrated from github.com)
Review

Maybe, instead of mapping the error to to_validation, you could have a closure that returns the specific error that was previously returned?

Maybe, instead of mapping the error to `to_validation`, you could have a closure that returns the specific error that was previously returned?
rfwatson commented 5 years ago (Migrated from github.com)
Review

I ended up adding a new Expired error variant - it felt generic enough to be useful elsewhere in the app too. Happy to iterate on this more if it doesn't feel like a good approach though.

I ended up adding a new `Expired` error variant - it felt generic enough to be useful elsewhere in the app too. Happy to iterate on this more if it doesn't feel like a good approach though.
.and_then(|_| {
let mut requests = requests.lock().unwrap();
let req = requests
.iter()
.find(|x| x.id == token.clone())
.ok_or_else(|| to_validation(0))?
.clone();
if req.creation_date.elapsed().as_secs() < 60 * 60 * 2 {
// Reset link is only valid for 2 hours
requests.retain(|r| *r != req);
let user = User::find_by_email(&*rockets.conn, &req.mail).map_err(to_validation)?;
user.reset_password(&*rockets.conn, &form.password).ok();
Ok(Flash::success(
Redirect::to(uri!(
new: m = _
)),
i18n!(
rockets.intl.catalog,
"Your password was successfully reset."
),
))
} else {
Ok(Flash::error(
Redirect::to(uri!(
new: m = _
)),
i18n!(
rockets.intl.catalog,
"Sorry, but the link expired. Try again"
),
))
}
})
.map_err(|err| render!(session::password_reset(&rockets.to_context(), &form, err)))
.map_err(|err| render!(session::password_reset(&rockets.to_context(), &form, err)))?;
PasswordResetRequest::find_and_delete_by_token(&*rockets.conn, &token)
.and_then(|request| User::find_by_email(&*rockets.conn, &request.email))
.and_then(|user| user.reset_password(&*rockets.conn, &form.password))
.map_err(|err| password_reset_error_response(err, &rockets))?;
Ok(Flash::success(
Redirect::to(uri!(
new: m = _
)),
i18n!(
rockets.intl.catalog,
"Your password was successfully reset."
),
))
}
fn to_validation<T>(_: T) -> ValidationErrors {
let mut errors = ValidationErrors::new();
errors.add(
"",
ValidationError {
code: Cow::from("server_error"),
message: Some(Cow::from("An unknown error occured")),
params: std::collections::HashMap::new(),
},
);
errors
fn password_reset_error_response(err: Error, rockets: &PlumeRocket) -> Ructe {
match err {
Error::Expired => render!(session::password_reset_request_expired(
&rockets.to_context()
)),
_ => render!(errors::not_found(&rockets.to_context())),
}
}

@ -0,0 +1,9 @@
@use template_utils::*;
@use templates::base;
@(ctx: BaseContext)
@:base(ctx, i18n!(ctx.1, "Password reset"), {}, {}, {
<h1>@i18n!(ctx.1, "This token has expired")</h1>
<p>@i18n!(ctx.1, "Please start the process again by clicking") <a href="/password-reset">@i18n!(ctx.1, "here")</a>.</p>
})
Loading…
Cancel
Save