1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-20 10:58:33 +00:00

[register] redesigned it

This commit is contained in:
llj
2018-06-14 16:51:13 +08:00
parent c70b878359
commit 435ced05f5
7 changed files with 78 additions and 61 deletions

View File

@@ -2252,6 +2252,9 @@ button.sf-dropdown-toggle:focus {
margin-top:10px;
text-align:right;
}
#signup-form .input {
margin-bottom:5px;
}
/*myhome*/
#quota-bar {
display:block;

View File

@@ -1,26 +1,22 @@
{% extends "base.html" %}
{% extends "registration/login.html" %}
{% load i18n %}
{% block sub_title %}{% trans "Signup" %} - {% endblock %}
{% block extra_style %}
<style type="text/css">
#hd {
margin-bottom:15px;
}
</style>
{% block main_content %}
<div class="login-panel-outer-container vh">
<div class="login-panel">
<h1 class="login-panel-hd">{% trans "Signup" %}</h1>
<button id="personal" class="submit">{% trans "Create a personal account" %}</button>
<button id="org" class="submit">{% trans "Create an organization account" %}</button>
</div>
</div>
{% endblock %}
{% block main_panel %}
<h2 id="hd">{% trans "Signup" %}</h2>
<button id="personal" class="signup-btn">{% trans "Create a personal account" %}</button>
<button id="org" class="signup-btn">{% trans "Create an organization account" %}</button>
{% endblock %}
{% block extra_script %}
{% block extra_script %}{{block.super}}
<script type="text/javascript">
$('#personal').on('click', function() {
location.href = "{% url 'registration_register'%}";
});
$('#org').on('click', function() {
location.href = "{% url 'org_register'%}";
});

View File

