Browse Source

Add autofocus for the two forms

Visman 4 years ago
parent
commit
7ffe8aa00e
2 changed files with 3 additions and 2 deletions
  1. 2 2
      app/Models/Pages/Profile/Email.php
  2. 1 0
      app/Models/Pages/Profile/Pass.php

+ 2 - 2
app/Models/Pages/Profile/Email.php

@@ -25,9 +25,8 @@ class Email extends Profile
     public function setEmail(array $args, string $method): Page
     public function setEmail(array $args, string $method): Page
     {
     {
         if (
         if (
-            $this->user->id !== (int) $args['id']
+            $this->user->id !== $args['id']
             || ! \hash_equals($args['hash'], $this->c->Secury->hash($args['id'] . $args['email'] . $args['key']))
             || ! \hash_equals($args['hash'], $this->c->Secury->hash($args['id'] . $args['email'] . $args['key']))
-            || empty($this->user->activate_string)
             || ! \hash_equals($this->user->activate_string, $args['key'])
             || ! \hash_equals($this->user->activate_string, $args['key'])
         ) {
         ) {
             return $this->c->Message->message('Bad request', false);
             return $this->c->Message->message('Bad request', false);
@@ -189,6 +188,7 @@ class Email extends Profile
                     'class'  => 'data-edit',
                     'class'  => 'data-edit',
                     'fields' => [
                     'fields' => [
                         'new_email' => [
                         'new_email' => [
+                            'autofocus' => true,
                             'type'      => 'text',
                             'type'      => 'text',
                             'maxlength' => '80',
                             'maxlength' => '80',
                             'caption'   => __($this->rules->confirmEmail ? 'New or old email' : 'New email'),
                             'caption'   => __($this->rules->confirmEmail ? 'New or old email' : 'New email'),

+ 1 - 0
app/Models/Pages/Profile/Pass.php

@@ -103,6 +103,7 @@ class Pass extends Profile
                     'class'  => 'data-edit',
                     'class'  => 'data-edit',
                     'fields' => [
                     'fields' => [
                         'new_pass' => [
                         'new_pass' => [
+                            'autofocus' => true,
                             'type'      => 'password',
                             'type'      => 'password',
                             'caption'   => __('New pass'),
                             'caption'   => __('New pass'),
                             'required'  => true,
                             'required'  => true,