Blame view

framework/security/LoginAttempt.php 1.58 KB
0084d336   Administrator   Importers CRUD
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
  <?php
  /**
   * Record all login attempts through the {@link LoginForm} object.
   * This behaviour is disabled by default.
   *
   * Enable through {@link Security::$login_recording}.
   * 
   * Caution: Please make sure that enabling logging
   * complies with your privacy standards. We're logging
   * username and IP.
   * 
   * @package framework
   * @subpackage security
   *
   * @property string Email Email address used for login attempt
   * @property string Status Status of the login attempt, either 'Success' or 'Failure'
   * @property string IP IP address of user attempting to login
   *
   * @property int MemberID ID of the Member, only if Member with Email exists
   *
   * @method Member Member() Member object of the user trying to log in, only if Member with Email exists
   */
  class LoginAttempt extends DataObject {
  	
  	private static $db = array(
  		'Email' => 'Varchar(255)', 
  		'Status' => "Enum('Success,Failure')", 
  		'IP' => 'Varchar(255)', 
  	);
  	
  	private static $has_one = array(
  		'Member' => 'Member', // only linked if the member actually exists
  	);
  	
  	private static $has_many = array();
  	
  	private static $many_many = array();
  	
  	private static $belongs_many_many = array();
  	
  	/**
  	 *
  	 * @param boolean $includerelations a boolean value to indicate if the labels returned include relation fields
  	 * 
  	 */
  	public function fieldLabels($includerelations = true) {
  		$labels = parent::fieldLabels($includerelations);
  		$labels['Email'] = _t('LoginAttempt.Email', 'Email Address');
  		$labels['Status'] = _t('LoginAttempt.Status', 'Status');
  		$labels['IP'] = _t('LoginAttempt.IP', 'IP Address');
  		
  		return $labels;
  	}
  	
  }