Changesets can be listed by changeset number.
The Git repository is here.
- Revision:
- 111
- Log:
Renamed cookies with "typoapp_" prefix and corrected their paths.
Integrated with Hub, which includes removing support for the comment
author cookie; added a comment e-mail address cookie instead, to go
with the URL cookie that Typo already supports. Updated styles to
improve comment display and included e-mail address, where supplied,
in hex-encoded form after the author name.
- Author:
- adh
- Date:
- Mon Oct 23 21:30:52 +0100 2006
- Size:
- 1178 Bytes
1 | class AccountsController < ApplicationController |
2 | |
3 | before_filter :verify_users, :only => [:login] |
4 | |
5 | def login |
6 | case request.method |
7 | when :post |
8 | if session[:user] = User.authenticate(params[:user_login], params[:user_password]) |
9 | |
10 | flash[:notice] = "Login successful" |
11 | cookies[:typoapp_is_admin] = "yes" |
12 | redirect_back_or_default :controller => "admin/content", :action => "index" |
13 | else |
14 | flash.now[:notice] = "Login unsuccessful" |
15 | |
16 | @login = params[:user_login] |
17 | end |
18 | end |
19 | end |
20 | |
21 | def signup |
22 | redirect_to :action => "login" and return unless User.count.zero? |
23 | |
24 | @user = User.new(params[:user]) |
25 | |
26 | if request.post? and @user.save |
27 | session[:user] = User.authenticate(@user.login, params[:user][:password]) |
28 | flash[:notice] = "Signup successful" |
29 | redirect_to :controller => "admin/general", :action => "index" |
30 | return |
31 | end |
32 | end |
33 | |
34 | def logout |
35 | session[:user] = nil |
36 | cookies.delete :typoapp_is_admin |
37 | end |
38 | |
39 | def welcome |
40 | end |
41 | |
42 | private |
43 | |
44 | def verify_users |
45 | if User.count == 0 |
46 | redirect_to :controller => "accounts", :action => "signup" |
47 | else |
48 | true |
49 | end |
50 | end |
51 | |
52 | end |