user activation on creation/edit

This commit is contained in:
Mark Moser 2015-10-23 19:57:32 -05:00
parent 7ddf93578e
commit 0d597813ec
5 changed files with 28 additions and 6 deletions

View File

@ -4,6 +4,9 @@ A simple app to send sms messages with [twillio](https://www.twilio.com/).
## Configure ## Configure
- set up twilio account
- create google apps oauth app
### Secrets file: ### Secrets file:
`config/application.yml` is read at boot and shoves the values into `ENV`. `config/application.yml` is read at boot and shoves the values into `ENV`.
@ -13,8 +16,7 @@ A simple app to send sms messages with [twillio](https://www.twilio.com/).
3. Make *ABSOLUTE* certain that this file is not checked into your repository. 3. Make *ABSOLUTE* certain that this file is not checked into your repository.
## TODO ## TODO
* activation flag on user edit - milestone 1.0.0
* verify roles access - decent UX
* application log - application log
* task runner - delayedjob or sidekiq or activerecord newness? - task runner - delayedjob or sidekiq or activerecord newness?
* milestone 1.0.0

View File

@ -60,7 +60,8 @@ class UsersController < ApplicationController
:phone, :phone,
:email, :email,
:admin, :admin,
:staff :staff,
:active
) )
end end
end end

View File

@ -38,6 +38,18 @@ class Person < ActiveRecord::Base
activation_state == "active" activation_state == "active"
end end
def active
activation_state == 'active'
end
def active=(bool)
if bool
self.activation_state = 'active'
else
self.ctivation_state = nil
end
end
private private
## SorceryCore expects the model to hold a crypted_password field ## SorceryCore expects the model to hold a crypted_password field

View File

@ -26,4 +26,7 @@
= f.label :staff = f.label :staff
= f.check_box :staff = f.check_box :staff
= f.label :active
= f.check_box :active
= f.submit = f.submit

View File

@ -6,6 +6,10 @@
%p Email: #{mail_to(@user.email, nil, encode: 'hex')} %p Email: #{mail_to(@user.email, nil, encode: 'hex')}
%p Phone: #{number_to_phone @user.phone} #{page_link(@user)} %p Phone: #{number_to_phone @user.phone} #{page_link(@user)}
%p Admin: #{@user.admin?}
%p Staff: #{@user.staff?}
%p Account Active: #{@user.active?}
%p Has Signed in: #{!@user.authentications.blank?}
- unless @user.children.empty? - unless @user.children.empty?
%p Children: %p Children: