示例#1
0
文件: views.py 项目: rajur7/Plinth
def profile(request):
    """Provide the user's profile for download."""
    username = request.user.username
    domainname = config.get_domainname()

    if not config.get_domainname():
        domainname = config.get_hostname()

    profile_string = actions.superuser_run(
        'openvpn', ['get-profile', username, domainname])

    response = HttpResponse(profile_string,
                            content_type='application/x-openvpn-profile')
    response['Content-Disposition'] = \
        'attachment; filename={username}.ovpn'.format(username=username)

    return response
示例#2
0
 def get_initial(self):
     initial = super(State0View, self).get_initial()
     initial['hostname'] = config.get_hostname()
     return initial