mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
Add github.com/dchest/captcha imports.
This commit is contained in:
parent
de67ee9014
commit
a1851c2b78
1
go.mod
1
go.mod
@ -9,6 +9,7 @@ require (
|
||||
github.com/baiyubin/aliyun-sts-go-sdk v0.0.0-20180326062324-cfa1a18b161f // indirect
|
||||
github.com/casbin/casbin/v2 v2.23.4
|
||||
github.com/casbin/xorm-adapter/v2 v2.2.0
|
||||
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
github.com/go-sql-driver/mysql v1.5.0
|
||||
github.com/google/uuid v1.2.0
|
||||
|
2
go.sum
2
go.sum
@ -47,6 +47,8 @@ github.com/cupcake/rdb v0.0.0-20161107195141-43ba34106c76/go.mod h1:vYwsqCOLxGii
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f h1:q/DpyjJjZs94bziQ7YkBmIlpqbVP7yw179rnzoNVX1M=
|
||||
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f/go.mod h1:QGrK8vMWWHQYQ3QU9bw9Y9OPNfxccGzfb41qjvVeXtY=
|
||||
github.com/denisenkom/go-mssqldb v0.0.0-20200428022330-06a60b6afbbc/go.mod h1:xbL0rPBG9cCiLr28tMa8zpbdarY27NDyej4t/EjAShU=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible h1:7qlOGliEKZXTDg6OTjfoBKDXWrumCAMpl/TFQ4/5kLM=
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
|
||||
|
26
object/captcha.go
Normal file
26
object/captcha.go
Normal file
@ -0,0 +1,26 @@
|
||||
package object
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
|
||||
"github.com/dchest/captcha"
|
||||
)
|
||||
|
||||
func GetCaptcha() (string, []byte) {
|
||||
id := captcha.NewLen(5)
|
||||
|
||||
var buffer bytes.Buffer
|
||||
|
||||
err := captcha.WriteImage(&buffer, id, 200, 80)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return id, buffer.Bytes()
|
||||
}
|
||||
|
||||
func VerifyCaptcha(id string, digits string) bool {
|
||||
res := captcha.VerifyString(id, digits)
|
||||
|
||||
return res
|
||||
}
|
@ -92,7 +92,3 @@ func CheckUserLogin(organization string, username string, password string) (*Use
|
||||
|
||||
return user, ""
|
||||
}
|
||||
|
||||
func (user *User) GetId() string {
|
||||
return fmt.Sprintf("%s/%s", user.Owner, user.Name)
|
||||
}
|
||||
|
@ -93,32 +93,28 @@ export const CropperDiv = (props) => {
|
||||
[<Button block type="primary" onClick={handleOk}>{i18next.t("user:Set new profile picture")}</Button>]
|
||||
}
|
||||
>
|
||||
<Col>
|
||||
<Row>
|
||||
<Col style={{margin: "0px auto 40px auto", width: 1000, height: 300}}>
|
||||
<Row style={{width: "100%", marginBottom: "20px"}}>
|
||||
<input style={{display: "none"}} name="fileupload" type="file" onChange={onChange}/>
|
||||
<Button block onClick={selectFile}>{i18next.t("user:Select a photo...")}</Button>
|
||||
</Row>
|
||||
<Cropper
|
||||
style={{height: "100%"}}
|
||||
initialAspectRatio={1}
|
||||
preview=".img-preview"
|
||||
src={image}
|
||||
viewMode={1}
|
||||
guides={true}
|
||||
minCropBoxHeight={10}
|
||||
minCropBoxWidth={10}
|
||||
background={false}
|
||||
responsive={true}
|
||||
autoCropArea={1}
|
||||
checkOrientation={false}
|
||||
onInitialized={(instance) => {
|
||||
setCropper(instance);
|
||||
}}
|
||||
/>
|
||||
</Col>
|
||||
<Col style={{margin: "0px auto 40px auto", width: 1000, height: 300}}>
|
||||
<Row style={{width: "100%", marginBottom: "20px"}}>
|
||||
<input style={{display: "none"}} name="fileupload" type="file" onChange={onChange}/>
|
||||
<Button block onClick={selectFile}>{i18next.t("user:Select a photo...")}</Button>
|
||||
</Row>
|
||||
<Cropper
|
||||
style={{height: "100%"}}
|
||||
initialAspectRatio={1}
|
||||
preview=".img-preview"
|
||||
src={image}
|
||||
viewMode={1}
|
||||
guides={true}
|
||||
minCropBoxHeight={10}
|
||||
minCropBoxWidth={10}
|
||||
background={false}
|
||||
responsive={true}
|
||||
autoCropArea={1}
|
||||
checkOrientation={false}
|
||||
onInitialized={(instance) => {
|
||||
setCropper(instance);
|
||||
}}
|
||||
/>
|
||||
</Col>
|
||||
</Modal>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user