-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. Add: Administrator email configuration
2. Add: Dockerfile 3. Optimize: email template 4. fix: Users can still log in through email even if disabled 5. Optimize: App avatar Signed-off-by: 孙林耀 <[email protected]>
- Loading branch information
1 parent
9a2a1a4
commit 9d9ab08
Showing
32 changed files
with
1,260 additions
and
484 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,10 @@ PROTOC_OPTS := $(PROTOC_OPTS) -I./api | |
PROTOC_OPTS := $(PROTOC_OPTS) --gogo_out=plugins=grpc,module=${GOMODULENAME}:gogo_out | ||
PROTOC_OPTS := $(PROTOC_OPTS) --grpc-gateway_out=${GOGO_OPT}:gogo_out | ||
|
||
BASE_PATH = /idas | ||
|
||
IMAGE_SUFFIX := | ||
|
||
# golangci-lint only supports linux, darwin and windows platforms on i386/amd64. | ||
# windows isn't included here because of the path separator being different. | ||
ifeq ($(GOHOSTOS),$(filter $(GOHOSTOS),linux darwin)) | ||
|
@@ -52,6 +56,24 @@ endif | |
|
||
pkgs = ./... | ||
|
||
GitCommit = $(shell git rev-parse --short HEAD) | ||
BuildDate = $(shell date +%Y-%m-%dT%H:%M:%S%Z) | ||
GoVersion = $(shell go version|awk '{print $$3}') | ||
Platform = $(shell go version|awk '{print $$4}') | ||
Version ?= $(shell cat version) | ||
LDFlags := -w -s -X 'lampao/pkg/utils/version.GitCommit=$(GitCommit)' | ||
LDFlags += -X 'lampao/pkg/utils/version.BuildDate=$(BuildDate)' | ||
LDFlags += -X 'lampao/pkg/utils/version.GoVersion=$(GoVersion)' | ||
LDFlags += -X 'lampao/pkg/utils/version.Platform=$(Platform)' | ||
LDFlags += -X 'lampao/pkg/utils/version.Version=$(Version).$(GitCommit)' | ||
|
||
info: | ||
@echo "Version: $(Version)" | ||
@echo "Git commit: $(GitCommit)" | ||
@echo "Build date: $(BuildDate)" | ||
@echo "Platform: $(Platform)" | ||
@echo "Go version: $(GoVersion)" | ||
|
||
.PHONY: all | ||
all: common-check_license protos common-lint test idas | ||
|
||
|
@@ -99,7 +121,7 @@ common-check_license: | |
|
||
.PHONY: idas | ||
idas: | ||
CGO_ENABLED=0 go build -ldflags="-s -w" -o dist/idas ./cmd/idas | ||
CGO_ENABLED=0 go build -ldflags="-s -w $(LDFlags)" -o dist/idas ./cmd/idas | ||
|
||
.PHONY: common-lint | ||
common-lint: $(GOLANGCI_LINT) | ||
|
@@ -128,5 +150,23 @@ openapi: | |
|
||
.PHONY: ui | ||
ui: | ||
cd public && yarn install && yarn run build --basePath='/idas/admin/' --apiPath='/idas/' | ||
rm -rf pkg/transport/static && cp -r public/dist pkg/transport/static | ||
rm -rf public/src/.umi-production/ | ||
cd public && yarn install && yarn run build --basePath='$(BASE_PATH)/admin/' --apiPath='$(BASE_PATH)/' | ||
rm -rf pkg/transport/static && cp -r public/dist pkg/transport/static | ||
|
||
|
||
.PHONY: ui-vpn | ||
ui-vpn: | ||
rm -rf public/src/.umi-production/ | ||
cd public && yarn install && yarn run build --basePath='/vpn/idas/admin/' --apiPath='/vpn/idas/' | ||
rm -rf pkg/transport/static && cp -r public/dist pkg/transport/static | ||
|
||
.PHONY: idas-vpn | ||
idas-vpn: | ||
CGO_ENABLED=0 go build -ldflags="-s -w $(LDFlags)" -o dist/idas-vpn ./cmd/idas | ||
|
||
.PHONY: docker-image | ||
docker-image: | ||
cp dist/idas docker/ | ||
if [ ! -f docker/GeoLite2-City.mmdb ];then wget -O docker/GeoLite2-City.mmdb.gz -c "https://cdn.jsdelivr.net/npm/[email protected]/GeoLite2-City.mmdb.gz";gunzip docker/GeoLite2-City.mmdb.gz; fi | ||
cd docker && docker build -t wiseasy/idas:v$(Version).$(GitCommit)$(IMAGE_SUFFIX) . |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,2 @@ | ||
Dockerfile | ||
.dockerignore |
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,7 @@ | ||
FROM alpine | ||
|
||
WORKDIR / | ||
ADD . / | ||
EXPOSE 8081 | ||
|
||
ENTRYPOINT ["/idas"] |
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,48 @@ | ||
<!-- | ||
~ Copyright © 2022. | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<html lang="en"> | ||
|
||
<body style="margin: 0 auto; font-family: Helvetica, sans-serif; font-size: 16px; color: #333333; text-align: left; max-width: 550px;"> | ||
<div> | ||
<div style="margin: 50px 0 15px;"> | ||
Hello, {{ .user.Username }} | ||
</div> | ||
<div>Please reset your password to activate your user,<a href="{{.httpExternalURL}}admin/account/activateAccount?userId={{ .user.Id }}&token={{ .token.Id }}&username={{ .user.Username }}" | ||
rel="noopener noreferrer"> | ||
Click here | ||
</a>Or copy the following connection to the browser and open it to enter the password reset page. | ||
</div> | ||
{{.httpExternalURL}}admin/account/activateAccount?userId={{ .user.Id }}&token={{ .token.Id }}&username={{ .user.Username }} | ||
<div style="margin-bottom: 50px;"> | ||
|
||
</div> | ||
<div> | ||
If you did not make this request, your email address may have been entered incorrectly, and you can safely ignore this email. | ||
</div> | ||
<div style="margin: 15px 0;"> | ||
If you have any questions, you can | ||
<a href="mailto:{{ .adminEmail }}" | ||
style="color:#007bff; text-decoration: none !important;" | ||
target="_blank" | ||
rel="noopener noreferrer">Contact administrator</a>. | ||
</div> | ||
<div style="color:#828282; margin: 15px 0;"> | ||
- Wiseasy Ops Team | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
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,48 @@ | ||
<!-- | ||
~ Copyright © 2022. | ||
~ | ||
~ Licensed under the Apache License, Version 2.0 (the "License"); | ||
~ you may not use this file except in compliance with the License. | ||
~ You may obtain a copy of the License at | ||
~ | ||
~ http://www.apache.org/licenses/LICENSE-2.0 | ||
~ | ||
~ Unless required by applicable law or agreed to in writing, software | ||
~ distributed under the License is distributed on an "AS IS" BASIS, | ||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
~ See the License for the specific language governing permissions and | ||
~ limitations under the License. | ||
--> | ||
|
||
<html lang="en"> | ||
|
||
<body style="margin: 0 auto; font-family: Helvetica, sans-serif; font-size: 16px; color: #333333; text-align: left; max-width: 550px;"> | ||
<div> | ||
<div style="margin: 50px 0 15px;"> | ||
Hello, <strong>{{ .user.Username }}</strong> | ||
</div> | ||
<div>You are resetting your password, please<a href="{{.httpExternalURL}}admin/account/resetPassword?userId={{ .user.Id }}&token={{ .token.Id }}&username={{ .user.Username }}" | ||
rel="noopener noreferrer"> | ||
Click here | ||
</a>Or copy the following connection to the browser and open it to enter the password reset page. | ||
</div> | ||
{{.httpExternalURL}}admin/account/resetPassword?userId={{ .user.Id }}&token={{ .token.Id }}&username={{ .user.Username }} | ||
<div style="margin-bottom: 50px;"> | ||
|
||
</div> | ||
<div> | ||
If you did not make this request, your email address may have been entered incorrectly, and you can safely ignore this email. | ||
</div> | ||
<div style="margin: 15px 0;"> | ||
If you have any questions, you can | ||
<a href="mailto:{{ .adminEmail }}" | ||
style="color:#007bff; text-decoration: none !important;" | ||
target="_blank" | ||
rel="noopener noreferrer">Contact administrator</a>. | ||
</div> | ||
<div style="color:#828282; margin: 15px 0;"> | ||
- Wiseasy Ops Team | ||
</div> | ||
</div> | ||
</body> | ||
</html> |
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,12 @@ | ||
<html lang="en"> | ||
|
||
<body style="margin: 0 auto; font-family: Helvetica, sans-serif; font-size: 16px; color: #333333; text-align: left; max-width: 550px;"> | ||
<div> | ||
<div style="margin: 50px 0 15px;"> | ||
Hello, <strong>{{ .user.Username }}</strong> | ||
</div> | ||
<div>You are currently logging in {{ .siteTitle }}</strong></div> | ||
<div style="margin: 15px 0;">Your One-time password is: <b>{{.code}}</b></div> | ||
</div> | ||
</body> | ||
</html> |
Oops, something went wrong.