Skip to content

Commit

Permalink
Added a 'last know login date and IP' fields [#10 state:resolved]
Browse files Browse the repository at this point in the history
  • Loading branch information
s2j1h committed Oct 28, 2010
1 parent 10ddb8c commit 118638d
Show file tree
Hide file tree
Showing 6 changed files with 548 additions and 2 deletions.
3 changes: 3 additions & 0 deletions app/views/identities/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -87,3 +87,6 @@
</tbody>
</table>
</div>
<% if current_user.last_login_at %>
<p align="center">Your last login was <%= time_ago_in_words(current_user.last_login_at)%> ago from <%=current_user.last_login_ip%>.</p>
<% end %>
2 changes: 1 addition & 1 deletion app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="keywords" content="" />
<meta name="description" content="" />
<meta name="description" content="Vauban is a free webapplication to store web identities" />
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Vauban - Managing your web identities</title>
<%= stylesheet_link_tag 'reset' , 'typography', 'main','jquery-ui' %>
Expand Down
Binary file modified db/development.sqlite3
Binary file not shown.
15 changes: 15 additions & 0 deletions db/migrate/20101028171055_add_last_login_at_to_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class AddLastLoginAtToUsers < ActiveRecord::Migration
def self.up
add_column :users, :last_login_at, :datetime
add_column :users, :last_login_ip, :string
add_column :users, :current_login_at, :datetime
add_column :users, :current_login_ip, :string
end

def self.down
remove_column :users, :last_login_at
remove_column :users, :last_login_ip
remove_column :users, :current_login_at
remove_column :users, :current_login_ip
end
end
6 changes: 5 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#
# It's strongly recommended to check this file into your version control system.

ActiveRecord::Schema.define(:version => 20100530065851) do
ActiveRecord::Schema.define(:version => 20101028171055) do

create_table "identities", :force => true do |t|
t.string "name"
Expand All @@ -32,6 +32,10 @@
t.datetime "created_at"
t.datetime "updated_at"
t.string "perishable_token", :default => "", :null => false
t.datetime "last_login_at"
t.string "last_login_ip"
t.datetime "current_login_at"
t.string "current_login_ip"
end

add_index "users", ["perishable_token"], :name => "index_users_on_perishable_token"
Expand Down

0 comments on commit 118638d

Please sign in to comment.