change env file name
This commit is contained in:
parent
8f3c9c33cb
commit
7e541f13a1
|
@ -304,9 +304,9 @@ class WbConfDocumentView(DeviceView):
|
||||||
}
|
}
|
||||||
data['erase'] = False if wbtype == 'usodyrate' else True
|
data['erase'] = False if wbtype == 'usodyrate' else True
|
||||||
|
|
||||||
env = flask.render_template('documents/env', **data)
|
env = flask.render_template('documents/wbConfiguration.ini', **data)
|
||||||
output = make_response(env)
|
output = make_response(env)
|
||||||
output.headers['Content-Disposition'] = 'attachment; filename=.env'
|
output.headers['Content-Disposition'] = 'attachment; filename=Configuration.ini'
|
||||||
output.headers['Content-type'] = 'text/plain'
|
output.headers['Content-type'] = 'text/plain'
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ from teal.resource import Converters, Resource
|
||||||
from ereuse_devicehub.db import db
|
from ereuse_devicehub.db import db
|
||||||
from ereuse_devicehub.resources.user import schemas
|
from ereuse_devicehub.resources.user import schemas
|
||||||
from ereuse_devicehub.resources.user.models import User
|
from ereuse_devicehub.resources.user.models import User
|
||||||
from ereuse_devicehub.resources.user.views import UserView, login
|
from ereuse_devicehub.resources.user.views import UserView, login, logout
|
||||||
|
|
||||||
|
|
||||||
class UserDef(Resource):
|
class UserDef(Resource):
|
||||||
|
@ -23,6 +23,8 @@ class UserDef(Resource):
|
||||||
super().__init__(app, import_name, static_folder, static_url_path, template_folder,
|
super().__init__(app, import_name, static_folder, static_url_path, template_folder,
|
||||||
url_prefix, subdomain, url_defaults, root_path, cli_commands)
|
url_prefix, subdomain, url_defaults, root_path, cli_commands)
|
||||||
self.add_url_rule('/login/', view_func=login, methods={'POST'})
|
self.add_url_rule('/login/', view_func=login, methods={'POST'})
|
||||||
|
logout1 = app.auth.requires_auth(logout)
|
||||||
|
self.add_url_rule('/logout/', view_func=logout1, methods={'GET'})
|
||||||
|
|
||||||
@argument('email')
|
@argument('email')
|
||||||
@option('-i', '--inventory',
|
@option('-i', '--inventory',
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
from uuid import UUID
|
from uuid import UUID, uuid4
|
||||||
|
|
||||||
from flask import g, request
|
from flask import g, request
|
||||||
|
from flask.json import jsonify
|
||||||
from teal.resource import View
|
from teal.resource import View
|
||||||
|
|
||||||
|
from ereuse_devicehub.db import db
|
||||||
from ereuse_devicehub.resources.user.exceptions import WrongCredentials
|
from ereuse_devicehub.resources.user.exceptions import WrongCredentials
|
||||||
from ereuse_devicehub.resources.user.models import User
|
from ereuse_devicehub.resources.user.models import User
|
||||||
from ereuse_devicehub.resources.user.schemas import User as UserS
|
from ereuse_devicehub.resources.user.schemas import User as UserS
|
||||||
|
@ -24,3 +26,11 @@ def login():
|
||||||
return schema_with_token.jsonify(user)
|
return schema_with_token.jsonify(user)
|
||||||
else:
|
else:
|
||||||
raise WrongCredentials()
|
raise WrongCredentials()
|
||||||
|
|
||||||
|
|
||||||
|
def logout():
|
||||||
|
# We use custom schema as we only want to parse a subset of user
|
||||||
|
g.user.token = uuid4()
|
||||||
|
db.session.add(g.user)
|
||||||
|
db.session.commit()
|
||||||
|
return jsonify('Ok')
|
||||||
|
|
Reference in New Issue