From d25971f546b4a2c7b731d9d0bc71b929f2a15aa6 Mon Sep 17 00:00:00 2001 From: lizanle <491823689@qq.com> Date: Tue, 25 Aug 2015 14:24:20 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E9=99=86=E7=95=8C=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/account_controller.rb | 9 +- app/views/account/login.html.erb | 321 +++++++++++++++++++------- app/views/layouts/login.html.erb | 151 ++---------- public/stylesheets/new_public.css | 5 +- 4 files changed, 268 insertions(+), 218 deletions(-) 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..93ac9fba7 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 %> +<%= stylesheet_link_tag 'new_public'%> +<%= stylesheet_link_tag 'leftside'%> - -
- - - -- - | -- <%= 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? %> - - <% end %> - | -
- - - <% if Setting.lost_password? %> - <%= link_to l(:label_password_lost), lost_password_path %> - <% end %> - - - - | -