]> matita.cs.unibo.it Git - helm.git/blobdiff - matitaB/matita/matitaAuthentication.ml
When the user db is not found, matitaweb now creates a new one.
[helm.git] / matitaB / matita / matitaAuthentication.ml
index ad6bec47d6915bad556bc737660a4e723ce7e49b..d51eb2e4fae4a4ff7c0d2b0bb9ea508f049a7b3c 100644 (file)
@@ -104,9 +104,12 @@ let serialize () =
 ;;
 
 let deserialize () =
-  let utbl_ch = open_in (config_path () ^ "/usertable.dump") in
-  user_tbl := Marshal.from_channel utbl_ch;
-  close_in utbl_ch;
+  (try
+    let utbl_ch = open_in (config_path () ^ "/usertable.dump") in
+    user_tbl := Marshal.from_channel utbl_ch;
+    close_in utbl_ch;
+  with
+    | Sys_error _ -> user_tbl := []);
   (* old_sessions are now invalid *)
   session_tbl := [];
 ;;
@@ -120,3 +123,10 @@ let add_user uid pw =
     user_tbl := (uid,(pw,None))::!user_tbl;
     serialize ()
 ;;
+
+let reset () =
+  user_tbl := [];
+  session_tbl := [];
+  MatitaFilesystem.reset_lib ();
+  serialize ();
+;;