mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 00:07:57 -05:00
Append username to URL when logging in or registering
This commit is contained in:
@@ -139,10 +139,15 @@ def make_map(global_conf={}, app_conf={}):
|
||||
mc('/resetpassword', controller='front',
|
||||
action='resetpassword')
|
||||
|
||||
mc('/post/:action/:url_user', controller='post',
|
||||
requirements=dict(action="login|reg"))
|
||||
mc('/post/:action', controller='post',
|
||||
requirements=dict(action="options|over18|unlogged_options|optout|optin|login|reg"))
|
||||
|
||||
mc('/api/:action/:url_user', controller='api',
|
||||
requirements=dict(action="login|register"))
|
||||
mc('/api/:action', controller='api')
|
||||
|
||||
mc('/d/:what', controller='api', action='bookmarklet')
|
||||
|
||||
mc('/captcha/:iden', controller='captcha', action='captchaimg')
|
||||
|
||||
@@ -17,6 +17,27 @@ function close_menus() {
|
||||
|
||||
function hover_open_menu(menu) { };
|
||||
|
||||
function update_user(form) {
|
||||
try {
|
||||
var user = $(form).find("input[name=user]").val();
|
||||
form.action += "/" + user;
|
||||
} catch (e) {
|
||||
// ignore
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function post_user(form, where) {
|
||||
var user = $(form).find("input[name=user]").val();
|
||||
|
||||
if (user == null) {
|
||||
return post_form (form, where);
|
||||
} else {
|
||||
return post_form (form, where + '/' + user);
|
||||
}
|
||||
}
|
||||
|
||||
function post_form(form, where, statusfunc, nametransformfunc, block) {
|
||||
try {
|
||||
if(statusfunc == null)
|
||||
@@ -526,13 +547,14 @@ function last_click(thing) {
|
||||
function login(elem) {
|
||||
if(cnameframe)
|
||||
return true;
|
||||
return post_form(this, "login");
|
||||
|
||||
return post_user(this, "login");
|
||||
};
|
||||
|
||||
function register(elem) {
|
||||
if(cnameframe)
|
||||
return true;
|
||||
return post_form(this, "register");
|
||||
return post_user(this, "register");
|
||||
};
|
||||
|
||||
/* The ready method */
|
||||
|
||||
@@ -46,7 +46,9 @@
|
||||
<form id="login_${op}" method="post"
|
||||
action="${add_sr('/post/' + op, nocname = True)}"
|
||||
%if not c.frameless_cname or c.authorized_cname:
|
||||
onsubmit="return post_form(this, '${"register" if register else "login"}');"
|
||||
onsubmit="return post_user(this, '${"register" if register else "login"}');"
|
||||
%else:
|
||||
onsubmit="return update_user(this);"
|
||||
%endif
|
||||
target="_top">
|
||||
%if c.cname:
|
||||
|
||||
@@ -31,7 +31,9 @@
|
||||
<form method="post"
|
||||
id="login_${op}" action="${add_sr('/post/login', nocname = True)}"
|
||||
%if not c.frameless_cname or c.authorized_cname:
|
||||
onsubmit="return post_form(this, 'login');"
|
||||
onsubmit="return post_user(this, 'login');"
|
||||
%else:
|
||||
onsubmit="return update_user(this);"
|
||||
%endif
|
||||
class="login-form-side">
|
||||
%if c.cname:
|
||||
|
||||
Reference in New Issue
Block a user