Class: Cms::User
- Inherits:
-
PersistentUser
- Object
- ActiveRecord::Base
- PersistentUser
- Cms::User
- Includes:
- Devise::Models::Recoverable, Devise::Models::Validatable
- Defined in:
- app/models/cms/user.rb
Overview
Represents a CMS users that is managed through the CMS UI.
Direct Known Subclasses
Class Method Summary collapse
-
.change_password(login, new_password) ⇒ Object
Change a given user’s password.
- .permitted_params ⇒ Object
Instance Method Summary collapse
-
#change_password(new_password) ⇒ Object
Change this User’s password to a new value.
-
#new_password ⇒ String
Generate a new random password for this user.
-
#source ⇒ Object
By default, Users are coming from the the CMS database (cms_users).
Methods inherited from PersistentUser
able_to_edit_or_publish_content, #active_for_authentication?, #cas_extra_attributes=, current, current=, #disable, #disable!, #enable, #enable!, #expired?, #expires_at_formatted, #full_name, #group_codes, #group_codes=, guest, #guest?, #password_changeable?
Methods included from DefaultAccessible
#non_permitted_params, #permitted_params
Class Method Details
.change_password(login, new_password) ⇒ Object
Change a given user’s password.
13 14 15 |
# File 'app/models/cms/user.rb', line 13 def change_password(login, new_password) find_by_login(login).change_password(new_password) end |
.permitted_params ⇒ Object
17 18 19 |
# File 'app/models/cms/user.rb', line 17 def permitted_params super + [:password, :password_confirmation] end |
Instance Method Details
#change_password(new_password) ⇒ Object
Change this User’s password to a new value.
31 32 33 34 |
# File 'app/models/cms/user.rb', line 31 def change_password(new_password) update(:password => new_password, :password_confirmation => new_password) new_password end |
#new_password ⇒ String
Generate a new random password for this user.
24 25 26 27 28 |
# File 'app/models/cms/user.rb', line 24 def new_password pwd = SecureRandom.hex(4) change_password(pwd) pwd end |
#source ⇒ Object
By default, Users are coming from the the CMS database (cms_users). All Cms::User class have have the same source.
39 40 41 |
# File 'app/models/cms/user.rb', line 39 def source "CMS Users" end |