Development
This commit is contained in:
parent
df4632ff41
commit
f81acce23a
2 changed files with 28 additions and 1 deletions
|
|
@ -1,6 +1,22 @@
|
|||
from pathlib import Path
|
||||
from flask import Blueprint
|
||||
from flask import Blueprint, redirect, flash
|
||||
from auth import require_level
|
||||
from config_utils import queued_msg, CONFIGS_DIR
|
||||
|
||||
_PAGE = Path(__file__).parent.name
|
||||
|
||||
bp = Blueprint(_PAGE, __name__)
|
||||
|
||||
RADIUS_SECRET_FILE = Path(CONFIGS_DIR) / '.radius-secret'
|
||||
|
||||
|
||||
@bp.route('/action/radius/regenerate', methods=['POST'])
|
||||
@require_level('administrator')
|
||||
def regenerate():
|
||||
try:
|
||||
RADIUS_SECRET_FILE.unlink(missing_ok=True)
|
||||
except OSError as ex:
|
||||
flash(f'Could not delete .radius-secret: {ex}', 'error')
|
||||
return redirect(f'/{_PAGE}')
|
||||
flash(queued_msg('core apply', action_label='Secret deleted - new secret will be generated on next apply'), 'success')
|
||||
return redirect(f'/{_PAGE}')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue