<commit_before>=head1 LICENSE

Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=cut

package EnsEMBL::Users::Component::Account::Login;

### Component for User Login page
### @author hr5

use strict;

use base qw(EnsEMBL::Users::Component::Account);

sub caption {
  return sprintf 'Login to %s', shift->site_name;
}

sub content {
  my $self = shift;
  return $self->js_section({'subsections' => [ $self->login_form->render ]});
}

sub login_form {
  my ($self, $is_ajax)  = @_;
  my $object            = $self->object;
  my $hub               = $self->hub;
  my $form              = $self->new_form({'id' => 'login', 'action' => {qw(action User function Authenticate)}});
  my $then_param        = $is_ajax ? '' : $self->get_then_param;
  my $ex_email          = $is_ajax ? '' : $hub->param('email');

  $form->add_hidden({ 'name' => 'then',      'value' => $then_param       }) if $then_param;
  $form->add_hidden({ 'name' => 'modal_tab', 'value' => 'modal_user_data' });
  $form->add_field([
    {'type'  => 'Email',    'name'  => 'email',     'label' => 'Email',     'required' => 'yes', $ex_email ? ('value' => $ex_email) : ()},
    {'type'  => 'Password', 'name'  => 'password',  'label' => 'Password',  'required' => 'yes'},
    {'type'  => 'Submit',   'name'  => 'submit',    'value' => 'Log in',    'notes'    => sprintf('<p><a href="%s" class="modal_link">Lost password</a> | <a href="%s" class="modal_link">Register</a></p>',
      $hub->url({qw(action Password function Lost), $ex_email ? ('email' => $ex_email) : ()}),
      $hub->url({qw(action Register)})
    )}
  ]);
<commit_msg>no register for mobile site<commit_after>=head1 LICENSE

Copyright [1999-2014] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

=cut

package EnsEMBL::Users::Component::Account::Login;

### Component for User Login page
### @author hr5

use strict;

use base qw(EnsEMBL::Users::Component::Account);

sub caption {
  return sprintf 'Login to %s', shift->site_name;
}

sub content {
  my $self = shift;
  return $self->js_section({'subsections' => [ $self->login_form->render ]});
}

sub login_form {
  my ($self, $is_ajax)  = @_;
  my $object            = $self->object;
  my $hub               = $self->hub;
  my $form              = $self->new_form({'id' => 'login', 'action' => {qw(action User function Authenticate)}});
  my $then_param        = $is_ajax ? '' : $self->get_then_param;
  my $ex_email          = $is_ajax ? '' : $hub->param('email');
  my $register_link     = $hub->species_defs->ENSEMBL_SITETYPE eq 'Ensembl mobile' ? "" : sprintf (' | <a href="%s" class="modal_link">Register</a></p>', $hub->url({qw(action Register)}));

  $form->add_hidden({ 'name' => 'then',      'value' => $then_param       }) if $then_param;
  $form->add_hidden({ 'name' => 'modal_tab', 'value' => 'modal_user_data' });
  $form->add_field([
    {'type'  => 'Email',    'name'  => 'email',     'label' => 'Email',     'required' => 'yes', $ex_email ? ('value' => $ex_email) : ()},
    {'type'  => 'Password', 'name'  => 'password',  'label' => 'Password',  'required' => 'yes'},
    {'type'  => 'Submit',   'name'  => 'submit',    'value' => 'Log in',    'notes'    => sprintf('<p><a href="%s" class="modal_link">Lost password</a>'.$register_link,
      $hub->url({qw(action Password function Lost), $ex_email ? ('email' => $ex_email) : ()}),
    )}
  ]);

  $_->set_attribute('data-role', 'none') for @{$form->get_elements_by_tag_name('input')};

{'fraction_non_alphanumeric': 0.1760332385742401, 'fraction_numerical': 0.006122895254756178, 'mean_word_length': 3.814736842105263, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 89, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '976200', 'n_tokens_mistral': 1511, 'n_tokens_neox': 1470, 'n_words': 427}