move token type to ID map from Travelynx.pm to Model/Users
This commit is contained in:
parent
59e9a24aa6
commit
8e94fcea5f
3 changed files with 13 additions and 12 deletions
|
@ -159,17 +159,6 @@ sub startup {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
$self->attr(
|
|
||||||
token_type => sub {
|
|
||||||
return {
|
|
||||||
status => 1,
|
|
||||||
history => 2,
|
|
||||||
travel => 3,
|
|
||||||
import => 4,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
);
|
|
||||||
|
|
||||||
$self->attr(
|
$self->attr(
|
||||||
account_public_mask => sub {
|
account_public_mask => sub {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -571,7 +571,7 @@ sub set_token {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
my $token = make_token();
|
my $token = make_token();
|
||||||
my $token_id = $self->app->token_type->{ $self->param('token') };
|
my $token_id = $self->users->get_token_id( $self->param('token') );
|
||||||
|
|
||||||
if ( not $token_id ) {
|
if ( not $token_id ) {
|
||||||
$self->redirect_to('account');
|
$self->redirect_to('account');
|
||||||
|
|
|
@ -19,6 +19,12 @@ my @sb_templates = (
|
||||||
[ 'bahn.expert/regional', 'https://bahn.expert/regional/{name}#{id}' ],
|
[ 'bahn.expert/regional', 'https://bahn.expert/regional/{name}#{id}' ],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
my %token_id = (
|
||||||
|
status => 1,
|
||||||
|
history => 2,
|
||||||
|
travel => 3,
|
||||||
|
import => 4,
|
||||||
|
);
|
||||||
my @token_types = (qw(status history travel import));
|
my @token_types = (qw(status history travel import));
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
|
@ -27,6 +33,12 @@ sub new {
|
||||||
return bless( \%opt, $class );
|
return bless( \%opt, $class );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub get_token_id {
|
||||||
|
my ( $self, $type ) = @_;
|
||||||
|
|
||||||
|
return $token_id{$type};
|
||||||
|
}
|
||||||
|
|
||||||
sub mark_seen {
|
sub mark_seen {
|
||||||
my ( $self, %opt ) = @_;
|
my ( $self, %opt ) = @_;
|
||||||
my $uid = $opt{uid};
|
my $uid = $opt{uid};
|
||||||
|
|
Loading…
Reference in a new issue