Completed
Push — master ( bb8c97...03c924 )
by Vojta
01:50
created
lang/cs/lang.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,28 +1,28 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'plugin' => [
5
-        'name' => 'Rychlé přihlášení',
6
-        'description' => 'Přihlášení pouze pomocí hesla'
7
-    ],
8
-    'logincomponent' => [
9
-        'name' => 'Rychlé přihlášení',
10
-        'description' => 'Formulář rychlého přihlášení',
11
-        'redirect' => [
12
-            'title' => 'Přesměrovat na',
13
-            'description' => 'Název stránky pro přesměrování po úpravě údajů, přihlášení nebo registraci.'
14
-        ],
15
-        'visible' => [
16
-            'title' => 'Viditelné heslo',
17
-            'description' => 'Název stránky pro přesměrování po úpravě údajů, přihlášení nebo registraci.'
18
-        ],
19
-        'button' => [
20
-            'title' => 'Text tlačítka',
21
-            'description' => 'Text zobrazený na přihlašovacím tlačítku.'
22
-        ]
23
-    ],
24
-    'form' => [
25
-	    'wrong_code' => 'Špatně zadaný kód!',
26
-	    'required' => 'Je nutné zadat vstupní kód.'
27
-    ],
4
+	'plugin' => [
5
+		'name' => 'Rychlé přihlášení',
6
+		'description' => 'Přihlášení pouze pomocí hesla'
7
+	],
8
+	'logincomponent' => [
9
+		'name' => 'Rychlé přihlášení',
10
+		'description' => 'Formulář rychlého přihlášení',
11
+		'redirect' => [
12
+			'title' => 'Přesměrovat na',
13
+			'description' => 'Název stránky pro přesměrování po úpravě údajů, přihlášení nebo registraci.'
14
+		],
15
+		'visible' => [
16
+			'title' => 'Viditelné heslo',
17
+			'description' => 'Název stránky pro přesměrování po úpravě údajů, přihlášení nebo registraci.'
18
+		],
19
+		'button' => [
20
+			'title' => 'Text tlačítka',
21
+			'description' => 'Text zobrazený na přihlašovacím tlačítku.'
22
+		]
23
+	],
24
+	'form' => [
25
+		'wrong_code' => 'Špatně zadaný kód!',
26
+		'required' => 'Je nutné zadat vstupní kód.'
27
+	],
28 28
 ];
Please login to merge, or discard this patch.
lang/en/lang.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,28 +1,28 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'plugin' => [
5
-        'name' => 'Code login',
6
-        'description' => 'Code/password login form'
7
-    ],
8
-    'logincomponent' => [
9
-        'name' => 'Code login',
10
-        'description' => 'Insert code/password login form',
11
-        'redirect' => [
12
-            'title' => 'Redirect to',
13
-            'description' => 'Page name to redirect to after update, sign in or registration.',
14
-        ],
15
-        'visible' => [
16
-            'title' => 'Code/password visible',
17
-            'description' => 'When checked, inserted password will be visible (input type text used).'
18
-        ],
19
-        'button' => [
20
-            'title' => 'Button label',
21
-            'description' => 'String which will be shown at login button.'
22
-        ]
23
-    ],
24
-    'form' => [
25
-	    'wrong_code' => 'Wrong code!',
26
-	    'required' => 'The :attribute field is required.'
27
-    ],
4
+	'plugin' => [
5
+		'name' => 'Code login',
6
+		'description' => 'Code/password login form'
7
+	],
8
+	'logincomponent' => [
9
+		'name' => 'Code login',
10
+		'description' => 'Insert code/password login form',
11
+		'redirect' => [
12
+			'title' => 'Redirect to',
13
+			'description' => 'Page name to redirect to after update, sign in or registration.',
14
+		],
15
+		'visible' => [
16
+			'title' => 'Code/password visible',
17
+			'description' => 'When checked, inserted password will be visible (input type text used).'
18
+		],
19
+		'button' => [
20
+			'title' => 'Button label',
21
+			'description' => 'String which will be shown at login button.'
22
+		]
23
+	],
24
+	'form' => [
25
+		'wrong_code' => 'Wrong code!',
26
+		'required' => 'The :attribute field is required.'
27
+	],
28 28
 ];
Please login to merge, or discard this patch.
lang/ru/lang.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,27 +1,27 @@
 block discarded – undo
