Redirect back to frontend upon successful oauth
This commit is contained in:
parent
6d3cbaf764
commit
91fa976317
File diff suppressed because it is too large
Load Diff
|
|
@ -3,43 +3,7 @@
|
|||
<h1
|
||||
class="hello__title public-page__title"
|
||||
data-cy="hello-title">Wollen Sie {{ pageTitle }} jetzt im Unterricht verwenden?</h1>
|
||||
<form
|
||||
class="hello__form hello-form"
|
||||
novalidate
|
||||
@submit.prevent="validateBeforeSubmit">
|
||||
<div class="hello-form__field skillboxform-input">
|
||||
<label
|
||||
for="email"
|
||||
class="skillboxform-input__label">E-Mail</label>
|
||||
<input
|
||||
v-model="email"
|
||||
v-validate="'required'"
|
||||
:class="{ 'skillboxform-input__input--error': errors.has('email') }"
|
||||
name="email"
|
||||
type="email"
|
||||
data-vv-as="E-Mail"
|
||||
class="change-form__email skillbox-input skillboxform-input__input"
|
||||
autocomplete="off"
|
||||
data-cy="email-input"
|
||||
placeholder="E-Mail eingeben"
|
||||
tabindex="0"
|
||||
id="email"
|
||||
>
|
||||
<small
|
||||
class="skillboxform-input__error"
|
||||
data-cy="email-local-errors"
|
||||
v-if="errors.has('email') && submitted"
|
||||
>{{ errors.first('email') }}</small>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<loading-button
|
||||
:loading="loading"
|
||||
label="Los geht's"
|
||||
class="actions__submit"
|
||||
data-cy="hello-button"
|
||||
/>
|
||||
</div>
|
||||
</form>
|
||||
<a href="/api/oauth/login/">Login</a>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
|
|
|
|||
|
|
@ -95,6 +95,17 @@ const routes = [
|
|||
component: news,
|
||||
name: 'news',
|
||||
},
|
||||
{
|
||||
path: '/login-success',
|
||||
redirect: to => {
|
||||
console.log(to)
|
||||
switch (to.query.state) {
|
||||
case 'email_not_verified':
|
||||
return '/verify-email'
|
||||
}
|
||||
}
|
||||
},
|
||||
...onboardingRoutes,
|
||||
{path: '/styleguide', component: styleGuidePage},
|
||||
{
|
||||
path: '*',
|
||||
|
|
|
|||
24308
client/yarn.lock
24308
client/yarn.lock
File diff suppressed because it is too large
Load Diff
|
|
@ -82,13 +82,6 @@ class HepClient:
|
|||
response = self._call('/api/auth/user', token)
|
||||
return response.json()['data']
|
||||
|
||||
# gone --->
|
||||
def customer_activate(self, confirmation_key, user_id):
|
||||
response = self._call(f'/customer/account/confirm/?back_url=&id={user_id}&key={confirmation_key}', method='get')
|
||||
return response
|
||||
|
||||
# --->
|
||||
|
||||
def customers_search(self, admin_token, email):
|
||||
response = self._call('/rest/V1/customers/search?searchCriteria[filterGroups][0][filters][0][field]='
|
||||
f'email&searchCriteria[filterGroups][0][filters][0][value]={email}',
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
from django.conf import settings
|
||||
from django.shortcuts import redirect
|
||||
|
||||
from core.hep_client import HepClient
|
||||
from core.oauth import oauth
|
||||
|
|
@ -17,16 +18,17 @@ def authorize(request):
|
|||
hep_client = HepClient()
|
||||
token = oauth.hep.authorize_access_token(request)
|
||||
user_data = hep_client.user_details(token)
|
||||
print(user_data)
|
||||
|
||||
user, status_msg = handle_user_and_verify_products(user_data)
|
||||
user.sync_with_hep_data(user_data)
|
||||
|
||||
if user and status_msg != EMAIL_NOT_VERIFIED:
|
||||
dj_login(request, user)
|
||||
some = len(token['access_token'])
|
||||
|
||||
OAuth2Token.objects.update_or_create_token(token, user)
|
||||
|
||||
if status_msg:
|
||||
return status_msg
|
||||
return redirect(f'/login-success?state={status_msg}')
|
||||
# return status_msg
|
||||
# return cls.return_login_message(status_msg)
|
||||
return '...'
|
||||
return redirect(f'/login-success?state={status_msg}')
|
||||
|
|
|
|||
Loading…
Reference in New Issue