Class: NoPassword::EmailAuthenticationsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/nopassword/email_authentications_controller.rb

Direct Known Subclasses

EmailAuthenticationsController

Instance Method Summary collapse

Instance Method Details

#createObject



16
17
18
19
20
21
22
23
24
# File 'app/controllers/nopassword/email_authentications_controller.rb', line 16

def create
  if @email_authentication.valid?
    deliver_authentication @email_authentication
    @verification = @email_authentication.verification
    render :edit, status: :accepted
  else
    render :new, status: :unprocessable_entity
  end
end

#destroyObject



26
27
28
# File 'app/controllers/nopassword/email_authentications_controller.rb', line 26

def destroy
  @verification.destroy!
end

#newObject



9
10
# File 'app/controllers/nopassword/email_authentications_controller.rb', line 9

def new
end

#showObject



12
13
14
# File 'app/controllers/nopassword/email_authentications_controller.rb', line 12

def show
  redirect_to url_for(action: :new)
end

#updateObject



30
31
32
33
34
35
36
37
38
39
40
# File 'app/controllers/nopassword/email_authentications_controller.rb', line 30

def update
  if @verification.valid?
    verification_succeeded @verification.data
  elsif @verification.has_expired?
    verification_expired @verification
  elsif @verification.has_exceeded_attempts?
    verification_exceeded_attempts @verification
  else
    render :edit, status: :unprocessable_entity
  end
end