mirror of https://github.com/MISP/MISP
create default admin user automatically
parent
d51e7a002b
commit
38897d9af3
|
@ -238,7 +238,6 @@ CREATE TABLE IF NOT EXISTS `whitelist` (
|
|||
-- Default values for initial installation
|
||||
--
|
||||
|
||||
INSERT INTO `users` (`id`, `password`, `org`, `email`, `autoalert`, `authkey`, `invited_by`, `gpgkey`, `nids_sid`, `termsaccepted`, `newsread`, `role_id`, `change_pw`) VALUES(1, 'babc86e0869015b3f0b4d48ca48700d3a9d1b9d7', 'ADMIN', 'admin@admin.test', 0, 'vlf4o42bYSVVWLm28jLB85my4HBZWXTri8vGdySb', 1, '', 4000000, 0, '2012-03-13', '1', '1');
|
||||
INSERT INTO `regexp`
|
||||
(`regexp`, `replacement`)
|
||||
VALUES
|
||||
|
|
|
@ -338,8 +338,25 @@ class UsersController extends AppController {
|
|||
$this->Session->delete('Message.auth');
|
||||
}
|
||||
// don't display "invalid user" before first login attempt
|
||||
if($this->request->is('post')) $this->Session->setFlash(__('Invalid username or password, try again'));
|
||||
if($this->request->is('post')) {
|
||||
$this->Session->setFlash(__('Invalid username or password, try again'));
|
||||
}
|
||||
|
||||
// populate the DB with the first user if it's empty
|
||||
if ($this->User->find('count') == 0 ) {
|
||||
$admin = array('User' => array(
|
||||
'email' => 'admin@admin.test',
|
||||
'org' => 'ADMIN',
|
||||
'password' => 'admin',
|
||||
'confirm_password' => 'admin',
|
||||
'authkey' => $this->User->generateAuthKey(),
|
||||
'nids_sid' => 4000000,
|
||||
'date' => date('YYY-mm-dd'),
|
||||
'role_id' => 1
|
||||
));
|
||||
$this->User->validator()->remove('password'); // password is to simple, remove validation
|
||||
$this->User->save($admin);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -190,7 +190,7 @@ if (!empty($event['Attribute'])):?>
|
|||
echo nl2br(h($sigDisplay));
|
||||
}
|
||||
?></td>
|
||||
<td class="short <?php echo $extra; ?>">
|
||||
<td class="<?php echo $extra; ?>" style="max-width:100px;">
|
||||
<?php
|
||||
$first = 0;
|
||||
if (isset($relatedAttributes[$attribute['id']]) && (null != $relatedAttributes[$attribute['id']])) {
|
||||
|
|
Loading…
Reference in New Issue