Class: UserTemplates::LoginController

Inherits:
Volt::ModelController
  • Object
show all
Defined in:
app/user_templates/controllers/login_controller.rb

Instance Method Summary collapse

Instance Method Details

#after_loginObject



25
26
27
# File 'app/user_templates/controllers/login_controller.rb', line 25

def 
  redirect_to(attrs. || '/')
end

#do_loginObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'app/user_templates/controllers/login_controller.rb', line 9

def 
  Volt.(, password).then do |res|
    # Successful login, clear out the form
    self.errors = nil
    self. = ''
    self.password = ''

    

    nil
  end.fail do |errors|
    # Login fail
    self.errors = errors
  end
end

#forgot_urlObject



29
30
31
# File 'app/user_templates/controllers/login_controller.rb', line 29

def forgot_url
  url_for(component: 'user_templates', controller: 'login', action: 'forgot')
end

#send_reset_emailObject



33
34
35
36
37
38
39
40
41
# File 'app/user_templates/controllers/login_controller.rb', line 33

def send_reset_email
  UserTemplateTasks.send_reset_email(reset_email).then do
    self.reset_email = ''
    flash._notices << 'Reset email sent.'
    redirect_to(attrs.post_forgot_url || '/login')
  end.fail do |err|
    flash._errors << err.message
  end
end

#use_username?Boolean

Returns:

  • (Boolean)


43
44
45
# File 'app/user_templates/controllers/login_controller.rb', line 43

def use_username?
  Volt.config.public.try(:auth).try(:use_username)
end