@@ -27,7 +27,7 @@ html, body, #wrapper { height:100%; }
<div class="login-panel-outer-container vh">
<div class="login-panel">
<h1 class="login-panel-hd">{% trans "Log In" %}</h1>
<form action="" method="post">{% csrf_token %}
<form action="" method="post" id="login-form">{% csrf_token %}
<input type="text" name="login" placeholder="{% trans "Email or Username" %}" aria-label="{% trans "Email or Username" %}" title="{% trans "Email or Username" %}" value="" class="input name-input" /><br />
<input type="password" name="password" placeholder="{% trans "Password" %}" aria-label="{% trans "Password" %}" title="{% trans "Password" %}" value="" class="input passwd-input" autocomplete="off" />
@@ -120,7 +120,7 @@ $('#refresh-captcha').on('click', function() {
return false;
});
$('.login-panel form').on('submit', function(){
$('#login-form').on('submit', function(){
if (!$.trim($('input[name="login"]').val())) {
$('.error').removeClass('hide').html("{% trans "Email or username cannot be blank" %}");
return false;

View File

@@ -1,56 +1,59 @@
{% extends "base.html" %}
{% extends "registration/login.html" %}
{% load i18n %}
{% block sub_title %}{% trans "Register" %} - {% endblock %}
{% block sub_title %}{% trans "Signup" %} - {% endblock %}
{% block extra_style %}
{% block extra_style %}{{block.super}}
<link rel="stylesheet" type="text/css" href="{{ MEDIA_URL }}css/bootstrap.popover.min.css" />
{% endblock %}
{% block main_content %}
<div class="new-narrow-panel">
<h2 class="hd">{% trans "Signup" %}</h2>
<div class="con">
{% if request.user.is_authenticated %}
<p>{% trans "Welcome back, you are already signed in." %}</p>
{% else %}
<form action="" method="post">{% csrf_token %}
{% if form.name.field.required %}
<label for="id_name">{% trans "Name" %}</label>
{{ form.name }} {{ form.name.errors }}
<div class="login-panel-outer-container vh">
<div class="login-panel">
<h1 class="login-panel-hd">{% trans "Signup" %}</h1>
{% if request.user.is_authenticated %}
<p>{% trans "Welcome back, you are already signed in." %}</p>
{% else %}
<form action="" method="post" id="signup-form">{% csrf_token %}
{% if form.name.field.required %}
<label for="id_name">{% trans "Name" %}</label>
{{ form.name }} {{ form.name.errors }}
{% endif %}
<label for="id_email">{% trans "Email" %}</label>
{{ form.email }} {{ form.email.errors }}
<label for="id_password1">{% trans "Password" %}</label>
{{ form.password1 }} {{ form.password1.errors }}
<div id="pwd_strength"></div>
<label for="id_password2">{% trans "Confirm Password" %}</label>
{{ form.password2 }} {{ form.password2.errors }}
{% if form.department.field.required %}
<label for="id_department">{% trans "Department" %}</label>
{{ form.department }} {{ form.department.errors }}
{% endif %}
{% if form.telephone.field.required %}
<label for="id_telephone">{% trans "Telephone" %}</label>
{{ form.telephone }} {{ form.telephone.errors }}
{% endif %}
{% if form.note.field.required %}
<label for="id_note">{% trans "Note" %}</label>
{{ form.note }} {{ form.note.errors }}
{% endif %}
<p class="error hide"></p>
<button type="submit" class="submit">{% trans "Sign Up" %}</button>
</form>
<div class="login-panel-bottom-container">
{# language will be shown here #}
</div>
{% endif %}
<label for="id_email">{% trans "Email" %}</label>
{{ form.email }} {{ form.email.errors }}
<label for="id_password1">{% trans "Password" %}</label>
{{ form.password1 }} {{ form.password1.errors }}
<div id="pwd_strength"></div>
<label for="id_password2">{% trans "Confirm Password" %}</label>
{{ form.password2 }} {{ form.password2.errors }}
{% if form.department.field.required %}
<label for="id_department">{% trans "Department" %}</label>
{{ form.department }} {{ form.department.errors }}
{% endif %}
{% if form.telephone.field.required %}
<label for="id_telephone">{% trans "Telephone" %}</label>
{{ form.telephone }} {{ form.telephone.errors }}
{% endif %}
{% if form.note.field.required %}
<label for="id_note">{% trans "Note" %}</label>
{{ form.note }} {{ form.note.errors }}
{% endif %}
<p class="error hide"></p>
<input type="submit" value="{% trans "Sign Up" %}" class="submit" />
</form>
{% endif %}
</div>
</div>
{% endblock %}
{% block extra_script %}
{% block extra_script %}{{ block.super }}
<script type="text/javascript" src="{{MEDIA_URL}}js/bootstrap.min.js"></script>
<script type="text/javascript">
{% if strong_pwd_required %}
@@ -74,7 +77,7 @@ $("#id_password1")
});
{% endif %}
$('form').on('submit', function(){
$('#signup-form').on('submit', function(){
var email = $.trim($('input[name="email"]').val()),
pwd1 = $.trim($('input[name="password1"]').val()),
pwd2 = $.trim($('input[name="password2"]').val());

View File

@@ -169,7 +169,7 @@ urlpatterns = [
url(r'^convert_cmmt_desc_link/$', convert_cmmt_desc_link, name='convert_cmmt_desc_link'),
url(r'^modules/toggle/$', toggle_modules, name="toggle_modules"),
url(r'^download_client_program/$', TemplateView.as_view(template_name="download.html"), name="download_client"),
url(r'^choose_register/$', TemplateView.as_view(template_name="choose_register.html"), name="choose_register"),
url(r'^choose_register/$', choose_register, name="choose_register"),
### Ajax ###
url(r'^ajax/repo/(?P<repo_id>[-0-9a-f]{36})/dirents/$', get_dirents, name="get_dirents"),

View File

@@ -48,6 +48,7 @@ from seahub.utils.star import get_dir_starred_files
from seahub.utils.repo import get_library_storages
from seahub.utils.file_op import check_file_lock
from seahub.utils.timeutils import utc_to_local
from seahub.utils.auth import get_login_bg_image_path
from seahub.views.modules import MOD_PERSONAL_WIKI, enable_mod_for_user, \
disable_mod_for_user
import seahub.settings as settings
@@ -1159,3 +1160,13 @@ def client_token_login(request):
auth_login(request, user)
return HttpResponseRedirect(request.GET.get("next", reverse('libraries')))
def choose_register(request):
"""
Choose register
"""
login_bg_image_path = get_login_bg_image_path()
return render(request, 'choose_register.html', {
'login_bg_image_path': login_bg_image_path
})

View File

@@ -13,6 +13,7 @@ from registration.backends import get_backend
from constance import config
from seahub import settings
from seahub.utils.auth import get_login_bg_image_path
def activate(request, backend,
template_name='registration/activate.html',
@@ -219,4 +220,7 @@ def register(request, backend, success_url=None, form_class=None,
context['strong_pwd_required'] = config.USER_STRONG_PASSWORD_REQUIRED
context['level'] = config.USER_PASSWORD_STRENGTH_LEVEL
login_bg_image_path = get_login_bg_image_path()
context['login_bg_image_path'] = login_bg_image_path
return render(request, template_name, context)