You've already forked openaccounting-web
forked from cybercinch/openaccounting-web
log in automatically after clicking verify link
This commit is contained in:
@@ -2,6 +2,8 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
import { AppError } from '../shared/error';
|
||||
import { UserService } from '../core/user.service';
|
||||
import { SessionService } from '../core/session.service';
|
||||
import { Util } from '../shared/util';
|
||||
|
||||
|
||||
@Component({
|
||||
@@ -15,16 +17,22 @@ export class VerifyUserPage {
|
||||
constructor(
|
||||
private router: Router,
|
||||
private route: ActivatedRoute,
|
||||
private userService: UserService
|
||||
private userService: UserService,
|
||||
private sessionService: SessionService
|
||||
) {
|
||||
let code = null;
|
||||
|
||||
this.route.queryParams.switchMap(params => {
|
||||
let code = params['code'];
|
||||
code = params['code'];
|
||||
|
||||
if(!code) {
|
||||
throw new Error('Missing code');
|
||||
}
|
||||
|
||||
return this.userService.verifyUser(code);
|
||||
}).switchMap(() => {
|
||||
let sessionId = Util.newGuid();
|
||||
return this.sessionService.login(code, '', sessionId);
|
||||
}).subscribe(() => {
|
||||
this.success = true;
|
||||
}, err => {
|
||||
|
||||
Reference in New Issue
Block a user