refactor user table and setup timestamp auto setting

This commit is contained in:
Tom Bloor 2017-04-21 20:52:14 +01:00
parent 6bfd516d76
commit d0cbb215d8
15 changed files with 74 additions and 380 deletions

View file

@ -78,7 +78,7 @@ sub post_login {
if ( defined $user_result ) {
if ( $user_result->check_password($password) ) {
my $session_key = $c->generate_session( $user_result->userid );
my $session_key = $c->generate_session( $user_result->id );
return $c->render( json => {
success => Mojo::JSON->true,

View file

@ -113,13 +113,12 @@ sub post_register{
})->update({ used => 1 });
$c->schema->resultset('User')->create({
customer => {
username => $validation->param('username'),
username => $validation->param('username'),
agerange_fk => $ageForeignKey,
postcode => $validation->param('postcode'),
postcode => $validation->param('postcode'),
},
email => $validation->param('email'),
hashedpassword => $validation->param('password'),
joindate => DateTime->now,
email => $validation->param('email'),
password => $validation->param('password'),
});
});
@ -134,14 +133,13 @@ sub post_register{
})->update({ used => 1 });
$c->schema->resultset('User')->create({
organisation => {
name => $validation->param('username'),
name => $validation->param('username'),
street_name => $validation->param('street_name'),
town => $validation->param('town'),
postcode => $validation->param('postcode'),
town => $validation->param('town'),
postcode => $validation->param('postcode'),
},
email => $validation->param('email'),
hashedpassword => $validation->param('password'),
joindate => DateTime->now,
email => $validation->param('email'),
password => $validation->param('password'),
});
});
}

View file

@ -9,7 +9,7 @@ use TryCatch;
sub post_user_history {
my $self = shift;
my $userId = $self->get_active_user_id();
my $userId = $self->stash->{api_user}->id;
my $json = $self->req->json;
if ( ! defined $json ) {
$self->app->log->debug('Path Error: file:' . __FILE__ . ', line: ' . __LINE__);