Minor reorg of handler selection, move comment code to bridge app.
Bigger changes still to come.
This commit is contained in:
		
							parent
							
								
									e3770969a9
								
							
						
					
					
						commit
						c91a635ac2
					
				
					 2 changed files with 32 additions and 29 deletions
				
			
		
							
								
								
									
										26
									
								
								apps/bridge/app.rc
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								apps/bridge/app.rc
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,26 @@ | |||
| fn bridge_init { | ||||
|     if(! ~ $#allowComments 0 && ~ $REQUEST_METHOD POST) { | ||||
|         get_post_args comment_text | ||||
|         d=`{date -n} # FIXME Obvious race | ||||
|         d=$local_path.md_werc/comments/$d/ | ||||
| 
 | ||||
|         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 | ||||
|     } | ||||
| 
 | ||||
| } | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Uriel
						Uriel