Skip to main content
CrystalDocs
Search documentation
Search
Browse Docs
CrystalShards
About
class
User
Inherits
Reference
<
Object
Constructors
create
(email :
String
, username :
String
, password :
String
, role :
String
= "user") :
User
Source
new
(email :
String
, username :
String
, password_hash :
String
, role :
String
= "user", id :
Int64
|
Nil
= nil, created_at :
Time
|
Nil
= nil)
Source
Class methods
all
(limit :
Int32
= 20, offset :
Int32
= 0) :
Array
(
User
)
Source
count
Source
find
(id :
Int64
) :
User
|
Nil
Source
find_by_email
(email :
String
) :
User
|
Nil
Source
find_by_username
(username :
String
) :
User
|
Nil
Source
from_jwt
(token :
String
) :
User
|
Nil
Source
jwt_secret
Source
validate_jwt
(token :
String
) :
Hash
(
String
,
JSON::Any
) |
Nil
Source
Instance methods
authenticate
(password :
String
) :
Bool
Source
created_at
Source
created_at=
(created_at :
Time
|
Nil
)
Source
delete
Source
email
Source
email=
(email :
String
)
Source
generate_jwt
(exp_hours :
Int32
= 24) :
String
Source
id
Source
id=
(id :
Int64
|
Nil
)
Source
password_hash
Source
password_hash=
(password_hash :
String
)
Source
role
Source
role=
(role :
String
)
Source
save
Source
to_json
(json :
JSON::Builder
)
Source
username
Source
username=
(username :
String
)
Source