socialforge/app/views/account/register.html.erb

127 lines
4.8 KiB
Plaintext
Raw Normal View History

<% @nav_dispaly_home_path_label = 1
@nav_dispaly_main_course_label = 1
@nav_dispaly_main_project_label = 1
@nav_dispaly_main_contest_label = 1 %>
<% @nav_dispaly_forum_label = 1%>
<!-- end -->
<h3><%= l(:label_register) %> <%= link_to l(:label_login_with_open_id_option), signin_url if Setting.openid? %></h3>
<%= labelled_form_for @user, :url => register_path do |f| %>
<%= error_messages_for 'user' %>
<div class="box tabular">
<% if @user.auth_source_id.nil? %>
<p><%= f.text_field :login, :size => 25, :required => true %><span id="valid_user_login"></span>
<em class="info" style="color: #acaeb1"><%= l(:label_max_number) %></em>
</p>
<p><%= f.password_field :password, :size => 25, :required => true %><span id="valid_user_password"></span>
<em class="info" style="color: #acaeb1"><%= l(:text_caracters_minimum, :count => Setting.password_min_length) %></em>
</p>
<p><%= f.password_field :password_confirmation, :size => 25, :required => true %><span id="valid_password" style="padding-left: 10px;"></span></p>
<% end %>
<p>
<%= f.text_field :mail,:size => 25, :required => true %>
<span id="valid_user_mail" ></span>
</p>
<p>
<em class="info" style="color: #acaeb1">
<p><%= "#{l(:label_mail_attention)} " %></p>
<p><%= "#{l(:label_mail_attention1)} " %></p>
</em>
</p>
<!-- end -->
</div>
<p>
<table>
<tr>
<td><%= submit_tag l(:button_submit) %></td>
</tr>
</table>
</p>
<% end %>
<% if Setting.openid? %>
<p><%= f.text_field :identity_url %></p>
<% end %>
<% @user.custom_field_values.select { |v| v.editable? || v.required? }.each do |value| %>
<p><%= custom_field_tag_with_label :user, value %></p>
<% end %>
</div>
<% password_min_length = Setting.password_min_length %>
<script type="text/javascript">
jQuery(document).ready(function () {
var $login = $('#user_login')
var $mail = $('#user_mail')
var $password = $('#user_password')
var $password_confirmation = $('#user_password_confirmation')
$login.blur(function (event) {
if ($(this).is('#user_login')) {
$.get(
'<%=account_valid_ajax_path%>',
{ valid: "login",
value: this.value },
function (data) {
if (data.valid) {
$('#valid_user_login').html('<span class="green">' + data.message + "</span>");
} else {
$('#valid_user_login').html('<span class="red">' + data.message + "</span>");
}
});
}
;
});
$mail.blur(function (event) {
if ($(this).is('#user_mail')) {
$.get('<%=account_valid_ajax_path%>',
{ valid: "mail",
value: this.value },
function (data) {
if (data.valid) {
$('#valid_user_mail').html('<span class="green">' + data.message + "</span>");
} else {
$('#valid_user_mail').html('<span class="red">' + data.message + "</span>");
}
});
}
;
});
$password.blur(function () {
var pas1 = document.getElementById("user_password").value;
var password_min_length = <%= password_min_length %>
if (pas1.length >= password_min_length) {
$('#valid_user_password').html('<span class="green">'+ "</span>");
}
else {
$('#valid_user_password').html('<span class="red">' + "<%= l(:setting_password_min_length_limit, :count => password_min_length) %>" + "</span>");
}
});
$password_confirmation.blur(function () {
var password_min_length = <%= password_min_length %>
var pas1 = document.getElementById("user_password").value;
var pas2 = document.getElementById("user_password_confirmation").value;
if (pas1.length >= password_min_length && pas1 == pas2 ) {
$('#valid_password').html('<span class="green">' + "<%= l(:setting_password_success) %>"+ "</span>");
}
else {
$('#valid_password').html('<span class="red">' + "<%= l(:setting_password_error) %>" + "</span>");
}
});
});
2014-05-10 09:22:45 +08:00
</script>