1 1
 <?php
2 2
 return [
3
-    'plugin' => [
4
-        'name' => 'Вход с помощью кода',
5
-        'description' => 'Форма входа через код/пароль'
6
-    ],
7
-    'logincomponent' => [
8
-        'name' => 'Вход с помощью кода',
9
-        'description' => 'Отображает форму входа через код/пароль на странице',
10
-        'redirect' => [
11
-            'title' => 'Перенаправить на',
12
-            'description' => 'Имя страницы на которую перенаправить после обновления, входа или регистрации.'
13
-        ],
14
-        'visible' => [
15
-            'title' => 'Отображать код/пароль',
16
-            'description' => 'Если отмечено, пароль будет виден (используется тип text для поля ввода).'
17
-        ],
18
-        'button' => [
19
-            'title' => 'Текст кнопки',
20
-            'description' => 'Текст, отображаемый на кнопке входа.'
21
-        ]
22
-    ],
23
-    'form' => [
24
-	    'wrong_code' => 'Неверный код!',
25
-	    'required' => 'Поле :attribute обязательно для заполнения.'
26
-    ],
3
+	'plugin' => [
4
+		'name' => 'Вход с помощью кода',
5
+		'description' => 'Форма входа через код/пароль'
6
+	],
7
+	'logincomponent' => [
8
+		'name' => 'Вход с помощью кода',
9
+		'description' => 'Отображает форму входа через код/пароль на странице',
10
+		'redirect' => [
11
+			'title' => 'Перенаправить на',
12
+			'description' => 'Имя страницы на которую перенаправить после обновления, входа или регистрации.'
13
+		],
14
+		'visible' => [
15
+			'title' => 'Отображать код/пароль',
16
+			'description' => 'Если отмечено, пароль будет виден (используется тип text для поля ввода).'
17
+		],
18
+		'button' => [
19
+			'title' => 'Текст кнопки',
20
+			'description' => 'Текст, отображаемый на кнопке входа.'
21
+		]
22
+	],
23
+	'form' => [
24
+		'wrong_code' => 'Неверный код!',
25
+		'required' => 'Поле :attribute обязательно для заполнения.'
26
+	],
27 27
 ];
Please login to merge, or discard this patch.
repositories/UserRepository.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@
 block discarded – undo
37 37
 
38 38
 				return $user;
39 39
 
40
-			} catch(AuthException $e) {
40
+			} catch (AuthException $e) {
41 41
 				$user = null;
42 42
 			}
43 43
 
Please login to merge, or discard this patch.
lang/de/lang.php 1 patch
Indentation   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -1,28 +1,28 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
 return [
4
-    'plugin' => [
5
-        'name' => 'Kennwort Schutz',
6
-        'description' => 'Kennwort Schutz Anmelde-Formular'
7
-    ],
8
-    'logincomponent' => [
9
-        'name' => 'Kennwort Schutz',
10
-        'description' => 'Kennwort Schutz Anmelde-Formular hinzufügen',
11
-        'redirect' => [
12
-            'title' => 'Umleiten nach',
13
-            'description' => 'Seitenname für die Umleitung nach dem Update, Anmeldung oder Registration.'                   
14
-        ],
15
-        'visible' => [
16
-            'title' => 'Kennwort sichtbar',
17
-            'description' => 'Wenn aktiviert, Kennwort sichtbar (Verwendet Eingabetyp Text)'
18
-        ],
19
-        'button' => [
20
-            'title' => 'Button Titel',
21
-            'description' => 'Anmelde Button Text.'
22
-        ]
23
-    ],
24
-    'form' => [
25
-	    'wrong_code' => 'Falsches Kennwort!',
26
-	    'required' => 'Das :attribute Feld ist notwendig.'
27
-    ],
4
+	'plugin' => [
5
+		'name' => 'Kennwort Schutz',
6
+		'description' => 'Kennwort Schutz Anmelde-Formular'
7
+	],
8
+	'logincomponent' => [
9
+		'name' => 'Kennwort Schutz',
10
+		'description' => 'Kennwort Schutz Anmelde-Formular hinzufügen',
11
+		'redirect' => [
12
+			'title' => 'Umleiten nach',
13
+			'description' => 'Seitenname für die Umleitung nach dem Update, Anmeldung oder Registration.'                   
14
+		],
15
+		'visible' => [
16
+			'title' => 'Kennwort sichtbar',
17
+			'description' => 'Wenn aktiviert, Kennwort sichtbar (Verwendet Eingabetyp Text)'
18
+		],
19
+		'button' => [
20
+			'title' => 'Button Titel',
21
+			'description' => 'Anmelde Button Text.'
22
+		]
23
+	],
24
+	'form' => [
25
+		'wrong_code' => 'Falsches Kennwort!',
26
+		'required' => 'Das :attribute Feld ist notwendig.'
27
+	],
28 28
 ];
