mirror of https://github.com/zulip/zulip.git
web_public_view: Redirect to current narrow after login.
Add current hash as `next` URL to all login buttons a spectator can access while in app.
This commit is contained in:
parent
6331a314d4
commit
44efc8eb37
|
@ -515,6 +515,12 @@ export function initialize() {
|
||||||
|
|
||||||
// SIDEBARS
|
// SIDEBARS
|
||||||
|
|
||||||
|
$(".right-sidebar .login_button").on("click", (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
e.stopPropagation();
|
||||||
|
window.location.href = hash_util.build_login_link();
|
||||||
|
});
|
||||||
|
|
||||||
$("#userlist-toggle-button").on("click", (e) => {
|
$("#userlist-toggle-button").on("click", (e) => {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import * as internal_url from "../shared/js/internal_url";
|
import * as internal_url from "../shared/js/internal_url";
|
||||||
|
|
||||||
|
import {page_params} from "./page_params";
|
||||||
import * as people from "./people";
|
import * as people from "./people";
|
||||||
import * as stream_data from "./stream_data";
|
import * as stream_data from "./stream_data";
|
||||||
|
|
||||||
|
@ -272,3 +273,11 @@ export function is_spectator_compatible(hash) {
|
||||||
export function current_hash_as_next() {
|
export function current_hash_as_next() {
|
||||||
return `next=/${encodeURIComponent(window.location.hash)}`;
|
return `next=/${encodeURIComponent(window.location.hash)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function build_login_link() {
|
||||||
|
let login_link = "/login/?" + current_hash_as_next();
|
||||||
|
if (page_params.development_environment) {
|
||||||
|
login_link = "/devlogin/?" + current_hash_as_next();
|
||||||
|
}
|
||||||
|
return login_link;
|
||||||
|
}
|
||||||
|
|
|
@ -12,17 +12,11 @@ import render_login_to_access_modal from "../templates/login_to_access.hbs";
|
||||||
import * as browser_history from "./browser_history";
|
import * as browser_history from "./browser_history";
|
||||||
import * as hash_util from "./hash_util";
|
import * as hash_util from "./hash_util";
|
||||||
import * as overlays from "./overlays";
|
import * as overlays from "./overlays";
|
||||||
import {page_params} from "./page_params";
|
|
||||||
|
|
||||||
export function login_to_access() {
|
export function login_to_access() {
|
||||||
// Hide all overlays, popover and go back to the previous hash if the
|
// Hide all overlays, popover and go back to the previous hash if the
|
||||||
// hash has changed.
|
// hash has changed.
|
||||||
let login_link;
|
const login_link = hash_util.build_login_link();
|
||||||
if (page_params.development_environment) {
|
|
||||||
login_link = "/devlogin/?" + hash_util.current_hash_as_next();
|
|
||||||
} else {
|
|
||||||
login_link = "/login/?" + hash_util.current_hash_as_next();
|
|
||||||
}
|
|
||||||
|
|
||||||
$("body").append(
|
$("body").append(
|
||||||
render_login_to_access_modal({
|
render_login_to_access_modal({
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
<i class="fa fa-pencil-square-o"></i>
|
<i class="fa fa-pencil-square-o"></i>
|
||||||
<span>{{t 'Sign up' }}</span>
|
<span>{{t 'Sign up' }}</span>
|
||||||
</a>
|
</a>
|
||||||
<a href="/login" class="login_button color_animated_button">
|
<a class="login_button color_animated_button">
|
||||||
<i class="fa fa-sign-in"></i>
|
<i class="fa fa-sign-in"></i>
|
||||||
<span>{{t 'Log in' }}</span>
|
<span>{{t 'Log in' }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -89,6 +89,7 @@ EXEMPT_FILES = make_set(
|
||||||
"static/js/gear_menu.js",
|
"static/js/gear_menu.js",
|
||||||
"static/js/giphy.js",
|
"static/js/giphy.js",
|
||||||
"static/js/global.d.ts",
|
"static/js/global.d.ts",
|
||||||
|
"static/js/hash_util.js",
|
||||||
"static/js/hashchange.js",
|
"static/js/hashchange.js",
|
||||||
"static/js/hbs.d.ts",
|
"static/js/hbs.d.ts",
|
||||||
"static/js/hotkey.js",
|
"static/js/hotkey.js",
|
||||||
|
|
Loading…
Reference in New Issue