Welcome to mirror list, hosted at ThFree Co, Russian Federation.

Form.php « Login « plugins - github.com/matomo-org/matomo.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 44276f356ef2684b6f5b6e1530e992f58d975b67 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/**
 * Piwik - Open source web analytics
 * 
 * @link http://piwik.org
 * @license http://www.gnu.org/licenses/gpl-3.0.html Gpl v3 or later
 * @version $Id$
 * 
 * @package Piwik_Login
 */

require_once "modules/Form.php";

/**
 * 
 * @package Piwik_Login
 */
class Piwik_Login_Form extends Piwik_Form
{
	function __construct()
	{
		parent::__construct();
		// reset 
		$this->updateAttributes('id="loginform" name="loginform"');
	}
	
	function init()
	{
		$urlToGoAfter = Piwik_Url::getCurrentUrl();			
		
		// if the current url to redirect contains module=login we insteaed redirect to the referer url
		if(stripos($urlToGoAfter,'module=login') !== false)
		{
			$urlToGoAfter = Piwik_Url::getReferer();
		}
		
		$formElements = array(
			array('text', 'form_login', _('Login_login')),
			array('password', 'form_password', _('Login_password')),
			array('hidden', 'form_url', $urlToGoAfter),
		);
		$this->addElements( $formElements );
		
		$formRules = array(
			array('form_login', sprintf(_('General_Required'), 'login'), 'required'),
			array('form_password', sprintf(_('General_Required'), 'password'), 'required'),
		);
		$this->addRules( $formRules );	
		
		$this->addElement('submit', 'submit', _('Login_Go'));
	
	}
	
	
}