Please login to merge, or discard this patch.
Plugin.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@
 block discarded – undo
10 10
     /**
11 11
      * @var array Plugin dependencies
12 12
      */
13
-    public $require = ['RainLab.User'];
13
+    public $require = [ 'RainLab.User' ];
14 14
 
15 15
     /**
16 16
      * Returns information about this plugin.
Please login to merge, or discard this patch.
Indentation   +25 added lines, -25 removed lines patch added patch discarded remove patch
@@ -7,31 +7,31 @@
 block discarded – undo
7 7
  */
8 8
 class Plugin extends PluginBase
9 9
 {
10
-    /**
11
-     * @var array Plugin dependencies
12
-     */
13
-    public $require = ['RainLab.User'];
10
+	/**
11
+	 * @var array Plugin dependencies
12
+	 */
13
+	public $require = ['RainLab.User'];
14 14
 
15
-    /**
16
-     * Returns information about this plugin.
17
-     *
18
-     * @return array
19
-     */
20
-    public function pluginDetails()
21
-    {
22
-        return [
23
-            'name'        => 'vojtasvoboda.codelogin::lang.plugin.name',
24
-            'description' => 'vojtasvoboda.codelogin::lang.plugin.description',
25
-            'author'      => 'Vojta Svoboda',
26
-            'icon'        => 'icon-user',
27
-            'homepage'    => 'https://github.com/vojtasvoboda/oc-codelogin-plugin',
28
-        ];
29
-    }
15
+	/**
16
+	 * Returns information about this plugin.
17
+	 *
18
+	 * @return array
19
+	 */
20
+	public function pluginDetails()
21
+	{
22
+		return [
23
+			'name'        => 'vojtasvoboda.codelogin::lang.plugin.name',
24
+			'description' => 'vojtasvoboda.codelogin::lang.plugin.description',
25
+			'author'      => 'Vojta Svoboda',
26
+			'icon'        => 'icon-user',
27
+			'homepage'    => 'https://github.com/vojtasvoboda/oc-codelogin-plugin',
28
+		];
29
+	}
30 30
 
31
-    public function registerComponents()
32
-    {
33
-        return [
34
-            'VojtaSvoboda\CodeLogin\Components\CodeLogin' => 'codeLogin',
35
-        ];
36
-    }
31
+	public function registerComponents()
32
+	{
33
+		return [
34
+			'VojtaSvoboda\CodeLogin\Components\CodeLogin' => 'codeLogin',
35
+		];
36
+	}
37 37
 }
Please login to merge, or discard this patch.
components/CodeLogin.php 2 patches
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -61,8 +61,8 @@  discard block
 block discarded – undo
61 61
      */
62 62
     public function onRun()
63 63
     {
64
-        $this->page['visible'] = $this->property('visible');
65
-        $this->page['button'] = $this->property('button');
64
+        $this->page[ 'visible' ] = $this->property('visible');
65
+        $this->page[ 'button' ] = $this->property('button');
66 66
     }
67 67
 
68 68
     /**
@@ -75,11 +75,11 @@  discard block
 block discarded – undo
75 75
          */
76 76
         $data = post();
77 77
 
78
-        $rules = [];
79
-        $rules['code'] = 'required|min:2';
78
+        $rules = [ ];
79
+        $rules[ 'code' ] = 'required|min:2';
80 80
 
81
-        $messages = [];
82
-        $messages['required'] = trans('vojtasvoboda.codelogin::lang.form.required');
81
+        $messages = [ ];
82
+        $messages[ 'required' ] = trans('vojtasvoboda.codelogin::lang.form.required');
83 83
 
84 84
         $validation = Validator::make($data, $rules, $messages);
