signinWithoutSecurityCode is added
This commit is contained in:
parent
fa491c94a7
commit
e286b6c316
|
@ -2,7 +2,8 @@ import { Injectable } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import { catchError, Observable, of, switchMap, throwError } from 'rxjs';
|
import { catchError, Observable, of, switchMap, throwError } from 'rxjs';
|
||||||
import { AuthUtils } from 'app/core/auth/auth.utils';
|
import { AuthUtils } from 'app/core/auth/auth.utils';
|
||||||
import { UserService } from 'app/core/user/user.service';
|
import { WebSessionStorageService } from 'app/core/web-storage/services/web-session-storage.service';
|
||||||
|
import { IdentityService } from 'app/modules/polyglot/identity/services/identity.service';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class AuthService {
|
export class AuthService {
|
||||||
|
@ -13,7 +14,8 @@ export class AuthService {
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
private _httpClient: HttpClient,
|
private _httpClient: HttpClient,
|
||||||
private _userService: UserService
|
private _identityService: IdentityService,
|
||||||
|
private __webSessionStorageService: WebSessionStorageService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
@ -58,27 +60,32 @@ export class AuthService {
|
||||||
*
|
*
|
||||||
* @param credentials
|
* @param credentials
|
||||||
*/
|
*/
|
||||||
signIn(credentials: { email: string; password: string }): Observable<any> {
|
signIn(credentials: { username: string; password: string }): Promise<any> {
|
||||||
// Throw error, if the user is already logged in
|
return new Promise<void>((resolve, reject) => {
|
||||||
if (this._authenticated) {
|
// Throw error, if the user is already logged in
|
||||||
return throwError('User is already logged in.');
|
if (this._authenticated) {
|
||||||
}
|
return reject('User is already logged in.');
|
||||||
|
}
|
||||||
|
|
||||||
return this._httpClient.post('api/auth/sign-in', credentials).pipe(
|
this._identityService
|
||||||
switchMap((response: any) => {
|
.signinWithoutSecurityCode(credentials.username, credentials.password)
|
||||||
// Store the access token in the local storage
|
.then((res) => {
|
||||||
this.accessToken = response.accessToken;
|
this.__webSessionStorageService.set(
|
||||||
|
'accessToken',
|
||||||
|
res.getAccessToken()
|
||||||
|
);
|
||||||
|
|
||||||
// Set the authenticated flag to true
|
// Store the access token in the local storage
|
||||||
this._authenticated = true;
|
this.accessToken = res.getAccessToken();
|
||||||
|
|
||||||
// Store the user on the user service
|
// Set the authenticated flag to true
|
||||||
this._userService.user = response.user;
|
this._authenticated = true;
|
||||||
|
resolve();
|
||||||
// Return a new observable with the response
|
})
|
||||||
return of(response);
|
.catch((e) => {
|
||||||
})
|
reject(e);
|
||||||
);
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,9 +109,6 @@ export class AuthService {
|
||||||
// Set the authenticated flag to true
|
// Set the authenticated flag to true
|
||||||
this._authenticated = true;
|
this._authenticated = true;
|
||||||
|
|
||||||
// Store the user on the user service
|
|
||||||
this._userService.user = response.user;
|
|
||||||
|
|
||||||
// Return true
|
// Return true
|
||||||
return of(true);
|
return of(true);
|
||||||
})
|
})
|
||||||
|
@ -171,6 +175,7 @@ export class AuthService {
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the access token exists and it didn't expire, sign in using it
|
// If the access token exists and it didn't expire, sign in using it
|
||||||
return this.signInUsingToken();
|
// return this.signInUsingToken();
|
||||||
|
return of(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,15 @@ import {
|
||||||
CaptchaResponse,
|
CaptchaResponse,
|
||||||
SigninRequest,
|
SigninRequest,
|
||||||
SigninResponse,
|
SigninResponse,
|
||||||
|
SigninWithoutSecurityCodeRequest,
|
||||||
|
SigninWithoutSecurityCodeResponse,
|
||||||
} from 'app/modules/proto/c2se/identity_pb';
|
} from 'app/modules/proto/c2se/identity_pb';
|
||||||
import {
|
import {
|
||||||
SUBJECT_CHECK_USERNAME_FOR_DUPLICATION,
|
SUBJECT_CHECK_USERNAME_FOR_DUPLICATION,
|
||||||
SUBJECT_CHECK_NICKNAME_FOR_DUPLICATION,
|
SUBJECT_CHECK_NICKNAME_FOR_DUPLICATION,
|
||||||
SUBJECT_CAPTCHA,
|
SUBJECT_CAPTCHA,
|
||||||
SUBJECT_SIGNIN,
|
SUBJECT_SIGNIN,
|
||||||
|
SUBJECT_SIGNIN_WITHOUT_SECURITY_CODE,
|
||||||
} from 'app/modules/proto/c2se/frontend/identity_pb';
|
} from 'app/modules/proto/c2se/frontend/identity_pb';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
@ -129,4 +132,31 @@ export class IdentityService {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
signinWithoutSecurityCode(
|
||||||
|
username: string,
|
||||||
|
password: string
|
||||||
|
): Promise<SigninWithoutSecurityCodeResponse.Result> {
|
||||||
|
return new Promise<SigninWithoutSecurityCodeResponse.Result>(
|
||||||
|
(resolve, reject) => {
|
||||||
|
let req = new SigninWithoutSecurityCodeRequest();
|
||||||
|
req.setUsername(username);
|
||||||
|
req.setPassword(password);
|
||||||
|
|
||||||
|
this.__natsService
|
||||||
|
.request<SigninWithoutSecurityCodeResponse.Result>(
|
||||||
|
SUBJECT_SIGNIN_WITHOUT_SECURITY_CODE,
|
||||||
|
req.serializeBinary(),
|
||||||
|
SigninWithoutSecurityCodeResponse.deserializeBinary
|
||||||
|
)
|
||||||
|
.then((result) => {
|
||||||
|
resolve(result);
|
||||||
|
})
|
||||||
|
.catch((e: Error) => {
|
||||||
|
console.log('failed', e);
|
||||||
|
reject(e);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,3 +7,4 @@ export const SUBJECT_CHECK_USERNAME_FOR_DUPLICATION: string;
|
||||||
export const SUBJECT_CHECK_NICKNAME_FOR_DUPLICATION: string;
|
export const SUBJECT_CHECK_NICKNAME_FOR_DUPLICATION: string;
|
||||||
export const SUBJECT_CAPTCHA: string;
|
export const SUBJECT_CAPTCHA: string;
|
||||||
export const SUBJECT_SIGNIN: string;
|
export const SUBJECT_SIGNIN: string;
|
||||||
|
export const SUBJECT_SIGNIN_WITHOUT_SECURITY_CODE: string;
|
||||||
|
|
|
@ -29,5 +29,7 @@ proto.bet.beteran.c2se.frontend.identity.SUBJECT_CAPTCHA =
|
||||||
"bet.beteran.c2se.frontend.identity.Captcha";
|
"bet.beteran.c2se.frontend.identity.Captcha";
|
||||||
proto.bet.beteran.c2se.frontend.identity.SUBJECT_SIGNIN =
|
proto.bet.beteran.c2se.frontend.identity.SUBJECT_SIGNIN =
|
||||||
"bet.beteran.c2se.frontend.identity.Signin";
|
"bet.beteran.c2se.frontend.identity.Signin";
|
||||||
|
proto.bet.beteran.c2se.frontend.identity.SUBJECT_SIGNIN_WITHOUT_SECURITY_CODE =
|
||||||
|
"bet.beteran.c2se.frontend.identity.SigninWithoutSecurityCode";
|
||||||
|
|
||||||
goog.object.extend(exports, proto.bet.beteran.c2se.frontend.identity);
|
goog.object.extend(exports, proto.bet.beteran.c2se.frontend.identity);
|
||||||
|
|
438
src/app/modules/proto/c2se/identity_pb.d.ts
vendored
438
src/app/modules/proto/c2se/identity_pb.d.ts
vendored
|
@ -1,27 +1,42 @@
|
||||||
// package: bet.beteran.c2se.identity
|
// package: bet.beteran.c2se.identity
|
||||||
// file: c2se/identity.proto
|
// file: c2se/identity.proto
|
||||||
|
|
||||||
import * as jspb from "google-protobuf";
|
import * as jspb from 'google-protobuf';
|
||||||
import * as protobuf_rpc_pb from "../protobuf/rpc_pb";
|
import * as protobuf_rpc_pb from '../protobuf/rpc_pb';
|
||||||
|
|
||||||
export class CheckUsernameForDuplicationRequest extends jspb.Message {
|
export class CheckUsernameForDuplicationRequest extends jspb.Message {
|
||||||
getUsername(): string;
|
getUsername(): string;
|
||||||
setUsername(value: string): void;
|
setUsername(value: string): void;
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): CheckUsernameForDuplicationRequest.AsObject;
|
toObject(
|
||||||
static toObject(includeInstance: boolean, msg: CheckUsernameForDuplicationRequest): CheckUsernameForDuplicationRequest.AsObject;
|
includeInstance?: boolean
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
): CheckUsernameForDuplicationRequest.AsObject;
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static toObject(
|
||||||
static serializeBinaryToWriter(message: CheckUsernameForDuplicationRequest, writer: jspb.BinaryWriter): void;
|
includeInstance: boolean,
|
||||||
static deserializeBinary(bytes: Uint8Array): CheckUsernameForDuplicationRequest;
|
msg: CheckUsernameForDuplicationRequest
|
||||||
static deserializeBinaryFromReader(message: CheckUsernameForDuplicationRequest, reader: jspb.BinaryReader): CheckUsernameForDuplicationRequest;
|
): CheckUsernameForDuplicationRequest.AsObject;
|
||||||
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
|
static extensionsBinary: {
|
||||||
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: CheckUsernameForDuplicationRequest,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
|
static deserializeBinary(
|
||||||
|
bytes: Uint8Array
|
||||||
|
): CheckUsernameForDuplicationRequest;
|
||||||
|
static deserializeBinaryFromReader(
|
||||||
|
message: CheckUsernameForDuplicationRequest,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): CheckUsernameForDuplicationRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace CheckUsernameForDuplicationRequest {
|
export namespace CheckUsernameForDuplicationRequest {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
username: string,
|
username: string;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CheckUsernameForDuplicationResponse extends jspb.Message {
|
export class CheckUsernameForDuplicationResponse extends jspb.Message {
|
||||||
|
@ -36,20 +51,35 @@ export class CheckUsernameForDuplicationResponse extends jspb.Message {
|
||||||
setResult(value?: CheckUsernameForDuplicationResponse.Result): void;
|
setResult(value?: CheckUsernameForDuplicationResponse.Result): void;
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): CheckUsernameForDuplicationResponse.AsObject;
|
toObject(
|
||||||
static toObject(includeInstance: boolean, msg: CheckUsernameForDuplicationResponse): CheckUsernameForDuplicationResponse.AsObject;
|
includeInstance?: boolean
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
): CheckUsernameForDuplicationResponse.AsObject;
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static toObject(
|
||||||
static serializeBinaryToWriter(message: CheckUsernameForDuplicationResponse, writer: jspb.BinaryWriter): void;
|
includeInstance: boolean,
|
||||||
static deserializeBinary(bytes: Uint8Array): CheckUsernameForDuplicationResponse;
|
msg: CheckUsernameForDuplicationResponse
|
||||||
static deserializeBinaryFromReader(message: CheckUsernameForDuplicationResponse, reader: jspb.BinaryReader): CheckUsernameForDuplicationResponse;
|
): CheckUsernameForDuplicationResponse.AsObject;
|
||||||
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
|
static extensionsBinary: {
|
||||||
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: CheckUsernameForDuplicationResponse,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
|
static deserializeBinary(
|
||||||
|
bytes: Uint8Array
|
||||||
|
): CheckUsernameForDuplicationResponse;
|
||||||
|
static deserializeBinaryFromReader(
|
||||||
|
message: CheckUsernameForDuplicationResponse,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): CheckUsernameForDuplicationResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace CheckUsernameForDuplicationResponse {
|
export namespace CheckUsernameForDuplicationResponse {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
error?: protobuf_rpc_pb.Error.AsObject,
|
error?: protobuf_rpc_pb.Error.AsObject;
|
||||||
result?: CheckUsernameForDuplicationResponse.Result.AsObject,
|
result?: CheckUsernameForDuplicationResponse.Result.AsObject;
|
||||||
}
|
};
|
||||||
|
|
||||||
export class Result extends jspb.Message {
|
export class Result extends jspb.Message {
|
||||||
getDuplicated(): boolean;
|
getDuplicated(): boolean;
|
||||||
|
@ -58,17 +88,25 @@ export namespace CheckUsernameForDuplicationResponse {
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): Result.AsObject;
|
toObject(includeInstance?: boolean): Result.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: Result): Result.AsObject;
|
static toObject(includeInstance: boolean, msg: Result): Result.AsObject;
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static extensionsBinary: {
|
||||||
static serializeBinaryToWriter(message: Result, writer: jspb.BinaryWriter): void;
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: Result,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): Result;
|
static deserializeBinary(bytes: Uint8Array): Result;
|
||||||
static deserializeBinaryFromReader(message: Result, reader: jspb.BinaryReader): Result;
|
static deserializeBinaryFromReader(
|
||||||
|
message: Result,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace Result {
|
export namespace Result {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
duplicated: boolean,
|
duplicated: boolean;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -77,19 +115,34 @@ export class CheckNicknameForDuplicationRequest extends jspb.Message {
|
||||||
setNickname(value: string): void;
|
setNickname(value: string): void;
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): CheckNicknameForDuplicationRequest.AsObject;
|
toObject(
|
||||||
static toObject(includeInstance: boolean, msg: CheckNicknameForDuplicationRequest): CheckNicknameForDuplicationRequest.AsObject;
|
includeInstance?: boolean
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
): CheckNicknameForDuplicationRequest.AsObject;
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static toObject(
|
||||||
static serializeBinaryToWriter(message: CheckNicknameForDuplicationRequest, writer: jspb.BinaryWriter): void;
|
includeInstance: boolean,
|
||||||
static deserializeBinary(bytes: Uint8Array): CheckNicknameForDuplicationRequest;
|
msg: CheckNicknameForDuplicationRequest
|
||||||
static deserializeBinaryFromReader(message: CheckNicknameForDuplicationRequest, reader: jspb.BinaryReader): CheckNicknameForDuplicationRequest;
|
): CheckNicknameForDuplicationRequest.AsObject;
|
||||||
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
|
static extensionsBinary: {
|
||||||
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: CheckNicknameForDuplicationRequest,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
|
static deserializeBinary(
|
||||||
|
bytes: Uint8Array
|
||||||
|
): CheckNicknameForDuplicationRequest;
|
||||||
|
static deserializeBinaryFromReader(
|
||||||
|
message: CheckNicknameForDuplicationRequest,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): CheckNicknameForDuplicationRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace CheckNicknameForDuplicationRequest {
|
export namespace CheckNicknameForDuplicationRequest {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
nickname: string,
|
nickname: string;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CheckNicknameForDuplicationResponse extends jspb.Message {
|
export class CheckNicknameForDuplicationResponse extends jspb.Message {
|
||||||
|
@ -104,20 +157,35 @@ export class CheckNicknameForDuplicationResponse extends jspb.Message {
|
||||||
setResult(value?: CheckNicknameForDuplicationResponse.Result): void;
|
setResult(value?: CheckNicknameForDuplicationResponse.Result): void;
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): CheckNicknameForDuplicationResponse.AsObject;
|
toObject(
|
||||||
static toObject(includeInstance: boolean, msg: CheckNicknameForDuplicationResponse): CheckNicknameForDuplicationResponse.AsObject;
|
includeInstance?: boolean
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
): CheckNicknameForDuplicationResponse.AsObject;
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static toObject(
|
||||||
static serializeBinaryToWriter(message: CheckNicknameForDuplicationResponse, writer: jspb.BinaryWriter): void;
|
includeInstance: boolean,
|
||||||
static deserializeBinary(bytes: Uint8Array): CheckNicknameForDuplicationResponse;
|
msg: CheckNicknameForDuplicationResponse
|
||||||
static deserializeBinaryFromReader(message: CheckNicknameForDuplicationResponse, reader: jspb.BinaryReader): CheckNicknameForDuplicationResponse;
|
): CheckNicknameForDuplicationResponse.AsObject;
|
||||||
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
|
static extensionsBinary: {
|
||||||
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: CheckNicknameForDuplicationResponse,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
|
static deserializeBinary(
|
||||||
|
bytes: Uint8Array
|
||||||
|
): CheckNicknameForDuplicationResponse;
|
||||||
|
static deserializeBinaryFromReader(
|
||||||
|
message: CheckNicknameForDuplicationResponse,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): CheckNicknameForDuplicationResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace CheckNicknameForDuplicationResponse {
|
export namespace CheckNicknameForDuplicationResponse {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
error?: protobuf_rpc_pb.Error.AsObject,
|
error?: protobuf_rpc_pb.Error.AsObject;
|
||||||
result?: CheckNicknameForDuplicationResponse.Result.AsObject,
|
result?: CheckNicknameForDuplicationResponse.Result.AsObject;
|
||||||
}
|
};
|
||||||
|
|
||||||
export class Result extends jspb.Message {
|
export class Result extends jspb.Message {
|
||||||
getDuplicated(): boolean;
|
getDuplicated(): boolean;
|
||||||
|
@ -126,34 +194,52 @@ export namespace CheckNicknameForDuplicationResponse {
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): Result.AsObject;
|
toObject(includeInstance?: boolean): Result.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: Result): Result.AsObject;
|
static toObject(includeInstance: boolean, msg: Result): Result.AsObject;
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static extensionsBinary: {
|
||||||
static serializeBinaryToWriter(message: Result, writer: jspb.BinaryWriter): void;
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: Result,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): Result;
|
static deserializeBinary(bytes: Uint8Array): Result;
|
||||||
static deserializeBinaryFromReader(message: Result, reader: jspb.BinaryReader): Result;
|
static deserializeBinaryFromReader(
|
||||||
|
message: Result,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace Result {
|
export namespace Result {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
duplicated: boolean,
|
duplicated: boolean;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CaptchaRequest extends jspb.Message {
|
export class CaptchaRequest extends jspb.Message {
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): CaptchaRequest.AsObject;
|
toObject(includeInstance?: boolean): CaptchaRequest.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: CaptchaRequest): CaptchaRequest.AsObject;
|
static toObject(
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
includeInstance: boolean,
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
msg: CaptchaRequest
|
||||||
static serializeBinaryToWriter(message: CaptchaRequest, writer: jspb.BinaryWriter): void;
|
): CaptchaRequest.AsObject;
|
||||||
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
|
static extensionsBinary: {
|
||||||
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: CaptchaRequest,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): CaptchaRequest;
|
static deserializeBinary(bytes: Uint8Array): CaptchaRequest;
|
||||||
static deserializeBinaryFromReader(message: CaptchaRequest, reader: jspb.BinaryReader): CaptchaRequest;
|
static deserializeBinaryFromReader(
|
||||||
|
message: CaptchaRequest,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): CaptchaRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace CaptchaRequest {
|
export namespace CaptchaRequest {
|
||||||
export type AsObject = {
|
export type AsObject = {};
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CaptchaResponse extends jspb.Message {
|
export class CaptchaResponse extends jspb.Message {
|
||||||
|
@ -169,19 +255,30 @@ export class CaptchaResponse extends jspb.Message {
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): CaptchaResponse.AsObject;
|
toObject(includeInstance?: boolean): CaptchaResponse.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: CaptchaResponse): CaptchaResponse.AsObject;
|
static toObject(
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
includeInstance: boolean,
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
msg: CaptchaResponse
|
||||||
static serializeBinaryToWriter(message: CaptchaResponse, writer: jspb.BinaryWriter): void;
|
): CaptchaResponse.AsObject;
|
||||||
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
|
static extensionsBinary: {
|
||||||
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: CaptchaResponse,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): CaptchaResponse;
|
static deserializeBinary(bytes: Uint8Array): CaptchaResponse;
|
||||||
static deserializeBinaryFromReader(message: CaptchaResponse, reader: jspb.BinaryReader): CaptchaResponse;
|
static deserializeBinaryFromReader(
|
||||||
|
message: CaptchaResponse,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): CaptchaResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace CaptchaResponse {
|
export namespace CaptchaResponse {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
error?: protobuf_rpc_pb.Error.AsObject,
|
error?: protobuf_rpc_pb.Error.AsObject;
|
||||||
result?: CaptchaResponse.Result.AsObject,
|
result?: CaptchaResponse.Result.AsObject;
|
||||||
}
|
};
|
||||||
|
|
||||||
export class Result extends jspb.Message {
|
export class Result extends jspb.Message {
|
||||||
getSecurityCodeHash(): string;
|
getSecurityCodeHash(): string;
|
||||||
|
@ -193,18 +290,26 @@ export namespace CaptchaResponse {
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): Result.AsObject;
|
toObject(includeInstance?: boolean): Result.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: Result): Result.AsObject;
|
static toObject(includeInstance: boolean, msg: Result): Result.AsObject;
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static extensionsBinary: {
|
||||||
static serializeBinaryToWriter(message: Result, writer: jspb.BinaryWriter): void;
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: Result,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): Result;
|
static deserializeBinary(bytes: Uint8Array): Result;
|
||||||
static deserializeBinaryFromReader(message: Result, reader: jspb.BinaryReader): Result;
|
static deserializeBinaryFromReader(
|
||||||
|
message: Result,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace Result {
|
export namespace Result {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
securityCodeHash: string,
|
securityCodeHash: string;
|
||||||
image: string,
|
image: string;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,21 +328,32 @@ export class SigninRequest extends jspb.Message {
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): SigninRequest.AsObject;
|
toObject(includeInstance?: boolean): SigninRequest.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: SigninRequest): SigninRequest.AsObject;
|
static toObject(
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
includeInstance: boolean,
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
msg: SigninRequest
|
||||||
static serializeBinaryToWriter(message: SigninRequest, writer: jspb.BinaryWriter): void;
|
): SigninRequest.AsObject;
|
||||||
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
|
static extensionsBinary: {
|
||||||
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: SigninRequest,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): SigninRequest;
|
static deserializeBinary(bytes: Uint8Array): SigninRequest;
|
||||||
static deserializeBinaryFromReader(message: SigninRequest, reader: jspb.BinaryReader): SigninRequest;
|
static deserializeBinaryFromReader(
|
||||||
|
message: SigninRequest,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): SigninRequest;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace SigninRequest {
|
export namespace SigninRequest {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
securityCodeHash: string,
|
securityCodeHash: string;
|
||||||
securityCode: string,
|
securityCode: string;
|
||||||
username: string,
|
username: string;
|
||||||
password: string,
|
password: string;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export class SigninResponse extends jspb.Message {
|
export class SigninResponse extends jspb.Message {
|
||||||
|
@ -253,19 +369,30 @@ export class SigninResponse extends jspb.Message {
|
||||||
|
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): SigninResponse.AsObject;
|
toObject(includeInstance?: boolean): SigninResponse.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: SigninResponse): SigninResponse.AsObject;
|
static toObject(
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
includeInstance: boolean,
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
msg: SigninResponse
|
||||||
static serializeBinaryToWriter(message: SigninResponse, writer: jspb.BinaryWriter): void;
|
): SigninResponse.AsObject;
|
||||||
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
|
static extensionsBinary: {
|
||||||
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: SigninResponse,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): SigninResponse;
|
static deserializeBinary(bytes: Uint8Array): SigninResponse;
|
||||||
static deserializeBinaryFromReader(message: SigninResponse, reader: jspb.BinaryReader): SigninResponse;
|
static deserializeBinaryFromReader(
|
||||||
|
message: SigninResponse,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): SigninResponse;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace SigninResponse {
|
export namespace SigninResponse {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
error?: protobuf_rpc_pb.Error.AsObject,
|
error?: protobuf_rpc_pb.Error.AsObject;
|
||||||
result?: SigninResponse.Result.AsObject,
|
result?: SigninResponse.Result.AsObject;
|
||||||
}
|
};
|
||||||
|
|
||||||
export class Result extends jspb.Message {
|
export class Result extends jspb.Message {
|
||||||
getAccessToken(): string;
|
getAccessToken(): string;
|
||||||
|
@ -274,17 +401,132 @@ export namespace SigninResponse {
|
||||||
serializeBinary(): Uint8Array;
|
serializeBinary(): Uint8Array;
|
||||||
toObject(includeInstance?: boolean): Result.AsObject;
|
toObject(includeInstance?: boolean): Result.AsObject;
|
||||||
static toObject(includeInstance: boolean, msg: Result): Result.AsObject;
|
static toObject(includeInstance: boolean, msg: Result): Result.AsObject;
|
||||||
static extensions: {[key: number]: jspb.ExtensionFieldInfo<jspb.Message>};
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
static extensionsBinary: {[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>};
|
static extensionsBinary: {
|
||||||
static serializeBinaryToWriter(message: Result, writer: jspb.BinaryWriter): void;
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: Result,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
static deserializeBinary(bytes: Uint8Array): Result;
|
static deserializeBinary(bytes: Uint8Array): Result;
|
||||||
static deserializeBinaryFromReader(message: Result, reader: jspb.BinaryReader): Result;
|
static deserializeBinaryFromReader(
|
||||||
|
message: Result,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
export namespace Result {
|
export namespace Result {
|
||||||
export type AsObject = {
|
export type AsObject = {
|
||||||
accessToken: string,
|
accessToken: string;
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export class SigninWithoutSecurityCodeRequest extends jspb.Message {
|
||||||
|
getUsername(): string;
|
||||||
|
setUsername(value: string): void;
|
||||||
|
|
||||||
|
getPassword(): string;
|
||||||
|
setPassword(value: string): void;
|
||||||
|
|
||||||
|
serializeBinary(): Uint8Array;
|
||||||
|
toObject(
|
||||||
|
includeInstance?: boolean
|
||||||
|
): SigninWithoutSecurityCodeRequest.AsObject;
|
||||||
|
static toObject(
|
||||||
|
includeInstance: boolean,
|
||||||
|
msg: SigninWithoutSecurityCodeRequest
|
||||||
|
): SigninWithoutSecurityCodeRequest.AsObject;
|
||||||
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
|
static extensionsBinary: {
|
||||||
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: SigninWithoutSecurityCodeRequest,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
|
static deserializeBinary(bytes: Uint8Array): SigninWithoutSecurityCodeRequest;
|
||||||
|
static deserializeBinaryFromReader(
|
||||||
|
message: SigninWithoutSecurityCodeRequest,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): SigninWithoutSecurityCodeRequest;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace SigninWithoutSecurityCodeRequest {
|
||||||
|
export type AsObject = {
|
||||||
|
username: string;
|
||||||
|
password: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export class SigninWithoutSecurityCodeResponse extends jspb.Message {
|
||||||
|
hasError(): boolean;
|
||||||
|
clearError(): void;
|
||||||
|
getError(): protobuf_rpc_pb.Error | undefined;
|
||||||
|
setError(value?: protobuf_rpc_pb.Error): void;
|
||||||
|
|
||||||
|
hasResult(): boolean;
|
||||||
|
clearResult(): void;
|
||||||
|
getResult(): SigninWithoutSecurityCodeResponse.Result | undefined;
|
||||||
|
setResult(value?: SigninWithoutSecurityCodeResponse.Result): void;
|
||||||
|
|
||||||
|
serializeBinary(): Uint8Array;
|
||||||
|
toObject(
|
||||||
|
includeInstance?: boolean
|
||||||
|
): SigninWithoutSecurityCodeResponse.AsObject;
|
||||||
|
static toObject(
|
||||||
|
includeInstance: boolean,
|
||||||
|
msg: SigninWithoutSecurityCodeResponse
|
||||||
|
): SigninWithoutSecurityCodeResponse.AsObject;
|
||||||
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
|
static extensionsBinary: {
|
||||||
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: SigninWithoutSecurityCodeResponse,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
|
static deserializeBinary(
|
||||||
|
bytes: Uint8Array
|
||||||
|
): SigninWithoutSecurityCodeResponse;
|
||||||
|
static deserializeBinaryFromReader(
|
||||||
|
message: SigninWithoutSecurityCodeResponse,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): SigninWithoutSecurityCodeResponse;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace SigninWithoutSecurityCodeResponse {
|
||||||
|
export type AsObject = {
|
||||||
|
error?: protobuf_rpc_pb.Error.AsObject;
|
||||||
|
result?: SigninWithoutSecurityCodeResponse.Result.AsObject;
|
||||||
|
};
|
||||||
|
|
||||||
|
export class Result extends jspb.Message {
|
||||||
|
getAccessToken(): string;
|
||||||
|
setAccessToken(value: string): void;
|
||||||
|
|
||||||
|
serializeBinary(): Uint8Array;
|
||||||
|
toObject(includeInstance?: boolean): Result.AsObject;
|
||||||
|
static toObject(includeInstance: boolean, msg: Result): Result.AsObject;
|
||||||
|
static extensions: { [key: number]: jspb.ExtensionFieldInfo<jspb.Message> };
|
||||||
|
static extensionsBinary: {
|
||||||
|
[key: number]: jspb.ExtensionFieldBinaryInfo<jspb.Message>;
|
||||||
|
};
|
||||||
|
static serializeBinaryToWriter(
|
||||||
|
message: Result,
|
||||||
|
writer: jspb.BinaryWriter
|
||||||
|
): void;
|
||||||
|
static deserializeBinary(bytes: Uint8Array): Result;
|
||||||
|
static deserializeBinaryFromReader(
|
||||||
|
message: Result,
|
||||||
|
reader: jspb.BinaryReader
|
||||||
|
): Result;
|
||||||
|
}
|
||||||
|
|
||||||
|
export namespace Result {
|
||||||
|
export type AsObject = {
|
||||||
|
accessToken: string;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,6 +1,7 @@
|
||||||
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
import { Component, OnInit, ViewEncapsulation } from '@angular/core';
|
||||||
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators } from '@angular/forms';
|
||||||
import { MatDialogRef } from '@angular/material/dialog';
|
import { MatDialogRef } from '@angular/material/dialog';
|
||||||
|
import { AuthService } from 'app/core/auth/auth.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'sign-in-compose',
|
selector: 'sign-in-compose',
|
||||||
|
@ -26,7 +27,8 @@ export class SignInComposeComponent implements OnInit {
|
||||||
*/
|
*/
|
||||||
constructor(
|
constructor(
|
||||||
public matDialogRef: MatDialogRef<SignInComposeComponent>,
|
public matDialogRef: MatDialogRef<SignInComposeComponent>,
|
||||||
private _formBuilder: FormBuilder
|
private _formBuilder: FormBuilder,
|
||||||
|
private _authService: AuthService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
@ -87,5 +89,24 @@ export class SignInComposeComponent implements OnInit {
|
||||||
/**
|
/**
|
||||||
* Send the message
|
* Send the message
|
||||||
*/
|
*/
|
||||||
send(): void {}
|
send(): void {
|
||||||
|
// Return if the form is invalid
|
||||||
|
if (this.composeForm?.invalid) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Disable the form
|
||||||
|
this.composeForm?.disable();
|
||||||
|
|
||||||
|
// Sign in
|
||||||
|
this._authService
|
||||||
|
.signIn(this.composeForm?.value)
|
||||||
|
.then(() => {})
|
||||||
|
.catch((e) => {
|
||||||
|
// Re-enable the form
|
||||||
|
this.composeForm?.enable();
|
||||||
|
|
||||||
|
// Reset the form
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user