From 78795a3b4d247e24d524e63fb5e95d657262f18f Mon Sep 17 00:00:00 2001 From: yflory Date: Wed, 5 Feb 2020 14:54:23 +0100 Subject: [PATCH] Login or register in profile for anonymous users --- customize.dist/src/less2/include/corner.less | 4 +++- www/profile/inner.js | 23 ++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/customize.dist/src/less2/include/corner.less b/customize.dist/src/less2/include/corner.less index 6cf365c2e..feec62165 100644 --- a/customize.dist/src/less2/include/corner.less +++ b/customize.dist/src/less2/include/corner.less @@ -137,7 +137,9 @@ button { padding: 5px; color: @corner-white; - margin-left: 10px; + &:not(:first-child) { + margin-left: 10px; + } outline: none; text-transform: uppercase; border: 1px solid @corner-white; diff --git a/www/profile/inner.js b/www/profile/inner.js index 0f4a17746..773b21206 100644 --- a/www/profile/inner.js +++ b/www/profile/inner.js @@ -570,6 +570,29 @@ define([ return; } + if (!common.isLoggedIn()) { + var login = h('button.cp-corner-primary', Messages.login_login); + var register = h('button.cp-corner-primary', Messages.login_register); + var cancel = h('button.cp-corner-cancel', Messages.cancel); + var actions = h('div', [cancel, register, login]); + var modal = UI.cornerPopup(Messages.profile_login || "You need to log in to add this user to your contacts", actions, '', {alt: true}); // XXX + $(register).click(function () { + common.setLoginRedirect(function () { + common.gotoURL('/register/'); + }); + modal.delete(); + }); + $(login).click(function () { + common.setLoginRedirect(function () { + common.gotoURL('/login/'); + }); + modal.delete(); + }); + $(cancel).click(function () { + modal.delete(); + }); + } + var listmapConfig = { data: {}, common: common,