85 85
         if ($validation->fails()) {
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
         $users = new UserRepository();
93 93
         $userToLog = $users->getUserByPassword(array_get($data, 'code'));
94 94
         if ($userToLog === null) {
95
-            $exception = new ValidationException([trans('vojtasvoboda.codelogin::lang.form.wrong_code')]);
95
+            $exception = new ValidationException([ trans('vojtasvoboda.codelogin::lang.form.wrong_code') ]);
96 96
             throw $exception;
97 97
         }
98 98
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
          * Event just for backward compatibility. It's more then recommand use
110 110
          * standard rainlab.user.login event - see readme.
111 111
          */
112
-        Event::fire('vojtasvoboda.codelogin.afterlogin', [$user]);
112
+        Event::fire('vojtasvoboda.codelogin.afterlogin', [ $user ]);
113 113
 
114 114
         /*
115 115
          * Redirect to the intended page after successful sign in
Please login to merge, or discard this patch.
Indentation   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -16,123 +16,123 @@
 block discarded – undo
16 16
 
17 17
 class CodeLogin extends ComponentBase
18 18
 {
19
-    public function componentDetails()
20
-    {
21
-        return [
22
-            'name'        => 'vojtasvoboda.codelogin::lang.logincomponent.name',
23
-            'description' => 'vojtasvoboda.codelogin::lang.logincomponent.description'
24
-        ];
25
-    }
26
-
27
-    public function defineProperties()
28
-    {
29
-        return [
30
-            'redirect' => [
31
-                'title'       => 'vojtasvoboda.codelogin::lang.logincomponent.redirect.title',
32
-                'description' => 'vojtasvoboda.codelogin::lang.logincomponent.redirect.description',
33
-                'type'        => 'dropdown',
34
-                'default'     => ''
35
-            ],
36
-            'visible' => [
37
-                'title'       => 'vojtasvoboda.codelogin::lang.logincomponent.visible.title',
38
-                'description' => 'vojtasvoboda.codelogin::lang.logincomponent.visible.description',
39
-                'type'        => 'checkbox',
40
-                'default'     => false
41
-            ],
42
-            'button' => [
43
-                'title'       => 'vojtasvoboda.codelogin::lang.logincomponent.button.title',
44
-                'description' => 'vojtasvoboda.codelogin::lang.logincomponent.button.description',
45
-                'type'        => 'string',
46
-                'default'     => 'enter'
47
-            ]
48
-        ];
49
-    }
50
-
51
-    public function getRedirectOptions()
52
-    {
53
-        $default = [
54
-            '' => '- none -'
55
-        ];
56
-        $pages = Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
57
-
58
-        return $default + $pages;
59
-    }
60
-
61
-    /**
62
-     * Executed when this component is bound to a page or layout.
63
-     */
64
-    public function onRun()
65
-    {
66
-        $this->page['visible'] = $this->property('visible');
67
-        $this->page['button'] = $this->property('button');
68
-    }
69
-
70
-    /**
71
-     * Sign in the user
72
-     */
73
-    public function onCodesignin()
74
-    {
75
-        try {
76
-            return $this->doSignin();
77
-
78
-        } catch (Exception $ex) {
79
-            if (Request::ajax()) {
80
-                throw $ex;
81
-            }
82
-            Flash::error($ex->getMessage());
83
-        }
84
-    }
85
-
86
-    private function doSignin()
87
-    {
88
-        /*
19
+	public function componentDetails()
20
+	{
21
+		return [
22
+			'name'        => 'vojtasvoboda.codelogin::lang.logincomponent.name',
23
+			'description' => 'vojtasvoboda.codelogin::lang.logincomponent.description'
24
+		];
25
+	}
26
+
27
+	public function defineProperties()
28
+	{
29
+		return [
30
+			'redirect' => [
31
+				'title'       => 'vojtasvoboda.codelogin::lang.logincomponent.redirect.title',
32
+				'description' => 'vojtasvoboda.codelogin::lang.logincomponent.redirect.description',
33
+				'type'        => 'dropdown',
34
+				'default'     => ''
35
+			],
36
+			'visible' => [
37
+				'title'       => 'vojtasvoboda.codelogin::lang.logincomponent.visible.title',
38
+				'description' => 'vojtasvoboda.codelogin::lang.logincomponent.visible.description',
39
+				'type'        => 'checkbox',
40
+				'default'     => false
41
+			],
42
+			'button' => [
43
+				'title'       => 'vojtasvoboda.codelogin::lang.logincomponent.button.title',
44
+				'description' => 'vojtasvoboda.codelogin::lang.logincomponent.button.description',
45
+				'type'        => 'string',
46
+				'default'     => 'enter'
47
+			]
48
+		];
49
+	}
50
+
51
+	public function getRedirectOptions()
52
+	{
53
+		$default = [
54
+			'' => '- none -'
55
+		];
56
+		$pages = Page::sortBy('baseFileName')->lists('baseFileName', 'baseFileName');
57
+
58
+		return $default + $pages;
59
+	}
60
+
61
+	/**
62
+	 * Executed when this component is bound to a page or layout.
63
+	 */
64
+	public function onRun()
65
+	{
66
+		$this->page['visible'] = $this->property('visible');
67
+		$this->page['button'] = $this->property('button');
68
+	}
69
+
70
+	/**
71
+	 * Sign in the user
72
+	 */
73
+	public function onCodesignin()
74
+	{
75
+		try {
76
+			return $this->doSignin();
77
+
78
+		} catch (Exception $ex) {
79
+			if (Request::ajax()) {
80
+				throw $ex;
81
+			}
82
+			Flash::error($ex->getMessage());
83
+		}
84
+	}
85
+
86
+	private function doSignin()
87
+	{
88
+		/*
89 89
          * Validate input
90 90
          */
91
-        $data = post();
91
+		$data = post();
92 92
 
93
-        $rules = [];
94
-        $rules['code'] = 'required|min:2';
93
+		$rules = [];
94
+		$rules['code'] = 'required|min:2';
95 95
 
96
-        $messages = [];
97
-        $messages['required'] = trans('vojtasvoboda.codelogin::lang.form.required');
96
+		$messages = [];
97
+		$messages['required'] = trans('vojtasvoboda.codelogin::lang.form.required');
98 98
 
99
-        $validation = Validator::make($data, $rules, $messages);
100
-        if ($validation->fails()) {
101
-            throw new ValidationException($validation);
102
-        }
99
+		$validation = Validator::make($data, $rules, $messages);
100
+		if ($validation->fails()) {
101
+			throw new ValidationException($validation);
102
+		}
103 103
 
104
-        /*
104
+		/*
105 105
          * Find user by password
106 106
          */
107
-        $users = new UserRepository();
108
-        $userToLog = $users->getUserByPassword(array_get($data, 'code'));
109
-        if ($userToLog === null) {
110
-            $exception = new ValidationException([trans('vojtasvoboda.codelogin::lang.form.wrong_code')]);
111
-            throw $exception;
112
-        }
113
-
114
-        /*
107
+		$users = new UserRepository();
108
+		$userToLog = $users->getUserByPassword(array_get($data, 'code'));
109
+		if ($userToLog === null) {
110
+			$exception = new ValidationException([trans('vojtasvoboda.codelogin::lang.form.wrong_code')]);
111
+			throw $exception;
112
+		}
113
+
114
+		/*
115 115
          * Authenticate user
116 116
          */
117
-        $remember = true;
118
-        $user = Auth::authenticate([
119
-            'login' => $userToLog->email,
120
-            'password' => array_get($data, 'code')
121
-        ], $remember);
117
+		$remember = true;
118
+		$user = Auth::authenticate([
119
+			'login' => $userToLog->email,
120
+			'password' => array_get($data, 'code')
121
+		], $remember);
122 122
 
123
-        /*
123
+		/*
124 124
          * Event just for backward compatibility. It's more then recommand use
125 125
          * standard rainlab.user.login event - see readme.
126 126
          */
127
-        Event::fire('vojtasvoboda.codelogin.afterlogin', [$user]);
127
+		Event::fire('vojtasvoboda.codelogin.afterlogin', [$user]);
128 128
 
129
-        /*
129
+		/*
130 130
          * Redirect to the intended page after successful sign in
131 131
          */
132
-        $redirectUrl = $this->pageUrl($this->property('redirect'));
132
+		$redirectUrl = $this->pageUrl($this->property('redirect'));
133 133
 
134
-        if ($redirectUrl = post('redirect', $redirectUrl)) {
135
-            return Redirect::intended($redirectUrl);
136
-        }
137
-    }
134
+		if ($redirectUrl = post('redirect', $redirectUrl)) {
135
+			return Redirect::intended($redirectUrl);
136
+		}
137
+	}
138 138
 }
Please login to merge, or discard this patch.