diff --git a/app/controllers/account_controller.rb b/app/controllers/account_controller.rb index 0e2f9569c..02736346c 100644 --- a/app/controllers/account_controller.rb +++ b/app/controllers/account_controller.rb @@ -27,8 +27,9 @@ class AccountController < ApplicationController if request.get? if User.current.logged? redirect_to home_url + else + render :layout => 'login' end - # render :layout => 'login' else authenticate_user end @@ -129,10 +130,12 @@ class AccountController < ApplicationController end when '3' #register_automatically(@user) - unless @user.new_record? + if !@user.new_record? self.logged_user = @user flash[:notice] = l(:notice_account_activated) redirect_to my_account_url + else + redirect_to signin_path end else #register_manually_by_administrator(@user) @@ -355,11 +358,13 @@ class AccountController < ApplicationController def invalid_credentials logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}" flash.now[:error] = l(:notice_account_invalid_creditentials) + render :layout => 'login' end def invalid_credentials_new logger.warn "Failed login for '#{params[:username]}' from #{request.remote_ip} at #{Time.now.utc}" flash.now[:error] = l(:notice_account_invalid_creditentials_new) + render :layout => 'login' end # Register a user for email activation. diff --git a/app/views/account/login.html.erb b/app/views/account/login.html.erb index bb289eb03..4b822a616 100644 --- a/app/views/account/login.html.erb +++ b/app/views/account/login.html.erb @@ -1,17 +1,49 @@ -<% @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%> -<%= call_hook :view_account_login_top %> - - - - - - -
-<%= form_tag(signin_path) do %> -<%= back_url_hidden_field_tag %> - - - - - - - - - -<% if Setting.openid? %> - - - - -<% end %> - - - - - - - -
- - - <%= text_field_tag 'username', params[:username], :tabindex => '1' , :value => "#{l(:label_login_prompt)}", - :onfocus => "clearInfo('username','#{l(:label_login_prompt)}')", - :onblur => "showInfo('username','#{l(:label_login_prompt)}')", - :style => "resize: none;font-size: 12px;color: #818283;"%> -
- - - <%= password_field_tag 'password', nil, :tabindex => '2' %> -
- - - <%= text_field_tag "openid_url", nil, :tabindex => '3' %> -
- <% if Setting.autologin? %> - +
+
+
+ +
欢迎加入Trustie高校创新实践社区,老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。Trustie是在中国推行大规模开放在线研究模式(MOORE)的支撑平台。
+
+
+
+
+
+
    +
  • 登陆
  • +
  • +
