Skip to content

Commit eaceee6

Browse files
yakuteremredipirecepfatihsezginmrtrkmn
authored
New version (#170)
* removed api check on signup * added recaptcha to signup * fixed unrelated email issue (#151) * go-fmt for auth.go * change goroutine email * fix subscription status * update recaptcha * fix signin email conflict * little changes * disabled Recaptcha * updated Readme * update go mod * youtube link (#158) * added type conv. check * added RespondWithEncJSON * changed Decrypt payload * added helper test * refactor logins * update test data * added test suite * add env dev to emails * Refactoring Some Functions (#160) * refactor bankaccount functions * refactor creditcard functions * refactor server functions * refactor note functions * deleted recaptcha func (#159) * TODO about CreateUser fixed (#161) * create user actions moved to the service layer * some user tests introduced (#164) * some user tests introduced Signed-off-by: Ahmet Turkmen <[email protected]> * UUID enhancement (#168) * update mw * fixed token invalidation * added validator to app/user (#169) * fix: add email template * fix: auth confirmation code * fix: update subcription process * fix: add redirect after email confirm * fix: updare subscription * change login logic Co-authored-by: Emre Dipi <[email protected]> Co-authored-by: Recep Alaca <[email protected]> Co-authored-by: Fatih Sezgin <[email protected]> Co-authored-by: Ahmet Türkmen <[email protected]>
1 parent 169b0e3 commit eaceee6

40 files changed

+1468
-744
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,34 @@ I promise all the coffee you have ordered will be spent on this project
2121
</p>
2222

2323
## API Documentation
24-
API documentation available at [Postman Public Directory](https://documenter.getpostman.com/view/3658426/SzYbyHXj)
24+
API documentation available at [Postman Public Directory](https://documenter.getpostman.com/view/3658426/SzYbyHXj)
25+
26+
PassWall has both server and client side encryption. So when creating user to work with Postman you should use already SHA256 encrypted password in JSON or use a Postman Pre-request Script to encrypt json in form.
27+
28+
**Postman Pre-request Script Usage**
29+
While creating a user via Postman, you should send a post request to **/auth/signup** endpoint. In the request use the JSON schema below as **raw body**. Do not change **{{password}}**, it is an environment variable in Postman.
30+
```json
31+
{
32+
"name": "Erhan Yakut",
33+
"email": "[email protected]",
34+
"master_password": "{{password}}"
35+
}
36+
```
37+
38+
Then in Pre-request Script, copy and paste the javascript code below. You should change the password in the code.
39+
```javascript
40+
var newPassword = '123456' // Change this
41+
42+
pm.environment.set('password', newPassword);
43+
44+
var encryptedPassword = CryptoJS.SHA256(pm.environment.get('password')).toString();
45+
46+
pm.environment.set('password',encryptedPassword);
47+
48+
console.log(encryptedPassword);
49+
```
50+
Click on [this link](https://www.youtube.com/watch?v=bFgstpIA3iE&list=PL645jNNONo8TBOBDFRq7SolX_aWCT2Ia9) to visit our Youtube playlist.
51+
2552

2653
## Database support
2754
PassWall works with **PostgreSQL** databases.

cmd/passwall-server/main.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,8 @@ func main() {
2727

2828
s := storage.New(db)
2929

30-
// Migrate database tables
31-
// TODO: Migrate should be in storege.New functions of categories
3230
app.MigrateSystemTables(s)
3331

34-
// Start cron jobs like backup
35-
// app.StartCronJob(s)
36-
3732
srv := &http.Server{
3833
MaxHeaderBytes: 10, // 10 MB
3934
Addr: ":" + cfg.Server.Port,

go.mod

Lines changed: 26 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,41 @@ go 1.14
55
require (
66
github.com/DATA-DOG/go-sqlmock v1.4.1
77
github.com/Luzifer/go-openssl/v4 v4.1.0
8+
github.com/Masterminds/goutils v1.1.1 // indirect
9+
github.com/Masterminds/semver v1.5.0 // indirect
10+
github.com/Masterminds/sprig v2.22.0+incompatible // indirect
811
github.com/dgrijalva/jwt-go v3.2.0+incompatible
912
github.com/didip/tollbooth v4.0.2+incompatible
1013
github.com/go-playground/validator/v10 v10.2.0
1114
github.com/go-test/deep v1.0.6
15+
github.com/google/uuid v1.2.0 // indirect
1216
github.com/gorilla/mux v1.7.4
13-
github.com/heroku/x v0.0.22
14-
github.com/jinzhu/gorm v1.9.12
17+
github.com/huandu/xstrings v1.3.2 // indirect
18+
github.com/imdario/mergo v0.3.12 // indirect
19+
github.com/jaytaylor/html2text v0.0.0-20200412013138-3577fbdbcff7 // indirect
20+
github.com/jinzhu/gorm v1.9.15
21+
github.com/matcornic/hermes v1.2.0
22+
github.com/mattn/go-runewidth v0.0.10 // indirect
23+
github.com/mattn/go-sqlite3 v2.0.1+incompatible // indirect
24+
github.com/mitchellh/copystructure v1.1.1 // indirect
25+
github.com/olekukonko/tablewriter v0.0.5 // indirect
1526
github.com/patrickmn/go-cache v2.1.0+incompatible // indirect
27+
github.com/rivo/uniseg v0.2.0 // indirect
1628
github.com/satori/go.uuid v1.2.0
1729
github.com/sendgrid/rest v2.6.2+incompatible // indirect
1830
github.com/sendgrid/sendgrid-go v3.7.0+incompatible
19-
github.com/spf13/viper v1.6.2
20-
github.com/stretchr/testify v1.5.1
31+
github.com/spf13/viper v1.7.1
32+
github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect
33+
github.com/stretchr/testify v1.6.1
2134
github.com/urfave/negroni v1.0.0
22-
golang.org/x/crypto v0.0.0-20200604202706-70a84ac30bf9
23-
golang.org/x/sys v0.0.0-20200420163511-1957bb5e6d1f // indirect
35+
golang.org/x/crypto v0.0.0-20210314154223-e6e6c4f2bb5b
36+
golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4 // indirect
2437
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
25-
gopkg.in/yaml.v2 v2.2.8
38+
gopkg.in/russross/blackfriday.v2 v2.1.0 // indirect
39+
gopkg.in/yaml.v2 v2.3.0
40+
)
41+
42+
replace (
43+
gopkg.in/russross/blackfriday.v2 v2.0.1 => github.com/russross/blackfriday/v2 v2.0.1
44+
gopkg.in/russross/blackfriday.v2 v2.1.0 => github.com/russross/blackfriday/v2 v2.1.0
2645
)

go.sum

Lines changed: 165 additions & 124 deletions
Large diffs are not rendered by default.

internal/api/api.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
package api
2+
3+
import (
4+
"time"
5+
6+
"github.com/passwall/passwall-server/internal/app"
7+
"github.com/patrickmn/go-cache"
8+
)
9+
10+
var c *cache.Cache
11+
12+
func init() {
13+
c = app.CreateCache(time.Minute*5, time.Minute*10)
14+
}

0 commit comments

Comments
 (0)