Skip to content

Commit

Permalink
chore: remove basic auth (#1255)
Browse files Browse the repository at this point in the history
  • Loading branch information
JeevaRamu0104 authored Sep 2, 2024
1 parent b767afc commit d8b105c
Show file tree
Hide file tree
Showing 36 changed files with 39 additions and 879 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-stable-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@ jobs:
with:
name: release-notes.md
path: release-notes.md
if-no-files-found: error
if-no-files-found: error
1 change: 0 additions & 1 deletion config/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ global_search=false
dispute_analytics=false
configure_pmts=false
branding=false
totp=false
live_users_counter=false
granularity=false
custom_webhook_headers=false
Expand Down
15 changes: 0 additions & 15 deletions src/context/AuthInfoProvider.res
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,6 @@ let make = (~children) => {
switch newAuthStatus {
| LoggedIn(info) =>
switch info {
| BasicAuth(basicInfo) =>
switch basicInfo.token {
| Some(token) =>
if !(token->LogicUtils.isEmptyString) {
setAuth(_ => newAuthStatus)
BasicAuthUtils.setBasicAuthResToStorage(basicInfo)
} else {
setAuth(_ => LoggedOut)
CommonAuthUtils.clearLocalStorage()
}
| None => {
setAuth(_ => LoggedOut)
CommonAuthUtils.clearLocalStorage()
}
}
| Auth(totpInfo) =>
if totpInfo.token->Option.isSome {
setAuth(_ => newAuthStatus)
Expand Down
8 changes: 3 additions & 5 deletions src/context/TokenContextProvider.res
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ type tokenContextObjectType = {
setToken: (option<string> => option<string>) => unit,
tokenDetailsDict: Dict.t<JSON.t>,
setTokenDetailsDict: (Dict.t<JSON.t> => Dict.t<JSON.t>) => unit,
parentAuthInfo: option<BasicAuthTypes.basicAuthInfo>,
parentAuthInfo: option<AuthProviderTypes.authInfo>,
}

let defaultTokenObj = {
token: None,
setToken: defaultTokenSetter,
tokenDetailsDict: Dict.make(),
setTokenDetailsDict: defaultDictSetter,
parentAuthInfo: Some(BasicAuthUtils.getBasicAuthInfo(JSON.Encode.object(Dict.make()))),
parentAuthInfo: Some(AuthUtils.getAuthInfo(JSON.Encode.object(Dict.make()))),
}

let tokenContext = React.createContext(defaultTokenObj)
Expand All @@ -31,9 +31,7 @@ let make = (~children) => {

let tokenContextObjext = React.useMemo(() => {
let parentAuthInfo = Some(
BasicAuthUtils.getBasicAuthInfo(
tokenDetailsDict->LogicUtils.getJsonObjectFromDict("tokenDict"),
),
AuthUtils.getAuthInfo(tokenDetailsDict->LogicUtils.getJsonObjectFromDict("tokenDict")),
)

{
Expand Down
3 changes: 1 addition & 2 deletions src/context/UserPrefContext.res
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ let make = (~children) => {
let username = switch authStatus {
| LoggedIn(authType) =>
switch authType {
| BasicAuth(basicAuthInfo) => basicAuthInfo.name->Option.getOr("")
| _ => ""
| Auth(_) => ""
}
| _ => ""
}
Expand Down
91 changes: 0 additions & 91 deletions src/entryPoints/AcceptInvite.res

This file was deleted.

6 changes: 3 additions & 3 deletions src/entryPoints/AuthModule/AuthModuleHooks.res
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ let useAuthMethods = (): authMethodProps => {
| None => false
}
let emailFeatureFlagEnable = featureFlagValues.email
let isTotpFeatureDisable = featureFlagValues.totp
// let isTotpFeatureDisable = featureFlagValues.totp

let isLiveMode = featureFlagValues.isLiveMode

Expand All @@ -108,10 +108,10 @@ let useAuthMethods = (): authMethodProps => {
} else if isSingUpAllowedinPassword {
// Singup is allowed if email feature flag and allow_signup in the passowrd method is true
(true, PASSWORD)
} else if !isTotpFeatureDisable && emailFeatureFlagEnable {
} else if emailFeatureFlagEnable {
// Singup is allowed if totp feature is disable and email feature is enabled
(true, MAGIC_LINK)
} else if !isTotpFeatureDisable {
} else if !isLiveMode {
// Singup is allowed if totp feature is disable
(true, PASSWORD)
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/entryPoints/AuthModule/AuthProviderTypes.res
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ type preLoginType = {

type authInfo = {token: option<string>}

type authType = BasicAuth(BasicAuthTypes.basicAuthInfo) | Auth(authInfo)
type authType = Auth(authInfo)

type authStatus =
| LoggedOut
Expand Down
Loading

0 comments on commit d8b105c

Please sign in to comment.