Created
November 28, 2014 09:18
-
-
Save notblizzard/c175f2406141a76dbc6d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
admin = Admin.find_by(user: params[:user]) | |
if admin && admin.authenticate(params[:password]) != false | |
login admin | |
redirect_to root_path | |
else | |
redirect_to blog_index_path | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<body> | |
<%= form_for :admin, url: login_path do |a| %> | |
<%= a.text_field :user %><br> | |
<%= a.text_field :password %><br> | |
<%= a.submit %> | |
<% end %> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment