diff options
author | Harald Eilertsen <haraldei@anduin.net> | 2018-08-02 14:02:59 +0200 |
---|---|---|
committer | Harald Eilertsen <haraldei@anduin.net> | 2018-08-02 14:51:00 +0200 |
commit | 292a92d2fdffda556ffba452df75c0580c1bbfe8 (patch) | |
tree | b00bfe8eeb943cb8e04cf31f97ba4156fc09a0a2 /src/controllers/login_controller.rs | |
parent | 0cdfefe02d7ade0744adb1bd44796e48440ea52a (diff) | |
download | rocket-blog-292a92d2fdffda556ffba452df75c0580c1bbfe8.tar.gz rocket-blog-292a92d2fdffda556ffba452df75c0580c1bbfe8.tar.bz2 rocket-blog-292a92d2fdffda556ffba452df75c0580c1bbfe8.zip |
Add user::displayname() method.
Get's rid of another clippy warning, and makes the code nicer.
Diffstat (limited to 'src/controllers/login_controller.rs')
-rw-r--r-- | src/controllers/login_controller.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/controllers/login_controller.rs b/src/controllers/login_controller.rs index 8800c59..02c8ec2 100644 --- a/src/controllers/login_controller.rs +++ b/src/controllers/login_controller.rs @@ -35,10 +35,7 @@ pub fn create(login: Form<LoginForm>, conn: DbConn) -> Flash<Redirect> { if user.password == login.password { return Flash::success( Redirect::to("/"), - format!( - "{} logged in successfully", - user.realname.or(Some(user.username)).unwrap() - ), + format!("{} logged in successfully", user.displayname()), ); } } |