feat: implement password authentication
This commit is contained in:
parent
498ecdf68b
commit
62a329aebd
5 changed files with 55 additions and 5 deletions
|
@ -38,6 +38,16 @@ class InstanceController < ApplicationController
|
|||
end
|
||||
end
|
||||
|
||||
def authenticate
|
||||
password, instance = auth_params
|
||||
inst = Instance.find_by(public_id: instance)
|
||||
if password == inst.password
|
||||
@id = inst.public_id
|
||||
@password = inst.password
|
||||
render "set_password"
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def create_instance_params
|
||||
|
@ -51,4 +61,8 @@ class InstanceController < ApplicationController
|
|||
def pop_instance_params
|
||||
params.expect(:instance, :nm, :pwd)
|
||||
end
|
||||
|
||||
def auth_params
|
||||
params.expect(:password, :instance)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue