Commit 937bd5b2 authored by David Burke's avatar David Burke

Added unstyled app verify mfa page

parent 22daff01
Pipeline #64314566 passed with stage
in 12 minutes and 51 seconds
......@@ -21,6 +21,7 @@ import { IAuthStore, IResetPasswordVerifyResponse } from "./user.interfaces";
import { checkRespForErrors } from "~/app/shared/utils";
import { IState, selectAuthState } from "../../app.reducers";
import { IGeneratedMFA } from "../manage-mfa/manage-mfa.interfaces";
import { environment } from "../../../environments/environment";
@Injectable()
export class UserService {
......@@ -56,20 +57,7 @@ export class UserService {
/* Figure out the URL before doing anything else */
public checkAndSetUrl(url: string) {
// strip https
url = url.replace(/^https?\:\/\//i, "");
// normalize ending with /api/
url = url.replace(/\/api\/?/i, "");
url = url + "/api/";
// Try same domain first
let apiUrl = "https://" + url;
// for dev
if (url === "api:8000/api/" || url === "localhost:8000/api/") {
apiUrl = "http://" + url;
}
const apiUrl = this.normalizeServerUrl(url);
return this.http.get(apiUrl + "ping/").pipe(
mergeMap(() => {
this.setSdkUrl(apiUrl);
......@@ -101,6 +89,17 @@ export class UserService {
/** Check url to see if there is a passit server there and return resulting observable */
checkUrl(url: string) {
return this.http.get(this.normalizeServerUrl(url) + "ping/");
}
/**
* Normalize the server url
* - Force https in production like environments
* - Allow some special development non https urls including localhost and 192.*
* - Ensure url ends with /api/ (whether or not user enters it)
* @param url url as the user entered it
*/
private normalizeServerUrl(url: string) {
// strip https (we'll force https later)
url = url.replace(/^https?\:\/\//i, "");
......@@ -114,7 +113,11 @@ export class UserService {
if (url === "api:8000/api/" || url === "localhost:8000/api/") {
apiUrl = "http://" + url;
}
return this.http.get(apiUrl + "ping/");
// Allow non https LAN ip address in dev
if (environment.production === false && url.startsWith("192")) {
apiUrl = "http://" + url;
}
return apiUrl;
}
/*
......
<Button text="login-wrapper works!" class="btn btn-primary"></Button>
\ No newline at end of file
<app-marketing-frame [isPopup]="isPopup">
<ng-content></ng-content>
</app-marketing-frame>
import { VerifyMFAEffects } from "./verify-mfa/verify-mfa.effects";
import { LoginEffects } from "./login.effects";
export const effects = [LoginEffects, VerifyMFAEffects];
import { NgModule, NO_ERRORS_SCHEMA } from "@angular/core";
import { NativeScriptCommonModule } from "nativescript-angular/common";
import { EffectsModule } from "@ngrx/effects";
import { NgrxFormsModule } from "ngrx-forms";
import { StoreModule } from "@ngrx/store";
import * as fromLogin from "./login.reducer";
import { TNSLoginEffects } from "./tns-login-effects.tns";
import { LoginComponent } from "./login.component";
import { LoginContainer } from "./login.container";
import { LoginEffects } from "./login.effects";
import { StoreModule } from "@ngrx/store";
import { SharedModule } from "../shared/shared.module";
import { NgrxFormsModule } from "ngrx-forms";
import { ProgressIndicatorModule } from "../progress-indicator/progress-indicator.module";
import { VerifyMfaComponent } from "./verify-mfa/verify-mfa.component";
import { VerifyMfaContainer } from "./verify-mfa/verify-mfa.container";
import { LoginWrapperComponent } from "./login-wrapper/login-wrapper.component";
import { effects } from "./login.common";
@NgModule({
declarations: [
......@@ -26,7 +26,7 @@ import { LoginWrapperComponent } from "./login-wrapper/login-wrapper.component";
imports: [
NativeScriptCommonModule,
StoreModule.forFeature("login", fromLogin.reducers),
EffectsModule.forFeature([LoginEffects, TNSLoginEffects]),
EffectsModule.forFeature([...effects, TNSLoginEffects]),
SharedModule,
NgrxFormsModule,
ProgressIndicatorModule
......
......@@ -6,14 +6,13 @@ import { EffectsModule } from "@ngrx/effects";
import * as fromLogin from "./login.reducer";
import { LoginComponent } from "./login.component";
import { LoginContainer } from "./login.container";
import { LoginEffects } from "./login.effects";
import { SharedModule } from "../shared/shared.module";
import { NgrxFormsModule } from "ngrx-forms";
import { ProgressIndicatorModule } from "../progress-indicator/progress-indicator.module";
import { VerifyMfaComponent } from "./verify-mfa/verify-mfa.component";
import { VerifyMfaContainer } from "./verify-mfa/verify-mfa.container";
import { VerifyMFAEffects } from "./verify-mfa/verify-mfa.effects";
import { LoginWrapperComponent } from "./login-wrapper/login-wrapper.component";
import { effects } from "./login.common";
export const COMPONENTS = [
LoginComponent,
......@@ -28,7 +27,7 @@ export const COMPONENTS = [
imports: [
CommonModule,
StoreModule.forFeature("login", fromLogin.reducers),
EffectsModule.forFeature([LoginEffects, VerifyMFAEffects]),
EffectsModule.forFeature(effects),
SharedModule,
NgrxFormsModule,
ProgressIndicatorModule
......
......@@ -8,6 +8,11 @@ import {
SetValueAction
} from "ngrx-forms";
import { required, pattern } from "ngrx-forms/validation";
import {
createSelector,
createFeatureSelector,
ActionReducerMap
} from "@ngrx/store";
import { environment } from "../../environments/environment";
import { AppActions, AppActionTypes } from "../app.actions";
......@@ -15,11 +20,6 @@ import { ILoginForm } from "./interfaces";
import { DEFAULT_API } from "../constants";
import { oldPasswordValidators } from "../account/constants";
import { IBaseFormState } from "../utils/interfaces";
import {
createSelector,
createFeatureSelector,
ActionReducerMap
} from "@ngrx/store";
import * as fromRoot from "../app.reducers";
import * as fromVerifyMfa from "./verify-mfa/verify-mfa.reducer";
......
<Button text="verify-mfa works!" class="btn btn-primary"></Button>
\ No newline at end of file
<app-login-wrapper
[isPopup]="isPopup"
(clickLink)="goToLogin.emit()"
linkText="Return to Login"
>
<FlexboxLayout
dock="bottom"
class="auth-actions"
flexDirection="row"
justifyContent="space-between"
>
<app-button text="Log In" (tap)="onSubmit.emit()"></app-button>
</FlexboxLayout>
<app-text-field
label="Verification Code"
type="number"
[ngrxFormControl]="form.controls.otp"
[isFormSubmitted]="form.isSubmitted"
></app-text-field>
</app-login-wrapper>
......@@ -12,7 +12,8 @@ import { AbstractControlState } from "ngrx-forms";
enum TextFieldType {
email = "email",
password = "password",
url = "url"
url = "url",
number = "number"
}
@Component({
......@@ -55,6 +56,8 @@ export class TextFieldComponent {
return "email";
case TextFieldType.url:
return "url";
case TextFieldType.number:
return "number";
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment