Added: Alembic for migrations

Moving from Pyramid to FastAPI
This commit is contained in:
2020-06-14 18:43:10 +05:30
parent 0c0a2990a8
commit fdfd3dcbfb
139 changed files with 4017 additions and 3397 deletions

View File

@ -1,9 +1,9 @@
import {AfterViewInit, Component, ElementRef, OnInit, ViewChild} from '@angular/core';
import {AuthService} from '../auth.service';
import {ActivatedRoute, Router} from '@angular/router';
import {ToasterService} from '../../core/toaster.service';
import {FormBuilder, FormGroup} from '@angular/forms';
import {CookieService} from '../../shared/cookie.service';
import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core';
import { AuthService } from '../auth.service';
import { ActivatedRoute, Router } from '@angular/router';
import { ToasterService } from '../../core/toaster.service';
import { FormBuilder, FormGroup } from '@angular/forms';
import { CookieService } from '../../shared/cookie.service';
@Component({
selector: 'app-login',
@ -15,7 +15,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
form: FormGroup;
hide: boolean;
showOtp: boolean;
clientID: string;
clientId: string;
private returnUrl: string;
constructor(private route: ActivatedRoute,
@ -34,8 +34,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
this.form = this.fb.group({
username: '',
password: '',
otp: '',
clientName: ''
otp: ''
});
}
@ -53,17 +52,20 @@ export class LoginComponent implements OnInit, AfterViewInit {
const formModel = this.form.value;
const username = formModel.username;
const password = formModel.password;
this.auth.login(username, password).subscribe(
(result) => {
this.router.navigateByUrl(this.returnUrl);
},
(error) => {
if (error.status === 403 && ['Unknown Client', 'OTP not supplied', 'OTP is wrong'].indexOf(error.error) !== -1) {
this.showOtp = true;
this.clientID = this.cs.getCookie('ClientID');
}
this.toaster.show('Danger', error.error);
}
);
const otp = formModel.otp;
this.auth.login(username, password, otp)
// .pipe(first())
.subscribe(
data => {
this.router.navigate([this.returnUrl]);
},
(error) => {
if (error.status === 401 && 'Client is not registered' === error.error.detail) {
this.showOtp = true;
this.clientId = this.cs.getCookie('client_id');
}
this.toaster.show('Danger', error.error.details);
}
)
}
}