Permalink
Cannot retrieve contributors at this time
Fetching contributors…
| ## The contents of this file are subject to the Common Public Attribution | |
| ## License Version 1.0. (the "License"); you may not use this file except in | |
| ## compliance with the License. You may obtain a copy of the License at | |
| ## http://code.reddit.com/LICENSE. The License is based on the Mozilla Public | |
| ## License Version 1.1, but Sections 14 and 15 have been added to cover use of | |
| ## software over a computer network and provide for limited attribution for the | |
| ## Original Developer. In addition, Exhibit A has been modified to be consistent | |
| ## with Exhibit B. | |
| ## | |
| ## Software distributed under the License is distributed on an "AS IS" basis, | |
| ## WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for | |
| ## the specific language governing rights and limitations under the License. | |
| ## | |
| ## The Original Code is Reddit. | |
| ## | |
| ## The Original Developer is the Initial Developer. The Initial Developer of | |
| ## the Original Code is CondeNet, Inc. | |
| ## | |
| ## All portions of the code written by CondeNet are Copyright (c) 2006-2008 | |
| ## CondeNet, Inc. All Rights Reserved. | |
| ################################################################################ | |
| <%! | |
| from r2.lib.template_helpers import add_sr | |
| from r2.lib.strings import strings | |
| from r2.lib.utils import UrlParser | |
| import random | |
| %> | |
| <%namespace file="captcha.html" import="captchagen"/> | |
| <%namespace file="utils.html" import="error_field, plain_link, text_with_links, img_link"/> | |
| ## default content | |
| %if c.user_is_loggedin: | |
| <p class="error">${_("You are already logged in.")}</p> | |
| %else: | |
| ${login_panel(user_reg = thing.user_reg, user_login = thing.user_login, | |
| dest=thing.dest)} | |
| <script type="text/javascript"> | |
| new_captcha(); | |
| </script> | |
| %endif | |
| <%def name="login_form(register=False, user='', dest='')"> | |
| <% op = "reg" if register else "login" %> | |
| <form id="login_${op}" method="post" | |
| action="${add_sr('/post/' + op, nocname = True)}" | |
| onsubmit="return chklogin(this);" | |
| target="_top"> | |
| %if c.cname: | |
| <input type="hidden" name="${UrlParser.cname_get}" | |
| value="${random.random()}" /> | |
| %endif | |
| <input type="hidden" name="reason" value="" /> | |
| <input type="hidden" name="op" value="${op}" /> | |
| %if dest: | |
| <input type="hidden" name="dest" value="${dest}" /> | |
| %endif | |
| <div> | |
| <ul> | |
| <li> | |
| <label for="user_${op}">${_('Username')}:</label> | |
| <input value="${user}" name="user_${op}" id="user_${op}" | |
| type="text" maxlength="20"/> | |
| %if register: | |
| ${error_field("BAD_USERNAME_" + op, kind="span")} | |
| ${error_field("BAD_USERNAME_CHARS_" + op, kind="span")} | |
| ${error_field("BAD_USERNAME_SHORT_" + op, kind="span")} | |
| ${error_field("BAD_USERNAME_LONG_" + op, kind="span")} | |
| ${error_field("USERNAME_TAKEN_" + op, kind="span")} | |
| %endif | |
| </li> | |
| %if register: | |
| <li> | |
| <label for="email_${op}">${_('Email')}:</label> | |
| <input value="" name="email_${op}" id="email_${op}" | |
| type="text" maxlength="50"/> | |
| ${error_field("NO_EMAIL_" + op, kind="span")} | |
| ${error_field("BAD_EMAIL_" + op, kind="span")} | |
| </li> | |
| %endif | |
| <li> | |
| <label for="passwd_${op}">${_('Password')}:</label> | |
| <input id="passwd_${op}" | |
| name="passwd_${op}" type="password" maxlength="20"/> | |
| %if register: | |
| ${error_field("BAD_PASSWORD_" + op, kind="span")} | |
| %else: | |
| ${error_field("WRONG_PASSWORD_" + op, kind="span")} | |
| %endif | |
| </li> | |
| %if register: | |
| <li> | |
| <label for="passwd2_${op}">${_('Verify password')}:</label> | |
| <input name="passwd2_${op}" id="passwd2_${op}" | |
| type="password" maxlength="20" /> | |
| ${error_field("BAD_PASSWORD_MATCH_" + op, kind="span")} | |
| </li> | |
| <li> | |
| ${captchagen('', tabulate=True, label=False, size=30)} | |
| ${error_field("DRACONIAN_" + op, kind="span")} | |
| ${error_field("RATELIMIT_" + op, kind="span")} | |
| </li> | |
| %endif | |
| <li> | |
| <input type="checkbox" name="rem" id="rem_${op}" /> | |
| <label for="rem_${op}" class="remember">${_('Remember me')}</label> | |
| </li> | |
| </ul> | |
| ## %if register: | |
| ## <p class="legal"> | |
| ## ${text_with_links(strings.legal, | |
| ## user_agreement = (_("User Agreement"), "http://reddit.com/help/useragreement"), | |
| ## privacy_policy = (_("Privacy Policy"), "http://reddit.com/help/privacypolicy"))} | |
| ## </p> | |
| ## %endif | |
| <p> | |
| <button type="submit"> | |
| ${register and _("Create account") or _("Login")} | |
| </button> | |
| <span id='status_${op}' class='error'></span> | |
| </p> | |
| </div> | |
| </form> | |
| </%def> | |
| <%def name="login_panel(user_reg = '', user_login = '', dest='')"> | |
| <div class="loginform divide"> | |
| <h3>${_("Create")}</h3> | |
| <p class="tagline"> | |
| ${_("Pick a username and password for your Less Wrong and Less Wrong Wiki accounts. You will receive an email to verify your account.")} | |
| </p> | |
| ${login_form(register=True, user=user_reg, dest=dest)} | |
| </div> | |
| <div class="loginform"> | |
| <h3>${_("Login")}</h3> | |
| <p class="tagline"> | |
| ${_("Already have an account and just want to login?")} | |
| </p> | |
| ${login_form(user = user_login, dest = dest)} | |
| <p> | |
| ${plain_link(_("Forgot your password?"), "/password")} | |
| </p> | |
| </div> | |
| <div class="clear"></div> | |
| </%def> |