From 65bf3a5a5f00b40d3f219a469cea1eaa86e1aa95 Mon Sep 17 00:00:00 2001 From: Colin Okay Date: Mon, 28 Feb 2022 12:50:26 -0600 Subject: recording contributor handle --- src/lib.lisp | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'src/lib.lisp') diff --git a/src/lib.lisp b/src/lib.lisp index fb2217b..3df4006 100644 --- a/src/lib.lisp +++ b/src/lib.lisp @@ -60,6 +60,9 @@ (setf (getf *config* :api-token) newval)) (defun get-shell () (getf *config* :shell)) +(defun contributor-handle () (getf *config* :handle)) +(defun (setf contributor-handle) (newval) + (setf (getf *config* :handle) newval)) (defun config-file () (merge-pathnames ".config/oneliners.config" (user-homedir-pathname))) @@ -363,9 +366,23 @@ the directories that appear in the value of that variable." :body (jonathan:to-json (list :password pass :handle user)) :content-type "application/json") (api:post--access)))) - (setf (api-token) (getf response :token)) + (setf (api-token) (getf response :token) + (contributor-handle) handle) (write-config-to-disk) - (format t "Access token written to ~a~%" (config-file)))) + (format t "Access token written to ~a~%You may now make contributions to the wiki!.~%" + (config-file)))) + +(defun change-pw (current new repeated) + (unless (equal new repeated) + (error "The new password doesn't match the repeated value. Double check.")) + (ensure-config) + (api:request-with + (:host (host)) + (api:put--contributor-who-password (contributor-handle) + :token (api-token) + :value new + :repeated new + :current current))) (defparameter +agree-to-the-unlicense+ "By creating this contributor account, I agree that my contributions @@ -394,6 +411,7 @@ the directories that appear in the value of that variable." (api:post--invite-redeem-code token) (format t "Account made for ~a. You may log in now~%" name)))) +;;TODO: check this .. shouldnt access be a username??? (defun revoke-access () (ensure-config) (api:request-with -- cgit v1.2.3