Completed
Push — master ( fef8e0...18ee30 )
by Vojta
02:15
created
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   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -12,20 +12,20 @@
 block discarded – undo
12 12
 	 */
13 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
-        ];
28
-    }
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
+		];
28
+	}
29 29
 
30 30
 	public function registerComponents()
31 31
 	{
Please login to merge, or discard this patch.
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.
components/CodeLogin.php 2 patches
Indentation   +88 added lines, -88 removed lines patch added patch discarded remove patch
@@ -16,110 +16,110 @@
 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
-        /*
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
+		/*
76 76
          * Validate input
77 77
          */
78
-        $data = post();
78
+		$data = post();
79 79
 
80
-        $rules = [];
81
-        $rules['code'] = 'required|min:2';
80
+		$rules = [];
81
+		$rules['code'] = 'required|min:2';
82 82
 
83
-        $messages = [];
84
-        $messages['required'] = trans('vojtasvoboda.codelogin::lang.form.required');
83
+		$messages = [];
84
+		$messages['required'] = trans('vojtasvoboda.codelogin::lang.form.required');
85 85
 
86
-        $validation = Validator::make($data, $rules, $messages);
87
-        if ($validation->fails()) {
88
-            throw new ValidationException($validation);
89
-        }
86
+		$validation = Validator::make($data, $rules, $messages);
87
+		if ($validation->fails()) {
88
+			throw new ValidationException($validation);
89
+		}
90 90
 
91
-        /*
91
+		/*
92 92
          * Find user by password
93 93
          */
94
-        $users = new UserRepository();
95
-        $userToLog = $users->getUserByPassword(array_get($data, 'code'));
96
-        if ($userToLog === null) {
97
-            $exception = new ValidationException([trans('vojtasvoboda.codelogin::lang.form.wrong_code')]);
98
-            throw $exception;
99
-        }
100
-
101
-        /*
94
+		$users = new UserRepository();
95
+		$userToLog = $users->getUserByPassword(array_get($data, 'code'));
96
+		if ($userToLog === null) {
97
+			$exception = new ValidationException([trans('vojtasvoboda.codelogin::lang.form.wrong_code')]);
98
+			throw $exception;
99
+		}
100
+
101
+		/*
102 102
          * Authenticate user
103 103
          */
104
-        $remember = true;
105
-        $user = Auth::authenticate([
106
-            'login' => $userToLog->email,
107
-            'password' => array_get($data, 'code')
108
-        ], $remember);
104
+		$remember = true;
105
+		$user = Auth::authenticate([
106
+			'login' => $userToLog->email,
107
+			'password' => array_get($data, 'code')
108
+		], $remember);
109 109
 
110
-        /*
110
+		/*
111 111
          * After login event
112 112
          */
113
-        Event::fire('vojtasvoboda.codelogin.afterlogin', [$user]);
113
+		Event::fire('vojtasvoboda.codelogin.afterlogin', [$user]);
114 114
 
115
-        /*
115
+		/*
116 116
          * Redirect to the intended page after successful sign in
117 117
          */
118
-        $redirectUrl = $this->pageUrl($this->property('redirect'));
118
+		$redirectUrl = $this->pageUrl($this->property('redirect'));
119 119
 
120
-        if ($redirectUrl = post('redirect', $redirectUrl)) {
121
-            return Redirect::intended($redirectUrl);
122
-        }
123
-    }
120
+		if ($redirectUrl = post('redirect', $redirectUrl)) {
121
+			return Redirect::intended($redirectUrl);
122
+		}
123
+	}
124 124
 
125 125
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -63,8 +63,8 @@  discard block
 block discarded – undo
63 63
      */
64 64
     public function onRun()
65 65
     {
66
-        $this->page['visible'] = $this->property('visible');
67
-        $this->page['button'] = $this->property('button');
66
+        $this->page[ 'visible' ] = $this->property('visible');
67
+        $this->page[ 'button' ] = $this->property('button');
68 68
     }
69 69
 
70 70
     /**
@@ -77,11 +77,11 @@  discard block
 block discarded – undo
77 77
          */
78 78
         $data = post();
79 79
 
80
-        $rules = [];
81
-        $rules['code'] = 'required|min:2';
80
+        $rules = [ ];
81
+        $rules[ 'code' ] = 'required|min:2';
82 82
 
83
-        $messages = [];
84
-        $messages['required'] = trans('vojtasvoboda.codelogin::lang.form.required');
83
+        $messages = [ ];
84
+        $messages[ 'required' ] = trans('vojtasvoboda.codelogin::lang.form.required');
85 85
 
86 86
         $validation = Validator::make($data, $rules, $messages);
87 87
         if ($validation->fails()) {
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
         $users = new UserRepository();
95 95
         $userToLog = $users->getUserByPassword(array_get($data, 'code'));
96 96
         if ($userToLog === null) {
97
-            $exception = new ValidationException([trans('vojtasvoboda.codelogin::lang.form.wrong_code')]);
97
+            $exception = new ValidationException([ trans('vojtasvoboda.codelogin::lang.form.wrong_code') ]);
98 98
             throw $exception;
99 99
         }
100 100
 
@@ -110,7 +110,7 @@  discard block
 block discarded – undo
110 110
         /*
111 111
          * After login event
112 112
          */
113
-        Event::fire('vojtasvoboda.codelogin.afterlogin', [$user]);
113
+        Event::fire('vojtasvoboda.codelogin.afterlogin', [ $user ]);
114 114
 
115 115
         /*
116 116
          * Redirect to the intended page after successful sign in
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.