Class: Foobara::Auth::Register
- Inherits:
-
Command
- Object
- Command
- Foobara::Auth::Register
show all
- Defined in:
- foobara-auth-0.1.1/src/register.rb
Overview
TODO: should raise error if username or email already in use!
Constant Summary
TruncatedInspect::MAX_LENGTH
Instance Attribute Summary collapse
Instance Method Summary
collapse
Methods inherited from Command
install!
#inspect, truncating
Methods included from Concern
foobara_class_methods_module_for, foobara_concern?, included
Instance Attribute Details
#user ⇒ Object
Returns the value of attribute user.
28
29
30
|
# File 'src/register.rb', line 28
def user
@user
end
|
Instance Method Details
#create_user ⇒ Object
30
31
32
33
34
35
36
37
38
|
# File 'src/register.rb', line 30
def create_user
inputs = { username:, email: }
if user_id
inputs[:user_id] = user_id
end
self.user = run_subcommand!(CreateUser, inputs)
end
|
#execute ⇒ Object
18
19
20
21
22
23
24
25
26
|
# File 'src/register.rb', line 18
def execute
create_user
if password?
set_password
end
user
end
|
#password? ⇒ Boolean
40
41
42
|
# File 'src/register.rb', line 40
def password?
plaintext_password && !plaintext_password.empty?
end
|
#set_password ⇒ Object
44
45
46
|
# File 'src/register.rb', line 44
def set_password
run_subcommand!(SetPassword, user:, plaintext_password:)
end
|