Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge some of these changes #72

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions model/serveraccount.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,11 @@ public function &__get($field) {
public function update() {
global $config;
// Make it impossible to set default accounts to inactive
if(is_array($config['defaults']['account_groups'])) {
if(array_key_exists($this->data['name'], $config['defaults']['account_groups'])) {
$this->data['active'] = true;
if(isset($config['defaults']['account_groups'])){ # Fix null issue
if(is_array($config['defaults']['account_groups'])) {
if(array_key_exists($this->data['name'], $config['defaults']['account_groups'])) {
$this->data['active'] = true;
}
}
}
$changes = parent::update();
Expand Down
1 change: 1 addition & 0 deletions pagesection.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public function __construct($template) {
$this->data->menu_items['/tools'] = 'Tools';
}
$this->data->menu_items['/help'] = 'Help';
$this->data->menu_items['/logout'] = 'Logout';
$this->data->relative_request_url = $relative_request_url;
$this->data->active_user = $active_user;
$this->data->web_config = $config['web'];
Expand Down
1 change: 1 addition & 0 deletions routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
'/users/{username}/pubkeys.{format}' => 'user_pubkeys',
'/users/{username}/pubkeys/{key}' => 'pubkey',
'/users/{username}/pubkeys/{key}.{format}' => 'pubkey',
'/logout' => 'logout'
);

$public_routes = array(
Expand Down
5 changes: 4 additions & 1 deletion scripts/sync.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,10 @@ function sync_server($id, $only_username = null, $preview = false) {
if(count($keys) > 0) {
if($user->active) {
foreach($keys as $key) {
$keyfile .= $prefix.$key->export()."\n";
if (!$key->list_destination_rules()){
}else{
$keyfile .= $prefix.$key->export()."\n";
}
}
} else {
$keyfile .= "# Inactive account\n";
Expand Down
2 changes: 1 addition & 1 deletion templates/pubkey.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
}
?>
</h1>
<?php if($this->get('user_is_owner') || $this->get('admin')) { ?>
<?php if($this->get('admin')) { ?>
<ul class="nav nav-tabs">
<li><a href="#info" data-toggle="tab">Information</a></li>
<li><a href="#sig" data-toggle="tab">Key signing</a></li>
Expand Down
6 changes: 6 additions & 0 deletions views/logout.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<script>
var currentURL = window.location.href;
var domain = currentURL.replace(/^https?:\/\/(?:www\.)?([^:/?]+).*/, "$1");
var redirectURL = "http://log:out@" + domain;
window.location.href = redirectURL;
</script>