Class: Picombo::Controllers::User

Inherits:
Template
  • Object
show all
Defined in:
lib/picombo-auth/controllers/user.rb

Instance Method Summary collapse

Instance Method Details

#loginObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/picombo-auth/controllers/user.rb', line 4

def 
	template = Picombo::View.new('template')
	body = Picombo::View.new('user/login')
	body.set('error', '')

	if ! Picombo::Input.instance.post.empty?
		if Picombo::Auth.instance.(Picombo::Input.instance.post('username'), Picombo::Input.instance.post('password'))
			Picombo::Core.redirect('admin/remove_banned')
		else
			body.set('error', 'Invalid password or unknown username')
		end
	end

	template.set('body', body.render(true))
	template.render
end

#logoutObject



21
22
23
24
25
# File 'lib/picombo-auth/controllers/user.rb', line 21

def logout
	Picombo::Auth.instance.logout

	Picombo::Core.redirect('admin/remove_banned')
end