Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
bb86482b
Commit
bb86482b
authored
Aug 29, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: tweak setting name
parent
f0abd792
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
290 additions
and
288 deletions
+290
-288
apidocs.swagger.yaml
docs/apidocs.swagger.yaml
+4
-4
workspace_setting_service.proto
proto/api/v1/workspace_setting_service.proto
+4
-4
workspace_setting_service.pb.go
proto/gen/api/v1/workspace_setting_service.pb.go
+140
-139
workspace_setting.pb.go
proto/gen/store/workspace_setting.pb.go
+116
-115
workspace_setting.proto
proto/store/workspace_setting.proto
+4
-4
auth_service.go
server/router/api/v1/auth_service.go
+3
-3
workspace_setting_service.go
server/router/api/v1/workspace_setting_service.go
+10
-10
WorkspaceSection.tsx
web/src/components/Settings/WorkspaceSection.tsx
+6
-6
SignIn.tsx
web/src/pages/SignIn.tsx
+2
-2
SignUp.tsx
web/src/pages/SignUp.tsx
+1
-1
No files found.
docs/apidocs.swagger.yaml
View file @
bb86482b
...
@@ -2045,12 +2045,12 @@ definitions:
...
@@ -2045,12 +2045,12 @@ definitions:
apiv1WorkspaceGeneralSetting
:
apiv1WorkspaceGeneralSetting
:
type
:
object
type
:
object
properties
:
properties
:
disallow
Signup
:
disallow
UserRegistration
:
type
:
boolean
type
:
boolean
description
:
disallow_
signup disallows signup for new users
.
description
:
disallow_
user_registration disallows user registration
.
disallowPassword
Signin
:
disallowPassword
Auth
:
type
:
boolean
type
:
boolean
description
:
disallow_password_
signin disallows user to sign in with password. Except for the admins
.
description
:
disallow_password_
auth disallows password authentication
.
additionalScript
:
additionalScript
:
type
:
string
type
:
string
description
:
additional_script is the additional script.
description
:
additional_script is the additional script.
...
...
proto/api/v1/workspace_setting_service.proto
View file @
bb86482b
...
@@ -36,10 +36,10 @@ message WorkspaceSetting {
...
@@ -36,10 +36,10 @@ message WorkspaceSetting {
}
}
message
WorkspaceGeneralSetting
{
message
WorkspaceGeneralSetting
{
// disallow_
signup disallows signup for new users
.
// disallow_
user_registration disallows user registration
.
bool
disallow_
signup
=
1
;
bool
disallow_
user_registration
=
1
;
// disallow_password_
signin disallows user to sign in with password. Except for the admins
.
// disallow_password_
auth disallows password authentication
.
bool
disallow_password_
signin
=
2
;
bool
disallow_password_
auth
=
2
;
// additional_script is the additional script.
// additional_script is the additional script.
string
additional_script
=
3
;
string
additional_script
=
3
;
// additional_style is the additional style.
// additional_style is the additional style.
...
...
proto/gen/api/v1/workspace_setting_service.pb.go
View file @
bb86482b
This diff is collapsed.
Click to expand it.
proto/gen/store/workspace_setting.pb.go
View file @
bb86482b
This diff is collapsed.
Click to expand it.
proto/store/workspace_setting.proto
View file @
bb86482b
...
@@ -31,10 +31,10 @@ message WorkspaceBasicSetting {
...
@@ -31,10 +31,10 @@ message WorkspaceBasicSetting {
}
}
message
WorkspaceGeneralSetting
{
message
WorkspaceGeneralSetting
{
// disallow_
signup disallows signup for new users
.
// disallow_
user_registration disallows user registration
.
bool
disallow_
signup
=
1
;
bool
disallow_
user_registration
=
1
;
// disallow_password_
signin disallows user to sign in with password. Except for the admins
.
// disallow_password_
auth disallows password authentication
.
bool
disallow_password_
signin
=
2
;
bool
disallow_password_
auth
=
2
;
// additional_script is the additional script.
// additional_script is the additional script.
string
additional_script
=
3
;
string
additional_script
=
3
;
// additional_style is the additional style.
// additional_style is the additional style.
...
...
server/router/api/v1/auth_service.go
View file @
bb86482b
...
@@ -62,8 +62,8 @@ func (s *APIV1Service) SignIn(ctx context.Context, request *v1pb.SignInRequest)
...
@@ -62,8 +62,8 @@ func (s *APIV1Service) SignIn(ctx context.Context, request *v1pb.SignInRequest)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
fmt
.
Sprintf
(
"failed to get workspace general setting, err: %s"
,
err
))
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
fmt
.
Sprintf
(
"failed to get workspace general setting, err: %s"
,
err
))
}
}
// Check if the password
sign
in is allowed.
// Check if the password
auth
in is allowed.
if
workspaceGeneralSetting
.
DisallowPassword
Signin
&&
user
.
Role
==
store
.
RoleUser
{
if
workspaceGeneralSetting
.
DisallowPassword
Auth
&&
user
.
Role
==
store
.
RoleUser
{
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"password signin is not allowed"
)
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"password signin is not allowed"
)
}
}
if
user
.
RowStatus
==
store
.
Archived
{
if
user
.
RowStatus
==
store
.
Archived
{
...
@@ -184,7 +184,7 @@ func (s *APIV1Service) SignUp(ctx context.Context, request *v1pb.SignUpRequest)
...
@@ -184,7 +184,7 @@ func (s *APIV1Service) SignUp(ctx context.Context, request *v1pb.SignUpRequest)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
fmt
.
Sprintf
(
"failed to get workspace general setting, err: %s"
,
err
))
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
fmt
.
Sprintf
(
"failed to get workspace general setting, err: %s"
,
err
))
}
}
if
workspaceGeneralSetting
.
Disallow
Signup
{
if
workspaceGeneralSetting
.
Disallow
UserRegistration
{
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"sign up is not allowed"
)
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"sign up is not allowed"
)
}
}
...
...
server/router/api/v1/workspace_setting_service.go
View file @
bb86482b
...
@@ -132,11 +132,11 @@ func convertWorkspaceGeneralSettingFromStore(setting *storepb.WorkspaceGeneralSe
...
@@ -132,11 +132,11 @@ func convertWorkspaceGeneralSettingFromStore(setting *storepb.WorkspaceGeneralSe
return
nil
return
nil
}
}
generalSetting
:=
&
v1pb
.
WorkspaceGeneralSetting
{
generalSetting
:=
&
v1pb
.
WorkspaceGeneralSetting
{
Disallow
Signup
:
setting
.
DisallowSignup
,
Disallow
UserRegistration
:
setting
.
DisallowUserRegistration
,
DisallowPassword
Signin
:
setting
.
DisallowPasswordSignin
,
DisallowPassword
Auth
:
setting
.
DisallowPasswordAuth
,
AdditionalScript
:
setting
.
AdditionalScript
,
AdditionalScript
:
setting
.
AdditionalScript
,
AdditionalStyle
:
setting
.
AdditionalStyle
,
AdditionalStyle
:
setting
.
AdditionalStyle
,
WeekStartDayOffset
:
setting
.
WeekStartDayOffset
,
WeekStartDayOffset
:
setting
.
WeekStartDayOffset
,
}
}
if
setting
.
CustomProfile
!=
nil
{
if
setting
.
CustomProfile
!=
nil
{
generalSetting
.
CustomProfile
=
&
v1pb
.
WorkspaceCustomProfile
{
generalSetting
.
CustomProfile
=
&
v1pb
.
WorkspaceCustomProfile
{
...
@@ -155,11 +155,11 @@ func convertWorkspaceGeneralSettingToStore(setting *v1pb.WorkspaceGeneralSetting
...
@@ -155,11 +155,11 @@ func convertWorkspaceGeneralSettingToStore(setting *v1pb.WorkspaceGeneralSetting
return
nil
return
nil
}
}
generalSetting
:=
&
storepb
.
WorkspaceGeneralSetting
{
generalSetting
:=
&
storepb
.
WorkspaceGeneralSetting
{
Disallow
Signup
:
setting
.
DisallowSignup
,
Disallow
UserRegistration
:
setting
.
DisallowUserRegistration
,
DisallowPassword
Signin
:
setting
.
DisallowPasswordSignin
,
DisallowPassword
Auth
:
setting
.
DisallowPasswordAuth
,
AdditionalScript
:
setting
.
AdditionalScript
,
AdditionalScript
:
setting
.
AdditionalScript
,
AdditionalStyle
:
setting
.
AdditionalStyle
,
AdditionalStyle
:
setting
.
AdditionalStyle
,
WeekStartDayOffset
:
setting
.
WeekStartDayOffset
,
WeekStartDayOffset
:
setting
.
WeekStartDayOffset
,
}
}
if
setting
.
CustomProfile
!=
nil
{
if
setting
.
CustomProfile
!=
nil
{
generalSetting
.
CustomProfile
=
&
storepb
.
WorkspaceCustomProfile
{
generalSetting
.
CustomProfile
=
&
storepb
.
WorkspaceCustomProfile
{
...
...
web/src/components/Settings/WorkspaceSection.tsx
View file @
bb86482b
...
@@ -100,17 +100,17 @@ const WorkspaceSection = () => {
...
@@ -100,17 +100,17 @@ const WorkspaceSection = () => {
</
Link
>
</
Link
>
</
div
>
</
div
>
<
div
className=
"w-full flex flex-row justify-between items-center"
>
<
div
className=
"w-full flex flex-row justify-between items-center"
>
<
span
>
Disallow
signup
</
span
>
<
span
>
Disallow
user registration
</
span
>
<
Switch
<
Switch
checked=
{
workspaceGeneralSetting
.
disallow
Signup
}
checked=
{
workspaceGeneralSetting
.
disallow
UserRegistration
}
onChange=
{
(
event
)
=>
updatePartialSetting
({
disallow
Signup
:
event
.
target
.
checked
})
}
onChange=
{
(
event
)
=>
updatePartialSetting
({
disallow
UserRegistration
:
event
.
target
.
checked
})
}
/>
/>
</
div
>
</
div
>
<
div
className=
"w-full flex flex-row justify-between items-center"
>
<
div
className=
"w-full flex flex-row justify-between items-center"
>
<
span
>
Disallow password
signin
</
span
>
<
span
>
Disallow password
auth
</
span
>
<
Switch
<
Switch
checked=
{
workspaceGeneralSetting
.
disallowPassword
Signin
}
checked=
{
workspaceGeneralSetting
.
disallowPassword
Auth
}
onChange=
{
(
event
)
=>
updatePartialSetting
({
disallowPassword
Signin
:
event
.
target
.
checked
})
}
onChange=
{
(
event
)
=>
updatePartialSetting
({
disallowPassword
Auth
:
event
.
target
.
checked
})
}
/>
/>
</
div
>
</
div
>
<
div
className=
"w-full flex flex-row justify-between items-center"
>
<
div
className=
"w-full flex flex-row justify-between items-center"
>
...
...
web/src/pages/SignIn.tsx
View file @
bb86482b
...
@@ -65,12 +65,12 @@ const SignIn = () => {
...
@@ -65,12 +65,12 @@ const SignIn = () => {
{
workspaceGeneralSetting
.
customProfile
?.
title
||
"Memos"
}
{
workspaceGeneralSetting
.
customProfile
?.
title
||
"Memos"
}
</
p
>
</
p
>
</
div
>
</
div
>
{
!
workspaceGeneralSetting
.
disallowPassword
Signin
?
(
{
!
workspaceGeneralSetting
.
disallowPassword
Auth
?
(
<
PasswordSignInForm
/>
<
PasswordSignInForm
/>
)
:
(
)
:
(
<
p
className=
"w-full text-2xl mt-2 dark:text-gray-500"
>
Password auth is not allowed.
</
p
>
<
p
className=
"w-full text-2xl mt-2 dark:text-gray-500"
>
Password auth is not allowed.
</
p
>
)
}
)
}
{
!
workspaceGeneralSetting
.
disallow
Signup
&&
!
workspaceGeneralSetting
.
disallowPasswordSignin
&&
(
{
!
workspaceGeneralSetting
.
disallow
UserRegistration
&&
!
workspaceGeneralSetting
.
disallowPasswordAuth
&&
(
<
p
className=
"w-full mt-4 text-sm"
>
<
p
className=
"w-full mt-4 text-sm"
>
<
span
className=
"dark:text-gray-500"
>
{
t
(
"auth.sign-up-tip"
)
}
</
span
>
<
span
className=
"dark:text-gray-500"
>
{
t
(
"auth.sign-up-tip"
)
}
</
span
>
<
Link
to=
"/auth/signup"
className=
"cursor-pointer ml-2 text-blue-600 hover:underline"
unstable_viewTransition
>
<
Link
to=
"/auth/signup"
className=
"cursor-pointer ml-2 text-blue-600 hover:underline"
unstable_viewTransition
>
...
...
web/src/pages/SignUp.tsx
View file @
bb86482b
...
@@ -79,7 +79,7 @@ const SignUp = () => {
...
@@ -79,7 +79,7 @@ const SignUp = () => {
{
workspaceGeneralSetting
.
customProfile
?.
title
||
"Memos"
}
{
workspaceGeneralSetting
.
customProfile
?.
title
||
"Memos"
}
</
p
>
</
p
>
</
div
>
</
div
>
{
!
workspaceGeneralSetting
.
disallow
Signup
?
(
{
!
workspaceGeneralSetting
.
disallow
UserRegistration
?
(
<>
<>
<
p
className=
"w-full text-2xl mt-2 dark:text-gray-500"
>
{
t
(
"auth.create-your-account"
)
}
</
p
>
<
p
className=
"w-full text-2xl mt-2 dark:text-gray-500"
>
{
t
(
"auth.create-your-account"
)
}
</
p
>
<
form
className=
"w-full mt-2"
onSubmit=
{
handleFormSubmit
}
>
<
form
className=
"w-full mt-2"
onSubmit=
{
handleFormSubmit
}
>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment