diff --git a/umap/decorators.py b/umap/decorators.py index 005e4215..3ae667c5 100644 --- a/umap/decorators.py +++ b/umap/decorators.py @@ -60,17 +60,3 @@ def can_view_map(view_func): return view_func(request, *args, **kwargs) return wrapper - - -def jsonize_view(view_func): - @wraps(view_func) - def wrapper(request, *args, **kwargs): - response = view_func(request, *args, **kwargs) - response_kwargs = {} - if hasattr(response, "rendered_content"): - response_kwargs["html"] = response.rendered_content - if response.has_header("location"): - response_kwargs["redirect"] = response["location"] - return simple_json_response(**response_kwargs) - - return wrapper diff --git a/umap/static/umap/content.css b/umap/static/umap/content.css index ccdb250f..55fb1c98 100644 --- a/umap/static/umap/content.css +++ b/umap/static/umap/content.css @@ -37,6 +37,21 @@ input:-moz-placeholder, :-moz-placeholder { /* **************** */ /* Login icons */ /* **************** */ +body.login { + width: 320px; + margin: auto; + text-align: center; +} +body.login header { + display: flex; + justify-content: center; +} +.login-grid { + display: grid; + justify-content: space-between; + grid-gap: 5px; + grid-template-columns: repeat(auto-fill,92px); +} .login-grid li, .login-grid a { display: inline-block; diff --git a/umap/static/umap/js/modules/request.js b/umap/static/umap/js/modules/request.js index df8c4033..a77ab47b 100644 --- a/umap/static/umap/js/modules/request.js +++ b/umap/static/umap/js/modules/request.js @@ -73,12 +73,12 @@ export const ServerRequest = Request.extend({ headers['X-CSRFToken'] = token } const response = await Request.prototype.post.call(this, uri, headers, data) - return this._handle_json_response(response) + return await this._handle_json_response(response) }, get: async function (uri, headers) { const response = await Request.prototype.get.call(this, uri, headers) - return this._handle_json_response(response) + return await this._handle_json_response(response) }, _handle_json_response: async function (response) { @@ -105,10 +105,15 @@ export const ServerRequest = Request.extend({ this.ui.closePanel() } else if (data.error) { this.ui.alert({ content: data.error, level: 'error' }) - } else if (data.html) { - const ui_options = { data } - let listen_options - this.ui.openPanel(ui_options) + } else if (data.login_required) { + // TODO: stop flow and run request again when user + // is logged in + const win = window.open(data.login_required) + window.umap_proceed = () => { + console.log('logged in') + this.fire('login') + win.close() + } } }, diff --git a/umap/templates/registration/login.html b/umap/templates/registration/login.html index c9edc372..d88bffe6 100644 --- a/umap/templates/registration/login.html +++ b/umap/templates/registration/login.html @@ -1,37 +1,51 @@ -{% load i18n %} -{% if ENABLE_ACCOUNT_LOGIN %} -