diff --git a/app/controllers/login_controller.rb b/app/controllers/login_controller.rb --- a/app/controllers/login_controller.rb +++ b/app/controllers/login_controller.rb @@ -7,7 +7,10 @@ end def login - if user = User.authenticate(params[:login], params[:password]) + if (!GraderConfiguration['right.bypass_agreement']) and (!params[:accept_agree]) + flash[:notice] = 'You must accept the agreement before logging in' + redirect_to :controller => 'main', :action => 'login' + elsif user = User.authenticate(params[:login], params[:password]) session[:user_id] = user.id session[:admin] = user.admin? diff --git a/app/views/main/_login_box.html.haml b/app/views/main/_login_box.html.haml --- a/app/views/main/_login_box.html.haml +++ b/app/views/main/_login_box.html.haml @@ -22,6 +22,11 @@ %td{:align => "right"} ="#{t 'password_label'}:" %td= password_field_tag + - unless GraderConfiguration['right.bypass_agreement'] + %tr + %td{:align => "right"}= check_box_tag 'accept_agree' + %td ยอมรับข้อตกลงการใช้งาน + = submit_tag t('login.login_submit') %br/ diff --git a/db/schema.rb b/db/schema.rb --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20150914155101) do +ActiveRecord::Schema.define(:version => 20150914223258) do create_table "announcements", :force => true do |t| t.string "author"