bugfixes login

This commit is contained in:
Chneemann 2024-05-11 11:31:52 +02:00
parent d4f1231e06
commit a91162832b
4 changed files with 51 additions and 20 deletions

View file

@ -15,7 +15,7 @@
<img src="./../../../assets/img/login/blue-line.svg" alt="" /> <img src="./../../../assets/img/login/blue-line.svg" alt="" />
<div class="input-fields"> <div class="input-fields">
<input <input
type="text" type="mail"
id="mail" id="mail"
name="mail" name="mail"
#mail="ngModel" #mail="ngModel"
@ -24,11 +24,15 @@
[(ngModel)]="loginData.mail" [(ngModel)]="loginData.mail"
required required
/> />
@if(!loginData.mail) {
<img <img
class="custom-img" class="custom-img"
src="./../../../assets/img/login/mail.svg" src="./../../../assets/img/login/mail.svg"
alt="" alt=""
/> />
} @else {
<img class="custom-img" alt="" />
}
<div class="error-msg"> <div class="error-msg">
@if (!mail.valid && mail.touched) { @if (!mail.valid && mail.touched) {
<p>You must enter a mail.</p> <p>You must enter a mail.</p>
@ -46,11 +50,15 @@
[(ngModel)]="loginData.password" [(ngModel)]="loginData.password"
required required
/> />
@if(!loginData.password) {
<img <img
class="custom-img" class="custom-img"
src="./../../../assets/img/login/lock.svg" src="./../../../assets/img/login/lock.svg"
alt="" alt=""
/> />
} @else {
<img class="custom-img" alt="" />
}
<div class="error-msg"> <div class="error-msg">
@if (!password.valid && password.touched) { @if (!password.valid && password.touched) {
<p>You must enter a password.</p> <p>You must enter a password.</p>
@ -78,7 +86,8 @@
!loginData.mail || !loginData.mail ||
password.invalid || password.invalid ||
!loginData.password || !loginData.password ||
sharedService.isBtnDisabled sharedService.isBtnDisabled ||
!checkIfUserEmailIsValid(loginData.mail)
" "
></app-form-btn> ></app-form-btn>
<app-form-btn <app-form-btn

View file

@ -126,6 +126,15 @@ section {
/*------------- RESPONSIVE -------------*/ /*------------- RESPONSIVE -------------*/
@media (max-height: 820px) {
.content {
top: 40%;
}
.logo {
display: none;
}
}
@media screen and (max-width: 650px) { @media screen and (max-width: 650px) {
.content { .content {
width: 322px; width: 322px;
@ -154,6 +163,12 @@ section {
} }
} }
@media (max-height: 550px) {
.content {
top: 45%;
}
}
@media screen and (max-width: 450px) { @media screen and (max-width: 450px) {
.content { .content {
width: 252px; width: 252px;
@ -164,6 +179,20 @@ section {
} }
} }
.input-fields {
.custom-input {
font-size: 16px;
}
.custom-img {
&:nth-child(2) {
top: 2px;
}
&:nth-child(5) {
top: 73px;
}
}
}
.input-fields { .input-fields {
width: 80%; width: 80%;
} }
@ -175,18 +204,3 @@ section {
} }
} }
} }
@media (max-height: 820px) {
.content {
top: 40%;
}
.logo {
display: none;
}
}
@media (max-height: 550px) {
.content {
top: 45%;
}
}

View file

@ -45,4 +45,14 @@ export class LoginComponent {
googleLogin() { googleLogin() {
this.loginSerivce.googleLogin(); this.loginSerivce.googleLogin();
} }
checkIfUserEmailIsValid(emailValue: string) {
const channelNameLenght = emailValue.length;
const emailRegex = /^[\w.%+-]+@[\w.-]+\.[a-zA-Z]{2,}$/;
if (emailRegex.test(emailValue)) {
return true;
} else {
return false;
}
}
} }

View file

@ -28,9 +28,7 @@ export class LoginService {
constructor( constructor(
private firebaseService: FirebaseService, private firebaseService: FirebaseService,
public sharedService: SharedService public sharedService: SharedService
) { ) {}
console.log(this.sharedService.generateRandomColor());
}
login(loginData: { mail: string; password: string }) { login(loginData: { mail: string; password: string }) {
signInWithEmailAndPassword(getAuth(), loginData.mail, loginData.password) signInWithEmailAndPassword(getAuth(), loginData.mail, loginData.password)