-
-
Notifications
You must be signed in to change notification settings - Fork 172
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #64 from mc0814/master
add login captcha
- Loading branch information
Showing
20 changed files
with
1,447 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package cache | ||
|
||
import "time" | ||
|
||
type Captcha interface { | ||
Get(key string) (interface{}, bool) | ||
Set(key string, value interface{}, ttl time.Duration) | ||
Delete(key string) | ||
IsChecked(key string) bool | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package cache | ||
|
||
import "time" | ||
|
||
type DingtalkAccessToken interface { | ||
Get(key string) (string, bool) | ||
Set(key string, value string, ttl time.Duration) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package cache | ||
|
||
import ( | ||
"github.com/zhenorzz/goploy/config" | ||
"github.com/zhenorzz/goploy/internal/cache/memory" | ||
) | ||
|
||
const MemoryCache = "memory" | ||
|
||
var cacheType = config.Toml.Cache.Type | ||
|
||
func GetUserCache() User { | ||
switch cacheType { | ||
case MemoryCache: | ||
return memory.GetUserCache() | ||
default: | ||
return memory.GetUserCache() | ||
} | ||
} | ||
|
||
func GetCaptchaCache() Captcha { | ||
switch cacheType { | ||
case MemoryCache: | ||
return memory.GetCaptchaCache() | ||
default: | ||
return memory.GetCaptchaCache() | ||
} | ||
} | ||
|
||
func GetDingTalkAccessTokenCache() DingtalkAccessToken { | ||
switch cacheType { | ||
case MemoryCache: | ||
return memory.GetDingTalkAccessTokenCache() | ||
default: | ||
return memory.GetDingTalkAccessTokenCache() | ||
} | ||
} |
Oops, something went wrong.