瀏覽代碼

Add autofocus for the two forms

Visman 4 年之前
父節點
當前提交
7ffe8aa00e
共有 2 個文件被更改,包括 3 次插入2 次删除
  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
     {
         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']))
-            || empty($this->user->activate_string)
             || ! \hash_equals($this->user->activate_string, $args['key'])
         ) {
             return $this->c->Message->message('Bad request', false);
@@ -189,6 +188,7 @@ class Email extends Profile
                     'class'  => 'data-edit',
                     'fields' => [
                         'new_email' => [
+                            'autofocus' => true,
                             'type'      => 'text',
                             'maxlength' => '80',
                             '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',
                     'fields' => [
                         'new_pass' => [
+                            'autofocus' => true,
                             'type'      => 'password',
                             'caption'   => __('New pass'),
                             'required'  => true,