Merge branch 'dev' of github.com:Quantum-P3/datasurvey into fix/estilos-de-forms-categorias

This commit is contained in:
Eduardo Quiros 2021-07-11 19:52:11 -06:00
commit b0cf49011c
No known key found for this signature in database
GPG Key ID: B77F36C3F12720B4
11 changed files with 113 additions and 17 deletions

View File

@ -84,7 +84,6 @@ export class RegisterComponent implements AfterViewInit {
const login = this.registerForm.get(['email'])!.value;
const email = this.registerForm.get(['email'])!.value;
const name = this.registerForm.get(['name'])!.value;
console.log(name);
this.registerService
.save({

View File

@ -179,7 +179,6 @@ export class SettingsComponent implements OnInit {
icon.class = 'active';
}
});
console.log(this.profileIcons);
this.usersSharedCollection = this.userService.addUserToCollectionIfMissing(this.usersSharedCollection, usuarioExtra.user);
this.plantillasSharedCollection = this.plantillaService.addPlantillaToCollectionIfMissing(

View File

@ -36,6 +36,7 @@ export class AuthServerProvider {
return new Observable(observer => {
this.localStorageService.clear('authenticationToken');
this.sessionStorageService.clear('authenticationToken');
this.localStorageService.clear('IsGoogle');
observer.complete();
});
}

View File

@ -82,7 +82,6 @@ export class UsuarioExtraUpdateComponent {
const login = this.registerForm.get(['email'])!.value;
const email = this.registerForm.get(['email'])!.value;
const name = this.registerForm.get(['name'])!.value;
console.log(name);
this.registerService
.save({

View File

@ -6,7 +6,7 @@ import { Account } from 'app/core/auth/account.model';
import { AccountService } from 'app/core/auth/account.service';
import { LoginService } from 'app/login/login.service';
import { ProfileService } from 'app/layouts/profiles/profile.service';
import { SessionStorageService } from 'ngx-webstorage';
import { LocalStorageService, SessionStorageService } from 'ngx-webstorage';
import { Router } from '@angular/router';
import { UsuarioExtraService } from 'app/entities/usuario-extra/service/usuario-extra.service';
import { UsuarioExtra } from 'app/entities/usuario-extra/usuario-extra.model';
@ -31,6 +31,7 @@ export class SidebarComponent {
constructor(
private loginService: LoginService,
private sessionStorageService: SessionStorageService,
private localStorageService: LocalStorageService,
private accountService: AccountService,
private profileService: ProfileService,
private router: Router,
@ -87,6 +88,7 @@ export class SidebarComponent {
this.collapseNavbar();
this.loginService.logout();
this.router.navigate(['']);
this.localStorageService.clear('IsGoogle');
}
toggleNavbar(): void {

View File

@ -69,9 +69,9 @@
<div class="card-body p-4">
<div class="text-center w-75 m-auto">
<h4 class="text-dark-50 text-center pb-0 fw-bold p-0 m-0" style="color: #727070; font-weight: 700; font-size: 1.3rem">
INICIAR SESION
INICIAR SESIÓN
</h4>
<p class="mb-4" style="color: rgba(146, 146, 146, 0.664)">Ingrese su correo electrónico y contraseña.</p>
<p class="mb-4" style="color: rgba(146, 146, 146, 0.664)">Ingrese su correo electrónico y contraseña</p>
</div>
<div
@ -82,10 +82,11 @@
>
<strong>Failed to sign in!</strong> Please check your credentials and try again.
</div>
<form class="form" role="form" (ngSubmit)="login()" [formGroup]="loginForm">
<form class="ds-form" role="form" (ngSubmit)="login()" [formGroup]="loginForm">
<div class="mb-3">
<div class="form-group">
<label for="emailaddress" class="form-label">Correo electrónico</label>
<label for="username" class="form-label">Correo electrónico</label>
<input
type="text"
class="form-control"
@ -96,6 +97,41 @@
#username
data-cy="username"
/>
<div
*ngIf="loginForm.get('username')!.invalid && (loginForm.get('username')!.dirty || loginForm.get('username')!.touched)"
>
<small
class="form-text text-danger"
*ngIf="loginForm.get('username')?.errors?.required"
jhiTranslate="global.messages.validate.email.required"
>
Your email is required.
</small>
<small
class="form-text text-danger"
*ngIf="loginForm.get('username')?.errors?.invalid"
jhiTranslate="global.messages.validate.email.invalid"
>
Your email is invalid.
</small>
<small
class="form-text text-danger"
*ngIf="loginForm.get('username')?.errors?.minlength"
jhiTranslate="global.messages.validate.email.minlength"
>
Your email is required to be at least 5 characters.
</small>
<small
class="form-text text-danger"
*ngIf="loginForm.get('username')?.errors?.maxlength"
jhiTranslate="global.messages.validate.email.maxlength"
>
Your email cannot be longer than 100 characters.
</small>
</div>
</div>
</div>
@ -111,6 +147,33 @@
formControlName="password"
data-cy="password"
/>
<div
*ngIf="loginForm.get('password')!.invalid && (loginForm.get('password')!.dirty || loginForm.get('password')!.touched)"
>
<small
class="form-text text-danger"
*ngIf="loginForm.get('password')?.errors?.required"
jhiTranslate="global.messages.validate.newpassword.required"
>
Your password is required.
</small>
<small
class="form-text text-danger"
*ngIf="loginForm.get('password')?.errors?.minlength"
jhiTranslate="global.messages.validate.newpassword.minlength"
>
Your password is required to be at least 4 characters.
</small>
<small
class="form-text text-danger"
*ngIf="loginForm.get('password')?.errors?.maxlength"
jhiTranslate="global.messages.validate.newpassword.maxlength"
>
Your password cannot be longer than 50 characters.
</small>
</div>
</div>
</div>
@ -125,16 +188,27 @@
</div>
<div class="mb-3 mb-0 text-center">
<button type="submit" class="btn btn-primary w-100" data-cy="submit">Iniciar sesion</button>
<button type="submit" class="ds-btn ds-btn--primary w-100" data-cy="submit">Iniciar sesión</button>
</div>
<div class="mb-3 mb-0 text-center">
<button
type="button"
class="ds-btn ds-btn--google w-100 d-flex align-items-center justify-content-center"
(click)="signInWithGoogle()"
>
<img class="mr-2" src="https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg" />
Iniciar con Google
</button>
</div>
</form>
<div class="google-btn w-80 m-auto">
<!-- <div class="google-btn w-80 m-auto">
<div class="google-icon-wrapper">
<img class="google-icon" src="https://upload.wikimedia.org/wikipedia/commons/5/53/Google_%22G%22_Logo.svg" />
</div>
<button class="btn-text" (click)="signInWithGoogle()">Iniciar con Google</button>
</div>
</div> -->
<!--<div class="mb-3 mb-0">
<button class="btn" (click)="signInWithGoogle()">

View File

@ -10,6 +10,7 @@ import { RegisterService } from '../account/register/register.service';
import { TranslateService } from '@ngx-translate/core';
import { HttpErrorResponse } from '@angular/common/http';
import { EMAIL_ALREADY_USED_TYPE, LOGIN_ALREADY_USED_TYPE } from '../config/error.constants';
import { LocalStorageService } from 'ngx-webstorage';
@Component({
selector: 'jhi-login',
@ -26,8 +27,8 @@ export class LoginComponent implements OnInit, AfterViewInit {
errorUserExists = false;
loginForm = this.fb.group({
username: [null, [Validators.required]],
password: [null, [Validators.required]],
username: [null, [Validators.required, Validators.email, Validators.minLength(5), Validators.maxLength(254)]],
password: [null, [Validators.required, Validators.minLength(4), Validators.maxLength(50)]],
rememberMe: [false],
});
@ -36,6 +37,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
success = false;
constructor(
private localStorageService: LocalStorageService,
private accountService: AccountService,
private loginService: LoginService,
private router: Router,
@ -67,7 +69,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
}
ngAfterViewInit(): void {
this.username.nativeElement.focus();
// this.username.nativeElement.focus();
}
//Inicio Google
@ -91,7 +93,7 @@ export class LoginComponent implements OnInit, AfterViewInit {
() => {
this.authenticationError = false;
if (!this.router.getCurrentNavigation()) {
window.localStorage.setItem('IsGoogle', 'true');
this.localStorageService.store('IsGoogle', 'true');
// There were no routing during login (eg from navigationToStoredUrl)
this.router.navigate(['']);
}

View File

@ -52,3 +52,14 @@
color: #d33232;
}
}
.ds-btn--google {
background-color: transparent;
color: #787878;
border: 1px solid #e6e6e6;
img {
width: 20px;
height: 20px;
}
}

View File

@ -13,7 +13,8 @@ $form-background: #f1f5f9;
}
}
input {
input,
input:-webkit-autofill {
background-color: $form-background;
border-radius: 15px;
border: 1.75px solid transparent;
@ -44,3 +45,11 @@ $form-background: #f1f5f9;
color: #757d94;
}
}
input:-internal-autofill-selected,
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
background-color: $form-background !important;
}

View File

@ -9,7 +9,7 @@
},
"messages": {
"error": {
"authentication": "<strong>¡El inicio de sesión ha fallado!</strong> Por favor, revise las credenciales e intente de nuevo."
"authentication": "Revise las credenciales e intente de nuevo "
}
},
"password": {