Browse Source

Finish documentation for now

Maarten van den Berg 8 years ago
parent
commit
6f2c296194
1 changed files with 22 additions and 0 deletions
  1. 22 0
      app/models/session.rb

+ 22 - 0
app/models/session.rb

@@ -1,10 +1,32 @@
1
+# A Session contains the information about a logged-in user.
1 2
 class Session < ApplicationRecord
3
+  # @!attribute ip
4
+  #   @return [String]
5
+  #     the IP address of the client that started the session.
6
+  #
7
+  # @!attribute expires
8
+  #   @return [TimeWithZone]
9
+  #     when the user must be logged out.
10
+  #
11
+  # @!attribute remember_digest
12
+  #   @return [String]
13
+  #     a salted hash of the user's remember token. This token may be used if
14
+  #     the user continues a session by using the 'remember me' option.
15
+  #
16
+  # @!attribute active
17
+  #   @return [Boolean]
18
+  #     whether or not the session may still be used to authenticate.
19
+  #     Inactive sessions may be retained for logging, but must not allow a user
20
+  #     to continue using the system.
21
+
2 22
   belongs_to :user
3 23
 
24
+  # @return [String] a new random token.
4 25
   def Session.new_token
5 26
     SecureRandom.urlsafe_base64
6 27
   end
7 28
 
29
+  # @return [String] a BCrypt digest of the given string.
8 30
   def Session.digest(string)
9 31
     cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST :
10 32
                                                   BCrypt::Engine.cost