Documentation
¶
Index ¶
- Constants
- Variables
- func CreateOTPKey(acct string) (*otp.Key, error)
- func DefaultLogWriter(out io.Writer) zerolog.ConsoleWriter
- func FullURL(page string) string
- func FullURLWithCheck(page string) (string, error)
- func Init(ctx context.Context) error
- func IsValidPage(page string) bool
- func RandName() string
- func RandStr(size int, chars string) string
- func RunSome(tasks ...string) error
- func URLPath(page string) string
- func URLPathWithCheck(page string) (string, error)
- func URLPathWithPrefix(prefix, page string) string
- func ValidateOTP(code, secret string) bool
- type TelegramAuthConfig
Constants ¶
View Source
const ( AlphaLower = "abcdefghijklmnopqrstuvwxyz" AlphaUpper = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" Alpha = AlphaLower + AlphaUpper Digits = "0123456789" Symbols = "!@#$%^&*()-_=+[]{};:'\",.<>/?\\|`~" AlNum = Alpha + Digits AlNumSym = AlNum + Symbols )
View Source
const ( // 登入相關 LoginSelectPage = "login" LogoutPage = "logout" GoogleCallbackPage = "auth/google" FacebookCallbackPage = "auth/facebook" LineCallbackPage = "auth/line" TelegramCallbackPage = "auth/telegram" TOTPPage = "auth/totp" // 驗證 TOTP // 無需登入的頁面 OrgDetailPage = "org/detail" // 罷團資訊 // 所有人都能用的功能 DashboardPage = "dashboard" // 首頁 Enable2FAStep1Page = "2fa/enable/step1" // 掃 QR code Enable2FAStep2Page = "2fa/enable/step2" // 確認驗證碼 Reset2FAStep1Page = "2fa/reset/step1" // 掃 QR code // 不同角色看到的內容會不同的功能 ViewMyLogsPage = "logs/mine" ViewOrgLogsPage = "logs/all" // 民眾專用的功能 UsrScheduleListPage = "usr/schedule/list" // 列出所有可預約的項目 UsrAppointmentMakePage = "usr/appointment/make" // 預約 UsrAppointmentListPage = "usr/appointment/list" // 列出自己的所有預約 UsrAppointmentDetailPage = "usr/appointment/detail" // 預約詳細資料 UsrAppointmentDeletePage = "usr/appointment/delete" // 取消預約 (限未成立的預約) UsrReceiptCreatePage = "usr/receipt/create" // 產生簽收條碼 UsrReceiptViewPage = "usr/receipt/view" // 查看簽收條碼 // 志工用的功能 VolScheduleListPage = "vol/schedule/list" // 列出所有可預約的項目 VolScheduleNewPage = "vol/schedule/new" // 新增可預約的項目 VolScheduleDisablePage = "vol/schedule/disable" // 停用可預約的項目 VolAppointmentListPage = "vol/appointment/list" // 列出跟自己有關的所有預約 VolAppointmentDetailPage = "vol/appointment/detail" // 預約詳細資料 VolAppointmentDeletePage = "vol/appointment/delete" // 取消預約 VolAppointmentPubNotePage = "vol/appointment/note" // 編輯預約公開備註 VolAppointmentSecNotePage = "vol/appointment/secret" // 編輯預約秘密備註 VolAppointmentContactPage = "vol/appointment/contact" // 聯絡中 VolAppointmentNotMatchPage = "vol/appointment/not-match" // 移交幹部 VolAppointmentConfirmPage = "vol/appointment/confirm" // 確認預約 VolAppointmentMissedPage = "vol/appointment/missed" // 錯過預約 VolReceiptFormPage = "vol/receipt/form" // 簽收頁面 VolReceiptCreatePage = "vol/receipt/create" // 產生簽收條碼 VolReceiptSignPage = "vol/receipt/sign" // 完成簽收 // 幹部用的功能 MgrScheduleListPage = "mgr/schedule/list" // 列出所有可預約的項目 MgrScheduleDisablePage = "mgr/schedule/disable" // 停用可預約的項目 MgrMemberListPage = "mgr/member/list" // 列出所有成員 MgrAppointmentListPage = "mgr/appointment/list" // 預約詳細資料 MgrAppointmentStatusPage = "mgr/appointment/status" // 修改預約狀態 MgrAppointmentDetailPage = "mgr/appointment/detail" // 預約詳細資料 MgrAppointmentPairSelectPage = "mgr/appointment/pair/select" // 選擇要重新配對的行程 MgrAppointmentPairPage = "mgr/appointment/pair" // 重新配對預約 MgrEditMemberNotePage = "mgr/member/note/edit" // 編輯成員公開備註 MgrEditMemberSecretPage = "mgr/member/secret/edit" // 編輯成員秘密備註 MgrGrantRolePage = "mgr/role/grant" // 授予角色 MgrRevokeRolePage = "mgr/role/revoke" // 撤銷角色 // 只在 HTML 模式出現的位址,如錯誤頁面 VolNewScheduleFormPage = "vol/schedule/form" )
path of pages
View Source
const DBConfig = "db"
View Source
const URLConfig = "url"
View Source
const VarsConfig = "vars"
Variables ¶
View Source
var ( GoogleOauth *oauth2.Config FacebookOauth *oauth2.Config LineOauth *oauth2.Config TelegramAuth *TelegramAuthConfig )
View Source
var ( BaseURL string BaseURLPath string )
View Source
var DB *gorm.DB
View Source
var SessionStore sessions.Store
View Source
var TZ = time.FixedZone("TW", 8*3600)
Functions ¶
func DefaultLogWriter ¶
func DefaultLogWriter(out io.Writer) zerolog.ConsoleWriter
func FullURLWithCheck ¶
func IsValidPage ¶
func URLPathWithCheck ¶
func URLPathWithPrefix ¶
func ValidateOTP ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.