From 8a30e06af2359917a671b389b13194f455965b03 Mon Sep 17 00:00:00 2001 From: Harald Eilertsen Date: Sat, 20 Jan 2018 15:46:44 +0100 Subject: Add simple unfinished login controller. It will not actually log you in yet, but will check email/password and report back if it is good or not. More tbd. --- src/models/user.rs | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/models') diff --git a/src/models/user.rs b/src/models/user.rs index c3f4f72..5b92f6d 100644 --- a/src/models/user.rs +++ b/src/models/user.rs @@ -29,6 +29,12 @@ impl User { .map(|ref v| v[0].clone()) } + pub fn by_email(user_email: &str, conn: utils::DbConn) -> QueryResult { + use schema::users::dsl::*; + users.filter(email.eq(user_email)) + .get_result::(&*conn) + } + pub fn create(new_user: &NewUser, conn: utils::DbConn) -> QueryResult { use ::schema::users::dsl::*; diesel::insert_into(users) -- cgit v1.2.3