Update comments code to use new comment dir format and the new user auth system
This commit is contained in:
parent
db99e070dd
commit
9d72114f26
1 changed files with 20 additions and 8 deletions
|
|
@ -140,16 +140,28 @@ fn select_handler {
|
||||||
set_handler blog_post_handler $body.md
|
set_handler blog_post_handler $body.md
|
||||||
if not
|
if not
|
||||||
set_handler md_handler $body.md
|
set_handler md_handler $body.md
|
||||||
|
|
||||||
if (! ~ $#allowComments 0 && ~ $REQUEST_METHOD POST) {
|
if (! ~ $#allowComments 0 && ~ $REQUEST_METHOD POST) {
|
||||||
get_post_args comment_user_name comment_text
|
get_post_args comment_text
|
||||||
ddir = $body.md_werc/comments/
|
d = `{date -n} # FIXME Obvious race
|
||||||
umask 002
|
d = $body.md_werc/comments/$d/
|
||||||
mkdir -m 775 -p $ddir
|
|
||||||
d = `{date -n} # Obvious race
|
|
||||||
{ echo '% user_name='^$comment_user_name'
|
|
||||||
|
|
||||||
'^$comment_text } > $ddir/$d.rec
|
u = $logged_user
|
||||||
|
if (~ $#logged_user 0) {
|
||||||
|
get_post_args comment_user_name comment_user_password
|
||||||
|
# TODO Should take this path too if the user can login but doesn't
|
||||||
|
# belong to required group
|
||||||
|
if (! login_user $comment_user_name $comment_user_password) {
|
||||||
|
u = $comment_user_name ':' $comment_user_password
|
||||||
|
d = $d^'_pending'
|
||||||
|
}
|
||||||
|
if not
|
||||||
|
u = $logged_user
|
||||||
|
}
|
||||||
|
|
||||||
|
umask 002
|
||||||
|
mkdir -m 775 -p $d
|
||||||
|
echo $u > $d/user
|
||||||
|
echo $comment_text > $d/body
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if not if (test -f $body.tpl)
|
if not if (test -f $body.tpl)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue