From 1d782a4e845d6e0449164281c6c917eb94e89c07 Mon Sep 17 00:00:00 2001 From: Finn Date: Wed, 26 Jul 2017 15:29:38 +0100 Subject: [PATCH] Added giving user info on login --- lib/Pear/LocalLoop/Controller/Api/Auth.pm | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/Pear/LocalLoop/Controller/Api/Auth.pm b/lib/Pear/LocalLoop/Controller/Api/Auth.pm index 3592cbb..5c35383 100644 --- a/lib/Pear/LocalLoop/Controller/Api/Auth.pm +++ b/lib/Pear/LocalLoop/Controller/Api/Auth.pm @@ -75,7 +75,7 @@ sub post_login { my $password = $validation->param('password'); my $user_result = $c->schema->resultset('User')->find({ email => $email }); - + if ( defined $user_result ) { if ( $user_result->check_password($password) ) { my $session_key = $user_result->generate_session; @@ -83,6 +83,9 @@ sub post_login { return $c->render( json => { success => Mojo::JSON->true, session_key => $session_key, + full_name => $user_result->('full_name'), + full_name => $user_result->('display_name'), + full_name => $user_result->('postcode'), }); } } @@ -109,7 +112,7 @@ sub post_logout { $c->render( json => { success => Mojo::JSON->true, message => 'Logged Out', - }); + }); } 1;