Authorization.vue (hoppscotch-2.0.0) | : | Authorization.vue (hoppscotch-2.1.0) | ||
---|---|---|---|---|
skipping to change at line 84 | skipping to change at line 84 | |||
class="px-2" | class="px-2" | |||
@change="authActive = !authActive" | @change="authActive = !authActive" | |||
> | > | |||
{{ $t("state.enabled") }} | {{ $t("state.enabled") }} | |||
</SmartToggle> | </SmartToggle> | |||
<ButtonSecondary | <ButtonSecondary | |||
v-tippy="{ theme: 'tooltip' }" | v-tippy="{ theme: 'tooltip' }" | |||
to="https://docs.hoppscotch.io/features/authorization" | to="https://docs.hoppscotch.io/features/authorization" | |||
blank | blank | |||
:title="$t('app.wiki')" | :title="$t('app.wiki')" | |||
icon="help_outline" | svg="help-circle" | |||
/> | /> | |||
<ButtonSecondary | <ButtonSecondary | |||
v-tippy="{ theme: 'tooltip' }" | v-tippy="{ theme: 'tooltip' }" | |||
:title="$t('action.clear')" | :title="$t('action.clear')" | |||
icon="clear_all" | svg="trash-2" | |||
@click.native="clearContent" | @click.native="clearContent" | |||
/> | /> | |||
</div> | </div> | |||
</div> | </div> | |||
<div | <div | |||
v-if="authType === 'none'" | v-if="authType === 'none'" | |||
class="flex flex-col text-secondaryLight p-4 items-center justify-center" | class="flex flex-col text-secondaryLight p-4 items-center justify-center" | |||
> | > | |||
<img | ||||
:src="`/images/states/${$colorMode.value}/login.svg`" | ||||
loading="lazy" | ||||
class="flex-col my-4 object-contain object-center h-16 w-16 inline-flex" | ||||
/> | ||||
<span class="text-center pb-4"> | <span class="text-center pb-4"> | |||
{{ $t("empty.authorization") }} | {{ $t("empty.authorization") }} | |||
</span> | </span> | |||
<ButtonSecondary | <ButtonSecondary | |||
outline | outline | |||
:label="$t('action.learn_more')" | :label="$t('app.documentation')" | |||
to="https://docs.hoppscotch.io" | to="https://docs.hoppscotch.io" | |||
blank | blank | |||
icon="open_in_new" | svg="external-link" | |||
reverse | reverse | |||
/> | /> | |||
</div> | </div> | |||
<div v-if="authType === 'basic'" class="border-b border-dividerLight flex"> | <div v-if="authType === 'basic'" class="border-b border-dividerLight flex"> | |||
<div class="border-r border-dividerLight w-2/3"> | <div class="border-r border-dividerLight w-2/3"> | |||
<div | <div class="border-b border-dividerLight flex"> | |||
class="divide-x divide-dividerLight border-b border-dividerLight flex" | ||||
> | ||||
<SmartEnvInput | <SmartEnvInput | |||
v-if="EXPERIMENTAL_URL_BAR_ENABLED" | ||||
v-model="basicUsername" | ||||
class="bg-transparent flex flex-1 py-1 px-4" | ||||
:placeholder="$t('authorization.username')" | ||||
/> | ||||
<input | ||||
v-else | ||||
id="http_basic_user" | ||||
v-model="basicUsername" | v-model="basicUsername" | |||
class="bg-transparent flex flex-1 py-2 px-4" | ||||
:placeholder="$t('authorization.username')" | :placeholder="$t('authorization.username')" | |||
name="http_basic_user" | styles="bg-transparent flex flex-1 py-1 px-4" | |||
/> | /> | |||
</div> | </div> | |||
<div | <div class="border-b border-dividerLight flex"> | |||
class="divide-x divide-dividerLight border-b border-dividerLight flex" | ||||
> | ||||
<SmartEnvInput | <SmartEnvInput | |||
v-if="EXPERIMENTAL_URL_BAR_ENABLED" | ||||
v-model="basicPassword" | v-model="basicPassword" | |||
class="bg-transparent flex flex-1 py-1 px-4" | ||||
:placeholder="$t('authorization.password')" | :placeholder="$t('authorization.password')" | |||
styles="bg-transparent flex flex-1 py-1 px-4" | ||||
/> | /> | |||
<input | ||||
v-else | ||||
id="http_basic_passwd" | ||||
v-model="basicPassword" | ||||
class="bg-transparent flex flex-1 py-2 px-4" | ||||
:placeholder="$t('authorization.password')" | ||||
name="http_basic_passwd" | ||||
:type="passwordFieldType" | ||||
/> | ||||
<span> | ||||
<ButtonSecondary | ||||
:icon=" | ||||
passwordFieldType === 'text' ? 'visibility' : 'visibility_off' | ||||
" | ||||
@click.native="switchVisibility" | ||||
/> | ||||
</span> | ||||
</div> | </div> | |||
</div> | </div> | |||
<div | <div | |||
class=" | class=" | |||
bg-primary | bg-primary | |||
h-full | h-full | |||
top-upperTertiaryStickyFold | top-upperTertiaryStickyFold | |||
min-w-46 | min-w-46 | |||
max-w-1/3 | max-w-1/3 | |||
p-4 | p-4 | |||
skipping to change at line 186 | skipping to change at line 160 | |||
class="link" | class="link" | |||
:label="`${$t('authorization.learn')} \xA0 →`" | :label="`${$t('authorization.learn')} \xA0 →`" | |||
to="https://docs.hoppscotch.io/" | to="https://docs.hoppscotch.io/" | |||
blank | blank | |||
/> | /> | |||
</div> | </div> | |||
</div> | </div> | |||
</div> | </div> | |||
<div v-if="authType === 'bearer'" class="border-b border-dividerLight flex"> | <div v-if="authType === 'bearer'" class="border-b border-dividerLight flex"> | |||
<div class="border-r border-dividerLight w-2/3"> | <div class="border-r border-dividerLight w-2/3"> | |||
<div | <div class="border-b border-dividerLight flex"> | |||
class="divide-x divide-dividerLight border-b border-dividerLight flex" | ||||
> | ||||
<SmartEnvInput | <SmartEnvInput | |||
v-if="EXPERIMENTAL_URL_BAR_ENABLED" | ||||
v-model="bearerToken" | v-model="bearerToken" | |||
class="bg-transparent flex flex-1 py-1 px-4" | ||||
placeholder="Token" | placeholder="Token" | |||
/> | styles="bg-transparent flex flex-1 py-1 px-4" | |||
<input | ||||
v-else | ||||
id="bearer_token" | ||||
v-model="bearerToken" | ||||
class="bg-transparent flex flex-1 py-2 px-4" | ||||
placeholder="Token" | ||||
name="bearer_token" | ||||
/> | /> | |||
</div> | </div> | |||
</div> | </div> | |||
<div | <div | |||
class=" | class=" | |||
bg-primary | bg-primary | |||
h-full | h-full | |||
top-upperTertiaryStickyFold | top-upperTertiaryStickyFold | |||
min-w-46 | min-w-46 | |||
max-w-1/3 | max-w-1/3 | |||
skipping to change at line 236 | skipping to change at line 199 | |||
blank | blank | |||
/> | /> | |||
</div> | </div> | |||
</div> | </div> | |||
</div> | </div> | |||
<div | <div | |||
v-if="authType === 'oauth-2'" | v-if="authType === 'oauth-2'" | |||
class="border-b border-dividerLight flex" | class="border-b border-dividerLight flex" | |||
> | > | |||
<div class="border-r border-dividerLight w-2/3"> | <div class="border-r border-dividerLight w-2/3"> | |||
<div | <div class="border-b border-dividerLight flex"> | |||
class="divide-x divide-dividerLight border-b border-dividerLight flex" | ||||
> | ||||
<SmartEnvInput | <SmartEnvInput | |||
v-if="EXPERIMENTAL_URL_BAR_ENABLED" | ||||
v-model="oauth2Token" | ||||
class="bg-transparent flex flex-1 py-1 px-4" | ||||
placeholder="Token" | ||||
/> | ||||
<input | ||||
v-else | ||||
id="oauth2_token" | ||||
v-model="oauth2Token" | v-model="oauth2Token" | |||
class="bg-transparent flex flex-1 py-2 px-4" | ||||
placeholder="Token" | placeholder="Token" | |||
name="oauth2_token" | styles="bg-transparent flex flex-1 py-1 px-4" | |||
/> | /> | |||
</div> | </div> | |||
<HttpOAuth2Authorization /> | <HttpOAuth2Authorization /> | |||
</div> | </div> | |||
<div | <div | |||
class=" | class=" | |||
bg-primary | bg-primary | |||
h-full | h-full | |||
top-upperTertiaryStickyFold | top-upperTertiaryStickyFold | |||
min-w-46 | min-w-46 | |||
skipping to change at line 286 | skipping to change at line 238 | |||
to="https://docs.hoppscotch.io/" | to="https://docs.hoppscotch.io/" | |||
blank | blank | |||
/> | /> | |||
</div> | </div> | |||
</div> | </div> | |||
</div> | </div> | |||
</div> | </div> | |||
</template> | </template> | |||
<script lang="ts"> | <script lang="ts"> | |||
import { computed, defineComponent, Ref, ref } from "@nuxtjs/composition-api" | import { computed, defineComponent, Ref } from "@nuxtjs/composition-api" | |||
import { | import { | |||
HoppRESTAuthBasic, | HoppRESTAuthBasic, | |||
HoppRESTAuthBearer, | HoppRESTAuthBearer, | |||
HoppRESTAuthOAuth2, | HoppRESTAuthOAuth2, | |||
} from "~/helpers/types/HoppRESTAuth" | } from "~/helpers/types/HoppRESTAuth" | |||
import { pluckRef, useStream } from "~/helpers/utils/composables" | import { pluckRef, useStream } from "~/helpers/utils/composables" | |||
import { restAuth$, setRESTAuth } from "~/newstore/RESTSession" | import { restAuth$, setRESTAuth } from "~/newstore/RESTSession" | |||
import { useSetting } from "~/newstore/settings" | import { useSetting } from "~/newstore/settings" | |||
export default defineComponent({ | export default defineComponent({ | |||
skipping to change at line 322 | skipping to change at line 274 | |||
const basicUsername = pluckRef(auth as Ref<HoppRESTAuthBasic>, "username") | const basicUsername = pluckRef(auth as Ref<HoppRESTAuthBasic>, "username") | |||
const basicPassword = pluckRef(auth as Ref<HoppRESTAuthBasic>, "password") | const basicPassword = pluckRef(auth as Ref<HoppRESTAuthBasic>, "password") | |||
const bearerToken = pluckRef(auth as Ref<HoppRESTAuthBearer>, "token") | const bearerToken = pluckRef(auth as Ref<HoppRESTAuthBearer>, "token") | |||
const oauth2Token = pluckRef(auth as Ref<HoppRESTAuthOAuth2>, "token") | const oauth2Token = pluckRef(auth as Ref<HoppRESTAuthOAuth2>, "token") | |||
const URLExcludes = useSetting("URL_EXCLUDES") | const URLExcludes = useSetting("URL_EXCLUDES") | |||
const passwordFieldType = ref("password") | ||||
const clearContent = () => { | const clearContent = () => { | |||
auth.value = { | auth.value = { | |||
authType: "none", | authType: "none", | |||
authActive: true, | authActive: true, | |||
} | } | |||
} | } | |||
const switchVisibility = () => { | ||||
if (passwordFieldType.value === "text") | ||||
passwordFieldType.value = "password" | ||||
else passwordFieldType.value = "text" | ||||
} | ||||
return { | return { | |||
auth, | auth, | |||
authType, | authType, | |||
authName, | authName, | |||
authActive, | authActive, | |||
basicUsername, | basicUsername, | |||
basicPassword, | basicPassword, | |||
bearerToken, | bearerToken, | |||
oauth2Token, | oauth2Token, | |||
URLExcludes, | URLExcludes, | |||
passwordFieldType, | ||||
clearContent, | clearContent, | |||
switchVisibility, | ||||
EXPERIMENTAL_URL_BAR_ENABLED: useSetting("EXPERIMENTAL_URL_BAR_ENABLED"), | ||||
} | } | |||
}, | }, | |||
}) | }) | |||
</script> | </script> | |||
End of changes. 27 change blocks. | ||||
77 lines changed or deleted | 18 lines changed or added |