diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-01-20 15:46:44 +0100 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-01-20 15:46:44 +0100 |
commit | 8a30e06af2359917a671b389b13194f455965b03 (patch) | |
tree | 1a7e847da1a48a7d0ff2dc64a6b060d9ecd6315d /src/models | |
parent | 178a9f444b5250a5b76d3d1a98297da8572a05e5 (diff) | |
download | rocket-blog-8a30e06af2359917a671b389b13194f455965b03.tar.gz rocket-blog-8a30e06af2359917a671b389b13194f455965b03.tar.bz2 rocket-blog-8a30e06af2359917a671b389b13194f455965b03.zip |
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.
Diffstat (limited to 'src/models')
-rw-r--r-- | src/models/user.rs | 6 |
1 files changed, 6 insertions, 0 deletions
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<User> { + use schema::users::dsl::*; + users.filter(email.eq(user_email)) + .get_result::<User>(&*conn) + } + pub fn create(new_user: &NewUser, conn: utils::DbConn) -> QueryResult<User> { use ::schema::users::dsl::*; diesel::insert_into(users) |