Skip to content
Browse files

rename user module to admin module

  • Loading branch information...
1 parent c854ebb commit d438e5bef943eebd6f03430e46ac0f48a5cdbf40 Austin Seipp committed
Showing with 14 additions and 14 deletions.
  1. +1 −1 opaque.opack
  2. +11 −11 src/{user.opa → admin.opa}
  3. +2 −2 src/main.opa
View
2 opaque.opack
@@ -14,5 +14,5 @@ shjs.opp
src/bsl/shjs.opa
# code
-src/user.opa
+src/admin.opa
src/main.opa
View
22 src/user.opa → src/admin.opa
@@ -1,16 +1,16 @@
-package opaque.user
+package opaque.admin
import widgets.loginbox
// User types and user database
-type User.user = { passwd: string }
-type User.status = { loggedin: string } / { notloggedin }
-type User.info = UserContext.t(User.status)
+type Admin.user = { passwd: string }
+type Admin.status = { loggedin: string } / { notloggedin }
+type Admin.info = UserContext.t(Admin.status)
-db /users : stringmap(User.user)
+db /users : stringmap(Admin.user)
-User = {{
+Admin = {{
- @private state = UserContext.make({ notloggedin } : User.status)
+ @private state = UserContext.make({ notloggedin } : Admin.status)
/* Get the current user status - 'logged in, or not' */
get_status() = UserContext.execute((a -> a), state)
@@ -21,7 +21,7 @@ User = {{
/* Main login page */
mainpage() =
- (t, p) = if is_logged_in() then ("User page", userpage()) else ("Login page", loginbox())
+ (t, p) = if is_logged_in() then ("User page", adminpage()) else ("Login page", loginbox())
Resource.html(t, p)
/* Login box and login check */
@@ -34,7 +34,7 @@ User = {{
| _ -> void
Client.reload()
- userpage() =
+ adminpage() =
<h3><a onclick={_ -> logout()}>Logout</a></h3>
/* Logout */
@@ -47,11 +47,11 @@ User = {{
match ?/users["admin"] with
| {none} -> // NOTE: remove when done
pass = Random.string(8)
- admin : User.user = { passwd = Crypto.Hash.sha2(pass) }
+ admin : Admin.user = { passwd = Crypto.Hash.sha2(pass) }
do Debug.jlog("Creating admin user, password is: '" ^ pass ^ "'")
/users["admin"] <- admin
| _ -> void // NOTE: remove when done
}}
// make sure we create the admin user
-do User.init_admin_user()
+do Admin.init_admin_user()
View
4 src/main.opa
@@ -1,5 +1,5 @@
package opaque.main
-import opaque.user
+import opaque.admin
import opaque.native
import opaque.mathjax
import opaque.shjs
@@ -41,7 +41,7 @@ mainpage() = Resource.styled_page("Opaque blog - Main page", ["res/sh_nedit.min.
start =
| {path = [] ... } -> mainpage()
- | {path = ["admin" | _] ...} -> User.mainpage()
+ | {path = ["admin" | _] ...} -> Admin.mainpage()
| {path = _ ...} -> mainpage()
server = Server.of_bundle([@static_resource_directory("res")])

0 comments on commit d438e5b

Please sign in to comment.
Something went wrong with that request. Please try again.