Class: UserTemplates::SignupController

Inherits:
Volt::ModelController
  • Object
show all
Defined in:
app/user-templates/controllers/signup_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



3
4
5
# File 'app/user-templates/controllers/signup_controller.rb', line 3

def index
  self.model = store._users.buffer
end

#signupObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/user-templates/controllers/signup_controller.rb', line 7

def 
  # Get login and password to login
   = model.send(:"_#{User.login_field}")
  password = model._password

  save!.then do |result|
    flash._notices << "Signup successful"

     = attrs..or('/')

    # On a successful signup, then login
    Volt.(, password).then do
      # Redirect to post signup url
      go 
    end.fail do |errors|
      # Show the error (probably only the server goes down)
      flash._errors << errors.to_s
    end
  end.fail do |err|
    puts "ERR: #{err.inspect}"
  end
end

#use_username?Boolean

Returns:

  • (Boolean)


30
31
32
33
# File 'app/user-templates/controllers/signup_controller.rb', line 30

def use_username?
  auth = Volt.config.auth
  auth && auth.use_username
end