Skip to content

Commit

Permalink
Merge pull request #90 from jasonpettus/bugs
Browse files Browse the repository at this point in the history
Bugs
  • Loading branch information
jasonpettus committed Jul 23, 2015
2 parents b5ecc2f + 3827d36 commit 75887d8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
3 changes: 1 addition & 2 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ def login
user = User.find_by(email: params['email'])
if user && user.authenticate(params['password'])
login_user(user)
session['login_error'] = false
else
session['login_error'] = true
flash['login_error'] = true
end

if request.xhr?
Expand Down
7 changes: 4 additions & 3 deletions app/models/article.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ def strip_ads
decoder = HTMLEntities.new
unless summary.nil?
stripped_summary = summary.gsub(/(<[^>]*>)|\n|\t/,"")
decoded_summary = decoder.decode(stripped_summary)
self.summary = decoder.decode(stripped_summary)
split_summary = self.summary.split(' ')

if self.summary.length > 20
self.summary = decoded_summary.split(" ").slice(0..20).push("...").join(" ")
if split_summary.length > 20
self.summary = split_summary.slice(0..19).push("...").join(" ")
end
end

Expand Down
4 changes: 2 additions & 2 deletions app/views/application/_login.html.erb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<% if session['login_error'] %>
<p class="center bold mdl-color--deep-purple-500 mdl-color-text--red-A700">Incorrect Email or Password</p>
<% if flash['login_error'] %>
<p class="center bold mdl-color--deep-purple-500 mdl-color-text--black-A700">Incorrect Email or Password</p>
<% end %>

<div class="login_box">
Expand Down

0 comments on commit 75887d8

Please sign in to comment.