Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
894
Issues
894
List
Boards
Labels
Service Desk
Milestones
Merge Requests
48
Merge Requests
48
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Compare Revisions
5a79ffb2d254b3fd7ec6c8f55c0e81c80979b822...b6c636598fdb26cceface20bc97280b664431a91
Source
b6c636598fdb26cceface20bc97280b664431a91
Select Git revision
...
Target
5a79ffb2d254b3fd7ec6c8f55c0e81c80979b822
Select Git revision
Compare
Commits (2)
(feat): redirect on 401 errors and return back to original URL after logging in successfully
· c60dbb22
Marcelo Rivera
authored
3 hours ago
c60dbb22
(fix): explicit overlay was sending wrong redirect param
· b6c63659
Marcelo Rivera
authored
3 hours ago
b6c63659
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
11 deletions
+31
-11
overlay.component.ts
...pp/modules/channels/explicit-overlay/overlay.component.ts
+1
-1
login.component.ts
src/app/modules/pro/channel/login/login.component.ts
+18
-4
client.ts
src/app/services/api/client.ts
+10
-4
providers.ts
src/app/services/providers.ts
+2
-2
No files found.
src/app/modules/channels/explicit-overlay/overlay.component.ts
View file @
b6c63659
...
...
@@ -28,7 +28,7 @@ export class ExplicitOverlayComponent {
login
()
{
this
.
storage
.
set
(
'
redirect
To
'
,
'
redirect
'
,
window
.
Minds
.
site_url
+
this
.
_channel
.
username
);
this
.
router
.
navigate
([
'
/login
'
]);
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/login/login.component.ts
View file @
b6c63659
...
...
@@ -3,6 +3,7 @@ import { ActivatedRoute, Router } from '@angular/router';
import
{
Subscription
}
from
'
rxjs
'
;
import
{
Session
}
from
'
../../../../services/session
'
;
import
{
ProChannelService
}
from
'
../channel.service
'
;
import
{
Storage
}
from
"
../../../../services/storage
"
;
@
Component
({
selector
:
'
m-pro--channel-login
'
,
...
...
@@ -25,9 +26,9 @@ import { ProChannelService } from '../channel.service';
<ng-container *ngIf="currentSection === 'register'">
<span class="m-proChannelLogin--subtext">
<a (click)="currentSection = 'login'"
>I already have a Minds account</a
>
<a (click)="currentSection = 'login'"
>
I already have a Minds account
</a
>
</span>
<minds-form-register (done)="registered()"></minds-form-register>
...
...
@@ -43,6 +44,8 @@ export class ProChannelLoginComponent {
paramsSubscription
:
Subscription
;
redirectTo
:
string
;
get
settings
()
{
return
this
.
service
.
currentChannel
.
pro_settings
;
}
...
...
@@ -51,7 +54,8 @@ export class ProChannelLoginComponent {
public
session
:
Session
,
public
service
:
ProChannelService
,
private
router
:
Router
,
private
route
:
ActivatedRoute
private
route
:
ActivatedRoute
,
private
storage
:
Storage
,
)
{
this
.
paramsSubscription
=
this
.
route
.
params
.
subscribe
(
params
=>
{
if
(
params
[
'
username
'
])
{
...
...
@@ -64,7 +68,17 @@ export class ProChannelLoginComponent {
});
}
ngOnInit
()
{
this
.
redirectTo
=
this
.
storage
.
get
(
'
redirect
'
);
}
registered
()
{
if
(
this
.
redirectTo
)
{
this
.
storage
.
destroy
(
'
redirect
'
);
this
.
router
.
navigate
([
this
.
redirectTo
]);
return
;
}
this
.
router
.
navigate
(
this
.
service
.
getRouterLink
(
'
home
'
));
}
}
This diff is collapsed.
Click to expand it.
src/app/services/api/client.ts
View file @
b6c63659
import
{
Cookie
}
from
'
../cookie
'
;
import
{
HttpClient
,
HttpHeaders
}
from
'
@angular/common/http
'
;
import
{
Location
}
from
"
@angular/common
"
;
/**
* API Class
...
...
@@ -9,11 +10,11 @@ export class Client {
origin
:
string
=
''
;
cookie
:
Cookie
=
new
Cookie
();
static
_
(
http
:
HttpClient
)
{
return
new
Client
(
http
);
static
_
(
http
:
HttpClient
,
location
:
Location
)
{
return
new
Client
(
http
,
location
);
}
constructor
(
public
http
:
HttpClient
)
{
constructor
(
public
http
:
HttpClient
,
public
location
:
Location
)
{
if
(
window
.
Minds
.
pro
)
{
this
.
base
=
window
.
Minds
.
site_url
;
this
.
origin
=
document
.
location
.
host
;
...
...
@@ -40,6 +41,7 @@ export class Client {
return
reject
(
err
||
new
Error
(
'
GET error
'
));
}
if
(
err
.
status
===
401
&&
err
.
error
.
loggedin
===
false
)
{
localStorage
.
setItem
(
'
redirect
'
,
this
.
location
.
path
());
window
.
location
.
href
=
'
/login
'
;
return
reject
(
err
);
}
...
...
@@ -64,6 +66,7 @@ export class Client {
return
reject
(
err
||
new
Error
(
'
GET error
'
));
}
if
(
err
.
status
===
401
&&
err
.
error
.
loggedin
===
false
)
{
localStorage
.
setItem
(
'
redirect
'
,
this
.
location
.
path
());
window
.
location
.
href
=
'
/login
'
;
return
reject
(
err
);
}
...
...
@@ -95,7 +98,8 @@ export class Client {
if
(
err
.
data
&&
!
err
.
data
())
{
return
reject
(
err
||
new
Error
(
'
POST error
'
));
}
if
(
err
.
status
===
401
&&
err
.
loggedin
===
false
)
{
if
(
err
.
status
===
401
&&
err
.
error
.
loggedin
===
false
)
{
localStorage
.
setItem
(
'
redirect
'
,
this
.
location
.
path
());
window
.
location
.
href
=
'
/login
'
;
return
reject
(
err
);
}
...
...
@@ -127,6 +131,7 @@ export class Client {
},
err
=>
{
if
(
err
.
status
===
401
&&
err
.
data
().
loggedin
===
false
)
{
localStorage
.
setItem
(
'
redirect
'
,
this
.
location
.
path
());
window
.
location
.
href
=
'
/login
'
;
return
reject
(
err
);
}
...
...
@@ -154,6 +159,7 @@ export class Client {
},
err
=>
{
if
(
err
.
status
===
401
&&
err
.
error
.
loggedin
===
false
)
{
localStorage
.
setItem
(
'
redirect
'
,
this
.
location
.
path
());
window
.
location
.
href
=
'
/login
'
;
return
reject
(
err
);
}
...
...
This diff is collapsed.
Click to expand it.
src/app/services/providers.ts
View file @
b6c63659
import
{
NgZone
,
RendererFactory2
}
from
'
@angular/core
'
;
import
{
Router
}
from
'
@angular/router
'
;
import
{
ActivatedRoute
,
Router
}
from
'
@angular/router
'
;
import
{
Location
}
from
'
@angular/common
'
;
import
{
Title
}
from
'
@angular/platform-browser
'
;
...
...
@@ -64,7 +64,7 @@ export const MINDS_PROVIDERS: any[] = [
{
provide
:
Client
,
useFactory
:
Client
.
_
,
deps
:
[
HttpClient
],
deps
:
[
HttpClient
,
Location
],
},
{
provide
:
Upload
,
...
...
This diff is collapsed.
Click to expand it.