Version: current

     1 <?php
     2 /**
     3  * Record all login attempts through the {@link LoginForm} object.
     4  * This behaviour is disabled by default.
     5  *
     6  * Enable through a setting in your _config.php:
     7  * <code>
     8  * Security::set_login_recording(true);
     9  * </code>
    10  *
    11  * Caution: Please make sure that enabling logging
    12  * complies with your privacy standards. We're logging
    13  * username and IP.
    14  *
    15  * @package sapphire
    16  * @subpackage security
    17  */
    18 class LoginAttempt extends DataObject {
    19
    20     static $db = array(
    21         'Email' => 'Varchar(255)',
    22         'Status' => "Enum('Success,Failure')",
    23         'IP' => 'Varchar(255)',
    24     );
    25
    26     static $has_one = array(
    27         'Member' => 'Member', // only linked if the member actually exists
    28     );
    29
    30     static $has_many = array();
    31
    32     static $many_many = array();
    33
    34     static $belongs_many_many = array();
    35
    36     /**
    37      *
    38      * @param boolean $includerelations a boolean value to indicate if the labels returned include relation fields
    39      *
    40      */
    41     function fieldLabels($includerelations = true) {
    42         $labels = parent::fieldLabels($includerelations);
    43         $labels['Email'] = _t('LoginAttempt.Email', 'Email Address');
    44         $labels['Status'] = _t('LoginAttempt.Status', 'Status');
    45         $labels['IP'] = _t('LoginAttempt.IP', 'IP Address');
    46
    47         return $labels;
    48     }
    49
    50 }
    51 ?>

[Raise a SilverStripe Framework issue/bug](https://github.com/silverstripe/silverstripe-framework/issues/new)
- [Raise a SilverStripe CMS issue/bug](https://github.com/silverstripe/silverstripe-cms/issues/new)
- Please use the Silverstripe Forums to ask development related questions. -