J. Shirley wrote:
On Mon, Dec 29, 2008 at 8:26 AM, Giancarlo Corcuera
<[email protected]> wrote:
I didn't understand your answer. Can you be more specific please
First, please don't top post. Reply at the bottom.
Secondly, you are asking for help with some code that is not behaving
the way you want. I asked you to show the code that you are
attempting to get working. Please copy the relevant code into a list
message so we can help you. No Catalyst hackers are mind-readers,
however we do have code that redirects properly so if you show us your
code we can offer advice.
-J
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/
sorry for my previous post I have my email client to add the message at
the top of the message I'm posting my code again:
sub login :Chained('lang') :PathPart('sign_in') :Args(0) :Form {
my ($self, $c) = @_;
my $url_language = $c->stash->{'language'};
my $lang_id = $c->stash->{'language_id'};
my $form_data = load_tags($c,'fe_login_form', $lang_id);
$c->stash->{'page_title'} = $form_data->{'form_title'};
my $form = $self->formbuilder->new(
{
'source' => $c->config->{'home'}.'/root/forms/login/login.fb',
'title' => $form_data->{'form_title'},
'submit' => $form_data->{'sign_in'},
'header' => 0
} );
$form->field(
'name' => 'username',
'label' => $form_data->{'username'}
);
$form->field(
'name' => 'password',
'label' => $form_data->{'password'}
);
$form->field(
'name' => 'qr_submit',
'type' => 'hidden'
);
if ( $form->submitted && $form->validate ) {
my $qr_submit = $form->field('qr_submit') || 0;
if ( $c->login( $form->field('username'),
$form->field('password') ) ) {
$c->session->{'user_id'} = $c->user->user_id;
$c->session->{'is_client'} = $c->user->is_client;
if ( $c->user->is_client eq 'Y' ) {
$c->session->{'user_cty'} = $c->user->b_customer_id->
b_country_id->country_code;
$c->forward('set_currency_format',[$c->session->{'user_cty'}]);
$url_language = $c->user->b_customer_id->b_country_id
->language_iso;
}
else {
$c->session->{'user_cty'} = 'US';
$c->forward('set_currency_format', ['US']);
};
$c->forward('user_roles', [$c->user->user_id]);
$c->forward('lang_session',[]);
}
else {
if ( $qr_submit == 1 ) {
$c->flash->{'login_username'} = $form->field('username');
$c->flash->{'login_qr'} = 1;
$c->flash->{'login_error'} = $form_data->{'error_message'};
$c->session->{'rq'} = undef;
$c->res->redirect($c->uri_for("/$url_language/quotes/edit"));
$c->detach();
};
$c->flash->{'error'} = $form_data->{'error_message'};
$c->res->redirect($c->uri_for("/$url_language/sign_in"));
$c->detach();
};
if ( $qr_submit == 1 ) {
$c->session->{'rq'} = undef;
$c->res->redirect($c->uri_for("/$url_language/quotes/edit"));
$c->detach();
};
if ( $c->user->is_client eq 'N' ) {
$c->res->redirect($c->uri_for('/administrator'));
$c->detach();
}
else {
$c->session->{'rq'} = undef;
$c->res->redirect($c->uri_for("/$url_language"));
$c->detach();
};
};
$c->stash->{'path'} = $c->request->{'path'};
$c->stash->{'template'} = 'login.tt2';
};
sorry for the inconvenience.
Giancarlo
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/