+
+
<%= flash.empty? ? "" : flash[:error].html_safe %>
+
+
+ + <%= form_tag(signin_path,:id=>'main_login_form',:method=>'post') do %> + <%= back_url_hidden_field_tag %> +
+ <%= text_field_tag 'username', params[:username], :tabindex => '1' , + :class=>'loginSignBox',:placeholder=>'请输入邮箱地址或昵称'%> + +
+ <% if Setting.openid? %> +
+ <%= text_field_tag "openid_url", nil, :tabindex => '3',:placeholder=>'请输入OpenId URL' %> +
+ <% end %> +
+ + <%= password_field_tag 'password', nil, :tabindex => '2',:class=>'loginSignBox' ,:placeholder=>'请输密码'%> +
+
+ <% if Setting.autologin? %> +
+ <%= check_box_tag 'autologin', 1, true, :tabindex => 4 %> +
+ <%= l(:label_stay_logged_in) %> + <% end %> + + <% if Setting.lost_password? %> + 忘记密码? + <% end %> +
<% end %> -
- - - <% if Setting.lost_password? %> - <%= link_to l(:label_password_lost), lost_password_path %> - <% end %> - - - -
-<% end %> -
-<%= call_hook :view_account_login_bottom %> +
+ 登陆 +
-<% if params[:username].present? %> -<%= javascript_tag "$('#password').focus();" %> -<% else %> -<%= javascript_tag "$('#username').focus();" %> -<% end %> + + + +
+
+ +
+
+ <%= form_for :user, :url => register_path,:method=>'post',:html=>{:id=>'main_reg_form'} do |f| %> + <%= error_messages_for 'user' %> +
+ + <%= f.text_field :mail,:size => 25, :class=>'loginSignBox' ,:placeholder=>"请输入邮箱地址"%> + +
+
+ + <%= f.password_field :password, :size => 25,:placeholder=>"请输入密码",:class=>'loginSignBox' %> + +
+
+ + <%= f.password_field :password_confirmation, :size => 25,:placeholder=>"请再次输入密码",:class=>'loginSignBox' %> + +
+
+ + <%= f.text_field :login, :size => 25,:placeholder=>"请输入用户昵称",:class=>'loginSignBox'%> + +
+
+ 注册 + +
+ <% end %> +
+
+ +
+ + diff --git a/app/views/layouts/login.html.erb b/app/views/layouts/login.html.erb index a0e7f909c..0349caf13 100644 --- a/app/views/layouts/login.html.erb +++ b/app/views/layouts/login.html.erb @@ -1,131 +1,28 @@ - <%= stylesheet_link_tag 'new_public'%> - <%= stylesheet_link_tag 'leftside'%> + + + + + <%= h html_title %> + + + <%= csrf_meta_tag %> + <%= favicon %> + <%= stylesheet_link_tag 'jquery/jquery-ui-1.9.2', 'new_public', 'user_leftside', :media => 'all' %> + <%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %> <%= javascript_heads %> - <%= javascript_include_tag 'javascripts/jquery-1.3.2' %> - <%= javascript_include_tag 'bootstrap' %> - + <%= javascript_include_tag "bootstrap","avatars","new_user"%> + <%= heads_for_theme %> + <%= call_hook :view_layouts_base_html_head %> + <%= yield :header_tags -%> + -
-
-
- -
欢迎加入Trustie高校创新实践社区,老师、学生和科研人员可以在此开展各种在线协同学习、协同作业、协同开发等活动。Trustie是在中国推行大规模开放在线研究模式(MOORE)的支撑平台。
-
-
-
-
-
    -
  • 登陆
  • -
  • -
-
-
-
- -
-
- -
- - -
-
-
-
-
    -
  • 注册 -
  • -
-
-
-
- -
请输入有效邮箱地址
-
-
- -
至少需要 6 个字符
-
-
- -
-
- -
用户昵称为2-18个中英文,数字或下划线
-
- -
-
-
-
-
+ <% is_current_user = User.current.logged? && User.current == @user%> + <% if User.current.logged? %> + <%= render :partial => 'layouts/logined_header' %> + <% else%> + <%= render :partial => 'layouts/unlogin_header' %> + <% end%>
+ +<%= yield %> diff --git a/public/stylesheets/new_public.css b/public/stylesheets/new_public.css index 4ba8c4711..2e1906973 100644 --- a/public/stylesheets/new_public.css +++ b/public/stylesheets/new_public.css @@ -124,6 +124,7 @@ a.c_blue{ color:#15bccf;} a.c_dblue{ color:#09658c;} a:hover.c_dblue{ color:#15bccf;} a.c_white{ color:#fff;} +input.c_white { color:#fff} a.c_dorange{ color:#fd6e2a;} a.c_dark{color: #3e4040;} a:hover.c_dark{color: #3ca5c6;} @@ -612,7 +613,9 @@ a.loginChooseTab {color:#484848; height:30px; display:block;} .loginSignBox {width:308px; height:38px; margin-left:46px; border:1px solid #98a1a6; outline:none;} .loginSignOption {margin-left:46px; margin-top:15px;} .loginIn {width:405px; background-color:#ffffff; padding-bottom:30px;} -.loginSignAlert {font-size:12px; color:#fc0000; margin-left:60px;} +.loginSignAlert {font-size:12px; margin-left:60px;} +.loginSignRow {height:60px; min-height:60px;} + /*底部*/