feat: ui for oauth

This commit is contained in:
liyasthomas
2021-08-25 22:20:35 +05:30
parent fedc230c9f
commit ee44a48994
3 changed files with 140 additions and 88 deletions

View File

@@ -107,7 +107,8 @@
reverse reverse
/> />
</div> </div>
<div v-if="authType === 'basic'" class="space-y-2 p-2"> <div v-if="authType === 'basic'" class="border-b border-dividerLight flex">
<div class="border-r border-dividerLight space-y-2 p-2 w-2/3">
<div class="flex relative"> <div class="flex relative">
<input <input
id="http_basic_user" id="http_basic_user"
@@ -133,25 +134,42 @@
{{ $t("authorization.password") }} {{ $t("authorization.password") }}
</label> </label>
<ButtonSecondary <ButtonSecondary
:icon="passwordFieldType === 'text' ? 'visibility' : 'visibility_off'" :icon="
passwordFieldType === 'text' ? 'visibility' : 'visibility_off'
"
outline outline
class="rounded ml-2" class="rounded ml-2"
@click.native="switchVisibility" @click.native="switchVisibility"
/> />
</div> </div>
</div>
<div
class="
h-full
top-upperTertiaryStickyFold
min-w-46
max-w-1/3
p-4
z-9
sticky
overflow-auto
"
>
<div class="p-2"> <div class="p-2">
<div class="text-secondaryLight pb-2"> <div class="text-secondaryLight pb-2">
{{ $t("helpers.authorization") }} {{ $t("helpers.authorization") }}
</div> </div>
<SmartAnchor <SmartAnchor
class="link" class="link"
:label="$t('action.learn_more')" :label="`${$t('authorization.learn')} \xA0 →`"
to="https://docs.hoppscotch.io/" to="https://docs.hoppscotch.io/"
blank blank
/> />
</div> </div>
</div> </div>
<div v-if="authType === 'bearer'" class="space-y-2 p-2"> </div>
<div v-if="authType === 'bearer'" class="border-b border-dividerLight flex">
<div class="border-r border-dividerLight space-y-2 p-2 w-2/3">
<div class="flex relative"> <div class="flex relative">
<input <input
id="bearer_token" id="bearer_token"
@@ -162,19 +180,37 @@
/> />
<label for="bearer_token"> Token </label> <label for="bearer_token"> Token </label>
</div> </div>
</div>
<div
class="
h-full
top-upperTertiaryStickyFold
min-w-46
max-w-1/3
p-4
z-9
sticky
overflow-auto
"
>
<div class="p-2"> <div class="p-2">
<div class="text-secondaryLight pb-2"> <div class="text-secondaryLight pb-2">
{{ $t("helpers.authorization") }} {{ $t("helpers.authorization") }}
</div> </div>
<SmartAnchor <SmartAnchor
class="link" class="link"
:label="$t('action.learn_more')" :label="`${$t('authorization.learn')} \xA0 →`"
to="https://docs.hoppscotch.io/" to="https://docs.hoppscotch.io/"
blank blank
/> />
</div> </div>
</div> </div>
<div v-if="authType === 'oauth-2'" class="space-y-2 p-2"> </div>
<div
v-if="authType === 'oauth-2'"
class="border-b border-dividerLight flex"
>
<div class="border-r border-dividerLight space-y-2 p-2 w-2/3">
<div class="flex relative"> <div class="flex relative">
<input <input
id="oauth2_token" id="oauth2_token"
@@ -186,19 +222,33 @@
<label for="oauth2_token"> Token </label> <label for="oauth2_token"> Token </label>
</div> </div>
<HttpOAuth2Authorization /> <HttpOAuth2Authorization />
</div>
<div
class="
h-full
top-upperTertiaryStickyFold
min-w-46
max-w-1/3
p-4
z-9
sticky
overflow-auto
"
>
<div class="p-2"> <div class="p-2">
<div class="text-secondaryLight pb-2"> <div class="text-secondaryLight pb-2">
{{ $t("helpers.authorization") }} {{ $t("helpers.authorization") }}
</div> </div>
<SmartAnchor <SmartAnchor
class="link" class="link"
:label="$t('action.learn_more')" :label="`${$t('authorization.learn')} \xA0 →`"
to="https://docs.hoppscotch.io/" to="https://docs.hoppscotch.io/"
blank blank
/> />
</div> </div>
</div> </div>
</div> </div>
</div>
</template> </template>
<script lang="ts"> <script lang="ts">

View File

@@ -8,7 +8,7 @@
placeholder=" " placeholder=" "
name="oidcDiscoveryURL" name="oidcDiscoveryURL"
/> />
<label for="oidcDiscoveryURL">oidcDiscoveryURL </label> <label for="oidcDiscoveryURL"> OpenID Connect Discovery URL </label>
</div> </div>
<div class="flex relative"> <div class="flex relative">
<input <input
@@ -18,7 +18,7 @@
placeholder=" " placeholder=" "
name="authURL" name="authURL"
/> />
<label for="authURL">authURL </label> <label for="authURL"> Authentication URL </label>
</div> </div>
<div class="flex relative"> <div class="flex relative">
<input <input
@@ -28,7 +28,7 @@
placeholder=" " placeholder=" "
name="accessTokenURL" name="accessTokenURL"
/> />
<label for="accessTokenURL">accessTokenURL </label> <label for="accessTokenURL"> Access Token URL </label>
</div> </div>
<div class="flex relative"> <div class="flex relative">
<input <input
@@ -38,7 +38,7 @@
placeholder=" " placeholder=" "
name="clientID" name="clientID"
/> />
<label for="clientID">clientID </label> <label for="clientID"> Client ID </label>
</div> </div>
<div class="flex relative"> <div class="flex relative">
<input <input
@@ -48,11 +48,11 @@
placeholder=" " placeholder=" "
name="scope" name="scope"
/> />
<label for="scope">scope </label> <label for="scope"> Scope </label>
</div> </div>
<div> <div>
<ButtonPrimary <ButtonPrimary
label="Get request" :label="$t('authorization.generate_token')"
@click.native="handleAccessTokenRequest()" @click.native="handleAccessTokenRequest()"
/> />
</div> </div>

View File

@@ -85,7 +85,9 @@
"we_sent_magic_link_description": "Check your inbox - we sent an email to {email}. It contains a magic link that will log you in." "we_sent_magic_link_description": "Check your inbox - we sent an email to {email}. It contains a magic link that will log you in."
}, },
"authorization": { "authorization": {
"generate_token": "Generate Token",
"include_in_url": "Include in URL", "include_in_url": "Include in URL",
"learn": "Learn how",
"password": "Password", "password": "Password",
"token": "Token", "token": "Token",
"type": "Authorization Type", "type": "Authorization Type",