Class: ClWiki::SessionsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/cl_wiki/sessions_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#authorized, #current_owner, #current_user, #initialize_index, #logged_in?

Instance Method Details

#createObject



12
13
14
15
16
17
18
19
20
21
22
# File 'app/controllers/cl_wiki/sessions_controller.rb', line 12

def create
  @user = User.find(params[:username])
  password = params[:password]
  if @user&.username == $wiki_conf.owner && @user&.authenticate(password)
    session[:username] = @user.username
    session[:encryption_key] = Base64.encode64(@user.derive_encryption_key(password))
    redirect_to root_url
  else
    redirect_to 
  end
end

#newObject



9
10
# File 'app/controllers/cl_wiki/sessions_controller.rb', line 9

def new
end