diff --git a/app/assets/stylesheets/sass/articles.sass b/app/assets/stylesheets/sass/articles.sass index cf93039..7903a5f 100644 --- a/app/assets/stylesheets/sass/articles.sass +++ b/app/assets/stylesheets/sass/articles.sass @@ -18,8 +18,10 @@ div > h1 @include shaded-top box-sizing: border-box + padding: 8px margin: 0 width: 100% + height: 35px font-size: 140% h1 a color: #ffffff diff --git a/app/assets/stylesheets/sass/flash.sass b/app/assets/stylesheets/sass/flash.sass index 3e3acda..8497b4c 100644 --- a/app/assets/stylesheets/sass/flash.sass +++ b/app/assets/stylesheets/sass/flash.sass @@ -13,5 +13,6 @@ div &.flashMsg background-color: green color: white + margin-bottom: 20px &.flashError background-color: red \ No newline at end of file diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index dda9ad1..9879035 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -80,7 +80,7 @@ class UsersController < ApplicationController def login return unless request.post? - if u = User.authenticate(params[:login][:username], params[:login][:password]) + if u = User.authenticate(params[:login][:username].downcase, params[:login][:password]) raise Error, t(:accounts_locked) if u.banned? Ban::TYPE_SITE flash[:notice] = t(:login_successful) diff --git a/app/models/user.rb b/app/models/user.rb index 27b73ca..570ac8d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -258,8 +258,8 @@ class User < ActiveRecord::Base cuser and cuser.admin? end - def self.authenticate username, password - User.first :conditions => {:username => username, :password => Digest::MD5.hexdigest(password)} + def self.authenticate(username, password) + where("LOWER(username) = LOWER(?)", username).where(:password => Digest::MD5.hexdigest(password)).first end def self.get id diff --git a/app/views/layouts/_header.html.erb b/app/views/layouts/_header.html.erb index 17d3f64..caa9d2b 100644 --- a/app/views/layouts/_header.html.erb +++ b/app/views/layouts/_header.html.erb @@ -1,7 +1,7 @@